/**
 * Cases à cocher MIP — style unifié plateforme + apps tenant.
 * Exclusions : .mip-cb-native (natif), .pf-night-switch (toggle), [hidden].
 */

:root {
    --mip-cb-size: 20px;
    --mip-cb-radius: 6px;
    --mip-cb-border: #94a3b8;
    --mip-cb-border-hover: #5b21b6;
    --mip-cb-bg: #fff;
    --mip-cb-checked: linear-gradient(145deg, #8b5cf6, #5b21b6);
    --mip-cb-checked-border: #5b21b6;
    --mip-cb-focus-ring: rgba(91, 33, 182, 0.22);
    --mip-cb-hover-ring: rgba(91, 33, 182, 0.12);
    --mip-cb-shadow: 0 2px 8px rgba(91, 33, 182, 0.28);
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]) {
    appearance: none;
    -webkit-appearance: none;
    width: var(--mip-cb-size);
    height: var(--mip-cb-size);
    min-width: var(--mip-cb-size);
    margin: 0;
    border: 2px solid var(--mip-cb-border);
    border-radius: var(--mip-cb-radius);
    background: var(--mip-cb-bg);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    vertical-align: middle;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]):hover:not(:disabled) {
    border-color: var(--mip-cb-border-hover);
    box-shadow: 0 0 0 3px var(--mip-cb-hover-ring);
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]):focus-visible {
    outline: none;
    border-color: var(--mip-cb-border-hover);
    box-shadow: 0 0 0 3px var(--mip-cb-focus-ring);
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]):checked {
    border-color: var(--mip-cb-checked-border);
    background: var(--mip-cb-checked);
    box-shadow: var(--mip-cb-shadow);
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]):checked::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 46%;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: translate(-50%, -55%) rotate(45deg);
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]):active:not(:disabled) {
    transform: scale(0.94);
}

input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]):disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}

/* Labels avec checkbox — alignement cohérent */
label:has(> input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden])) {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.mip-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    min-height: 36px;
}

.mip-check--solo {
    gap: 0;
    min-height: 0;
    padding: 4px;
}

.mip-check-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    line-height: 1.3;
}

.entity-perms-table label.mip-check {
    justify-content: flex-start;
}

.mip-settings-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main, #0f172a);
}

.remember-me,
.kindi-remember {
    gap: 10px;
}

.remember-me span,
.kindi-remember span {
    color: var(--text-secondary, #334155);
    font-weight: 600;
}

.mip-user-role-chip:has(input[type="checkbox"]:checked) {
    border-color: rgba(91, 33, 182, 0.35);
    background: rgba(91, 33, 182, 0.08);
    color: #4c1d95;
}

.col-checkbox,
.role-pages-table td,
.products-col-select {
    text-align: center;
    vertical-align: middle;
}

[data-theme="dark"] input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]),
html[data-theme="dark"] input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]),
body.theme-dark input[type="checkbox"]:not(.mip-cb-native):not(.pf-night-switch):not([hidden]) {
    --mip-cb-bg: #1e293b;
    --mip-cb-border: #64748b;
    --mip-cb-checked-border: #a78bfa;
    --mip-cb-checked: linear-gradient(145deg, #7c3aed, #5b21b6);
}

[data-theme="dark"] .mip-check-label,
[data-theme="dark"] .mip-settings-check,
[data-theme="dark"] .remember-me span,
[data-theme="dark"] .kindi-remember span {
    color: #e2e8f0;
}
