/* ─────────────────────────────────────────────
   AV Consent Mode — Bannière & Panneau
   Couleurs pilotées par les CSS variables :
     --avc-bg            fond bannière / panneau
     --avc-text          couleur du texte
     --avc-primary       fond bouton principal
     --avc-primary-text  texte bouton principal
     --avc-accent        toggle actif, liens, focus
   ───────────────────────────────────────────── */

/* Valeurs par défaut (écrasées par le style inline généré en PHP) */
:root {
    --avc-bg:           #ffffff;
    --avc-text:         #333333;
    --avc-primary:      #111111;
    --avc-primary-text: #ffffff;
    --avc-accent:       #111111;
}

/* ── Bannière (barre fixe bas de page) ──────── */

#av-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--avc-bg);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .12);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--avc-text);
}

.av-consent-inner {
    max-width: 1120px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.av-consent-text {
    flex: 1;
    min-width: 0;
}

.av-consent-text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--avc-text);
}

.av-consent-text p {
    margin: 0;
    color: var(--avc-text);
    opacity: .75;
}

.av-consent-text p a {
    color: var(--avc-accent);
    text-decoration: underline;
    margin-left: 4px;
    opacity: 1;
}

.av-consent-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

/* ── Boutons ─────────────────────────────────── */

.av-btn {
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: opacity .18s, border-color .18s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

/* Tout accepter */
.av-btn-primary {
    background: var(--avc-primary);
    color: var(--avc-primary-text);
    border-color: var(--avc-primary);
}
.av-btn-primary:hover {
    opacity: .85;
}
.av-btn-primary:focus-visible {
    outline: 3px solid var(--avc-accent);
    outline-offset: 2px;
}

/* Tout refuser */
.av-btn-secondary {
    background: var(--avc-bg);
    color: var(--avc-text);
    border-color: var(--avc-text);
    opacity: .55;
}
.av-btn-secondary:hover {
    opacity: 1;
}

/* Personnaliser */
.av-btn-outline {
    background: transparent;
    color: var(--avc-text);
    border-color: var(--avc-text);
    opacity: .35;
}
.av-btn-outline:hover {
    opacity: .7;
}

/* ── Panneau de personnalisation (modale) ───── */

#av-consent-panel {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--avc-text);
}

.av-panel-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(2px);
}

.av-panel-box {
    position: relative;
    background: var(--avc-bg);
    color: var(--avc-text);
    border-radius: 14px;
    padding: 32px;
    max-width: 540px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
}

.av-panel-box h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--avc-text);
}

.av-panel-box > p {
    margin: 0 0 24px;
    color: var(--avc-text);
    opacity: .65;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Lignes de toggles ───────────────────────── */

.av-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-top: 1px solid;
    border-color: var(--avc-text);
    opacity-border: .12;
    border-top-color: color-mix(in srgb, var(--avc-text) 15%, transparent);
    gap: 20px;
}

.av-toggle-info {
    flex: 1;
}

.av-toggle-info strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--avc-text);
    margin-bottom: 3px;
}

.av-toggle-info span {
    font-size: 13px;
    color: var(--avc-text);
    opacity: .6;
    line-height: 1.4;
}

/* ── Toggle switch ───────────────────────────── */

.av-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.av-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.av-slider {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--avc-text) 25%, transparent);
    border-radius: 28px;
    transition: background .2s;
}

.av-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: var(--avc-bg);
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

.av-toggle input:checked + .av-slider {
    background: var(--avc-accent);
}

.av-toggle input:checked + .av-slider::before {
    transform: translateX(20px);
}

.av-toggle input:focus-visible + .av-slider {
    outline: 3px solid var(--avc-accent);
    outline-offset: 2px;
}

/* Toggle "Nécessaires" — toujours vert (signification universelle) */
.av-toggle-on .av-slider {
    background: #4caf50;
}

.av-toggle-disabled {
    cursor: not-allowed;
    pointer-events: none;
    opacity: .65;
}

/* ── Actions du panneau ──────────────────────── */

.av-panel-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid;
    border-top-color: color-mix(in srgb, var(--avc-text) 15%, transparent);
    justify-content: flex-end;
}

/* ── Responsive ──────────────────────────────── */

@media (max-width: 700px) {
    #av-consent-banner {
        padding: 16px;
    }

    .av-consent-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .av-consent-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .av-consent-actions .av-btn:last-child {
        grid-column: 1 / -1;
    }

    .av-panel-box {
        padding: 24px 18px;
        border-radius: 10px;
    }

    .av-panel-actions {
        flex-direction: column;
    }

    .av-panel-actions .av-btn {
        width: 100%;
        text-align: center;
    }
}
