/* ============================================================
   consent.css, bandeau et panneau de consentement aux cookies
   (lot L9). Charge apres nature.css : les variables --pep-*
   y sont deja definies.

   Parti pris : fond papier, bord vert, pas de voile plein ecran.
   Le bandeau se pose en bas de page et n'empeche pas de naviguer.
   Sur mobile il occupe toute la largeur et les boutons s'empilent.
   ============================================================ */

.pep-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    display: flex;
    justify-content: center;
    padding: 0 16px 16px;
    pointer-events: none;         /* seuls le bandeau et le panneau captent */
}
.pep-consent[hidden] { display: none; }

.pep-consent-bandeau,
.pep-consent-panneau {
    pointer-events: auto;
    width: 100%;
    max-width: 980px;
    background: var(--pep-paper, #FBF9F3);
    color: var(--pep-ink, #2B2A24);
    border: 1px solid var(--pep-green, #1B3C2D);
    border-left: 4px solid var(--pep-green, #1B3C2D);
    border-radius: var(--pep-radius, 10px);
    box-shadow: 0 18px 45px -22px rgba(27, 60, 45, 0.55);
    padding: 20px 22px;
}
.pep-consent-bandeau[hidden],
.pep-consent-panneau[hidden] { display: none; }

.pep-consent-bandeau {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.pep-consent-corps { flex: 1 1 380px; min-width: 0; }

.pep-consent-titre {
    font-size: 1.02rem;
    margin: 0 0 6px;
    color: var(--pep-green, #1B3C2D);
}
.pep-consent-texte {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--pep-ink-soft, #5F5C52);
}
.pep-consent-lien {
    color: var(--pep-green, #1B3C2D);
    text-decoration: underline;
    white-space: nowrap;
}

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

.pep-consent-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.pep-consent-btn {
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 11px 18px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--pep-green, #1B3C2D);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.pep-consent-btn-plein {
    background: var(--pep-accent, #A2BA48);
    border-color: var(--pep-accent, #A2BA48);
    color: var(--pep-green, #1B3C2D);
}
.pep-consent-btn-plein:hover { background: var(--pep-accent-dark, #8AA038); }
.pep-consent-btn-ligne {
    background: transparent;
    color: var(--pep-green, #1B3C2D);
}
.pep-consent-btn-ligne:hover { background: rgba(27, 60, 45, 0.08); }
.pep-consent-btn:focus-visible,
.pep-consent-fermer:focus-visible,
.pep-consent-switch:focus-visible {
    outline: 2px solid var(--pep-green, #1B3C2D);
    outline-offset: 2px;
}

/* ── Panneau ──────────────────────────────────────────────── */

.pep-consent-panneau {
    max-width: 620px;
    max-height: min(78vh, 640px);
    overflow-y: auto;
}
.pep-consent-panneau-tete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}
.pep-consent-fermer {
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    background: none;
    border: 0;
    color: var(--pep-ink-soft, #5F5C52);
    cursor: pointer;
    padding: 0 4px;
}
.pep-consent-fermer:hover { color: var(--pep-green, #1B3C2D); }

.pep-consent-liste {
    list-style: none;
    margin: 12px 0 18px;
    padding: 0;
}
.pep-consent-item {
    border-top: 1px solid var(--pep-line, rgba(43, 42, 36, 0.12));
    padding: 14px 0 0;
    margin-bottom: 14px;
}
.pep-consent-item-tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.pep-consent-item-nom {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--pep-green, #1B3C2D);
}
label.pep-consent-item-nom { cursor: pointer; }
.pep-consent-toujours {
    font-size: 0.78rem;
    color: var(--pep-ink-soft, #5F5C52);
    background: rgba(162, 186, 72, 0.2);
    border-radius: 999px;
    padding: 4px 12px;
    white-space: nowrap;
}
.pep-consent-item-texte {
    margin: 7px 0 0;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--pep-ink-soft, #5F5C52);
}

/* Interrupteur : case a cocher native redessinee (role="switch"). */
.pep-consent-switch {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: rgba(43, 42, 36, 0.22);
    border: 0;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin: 0;
}
.pep-consent-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}
.pep-consent-switch:checked { background: var(--pep-accent, #A2BA48); }
.pep-consent-switch:checked::after { transform: translateX(20px); }

/* ── Mobile : pleine largeur, boutons empiles ─────────────── */

@media screen and (max-width: 700px) {
    .pep-consent { padding: 0; }
    .pep-consent-bandeau,
    .pep-consent-panneau {
        max-width: none;
        border-radius: var(--pep-radius, 10px) var(--pep-radius, 10px) 0 0;
        border-left-width: 1px;
        border-top: 4px solid var(--pep-green, #1B3C2D);
        padding: 14px 16px 16px;
    }
    .pep-consent-panneau { max-height: 88vh; }

    /* Le bandeau occupait 430 px sur une fenetre de 780, soit 55 % de la
       surface visible, et masquait le second bouton de la banniere
       d'accueil : titre, texte et trois boutons empiles. Ici, une ligne de
       texte, deux boutons cote a cote, « Personnaliser » en dessous.
       Le titre reste dans le balisage pour aria-labelledby, hors de vue. */
    .pep-consent-bandeau { gap: 12px; }
    .pep-consent-bandeau .pep-consent-titre {
        position: absolute;
        width: 1px; height: 1px;
        margin: -1px; padding: 0; border: 0;
        overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    }
    .pep-consent-corps { flex: 1 1 100%; }
    .pep-consent-texte { font-size: 0.94rem; line-height: 1.45; }

    .pep-consent-actions {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .pep-consent-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        padding: 11px 12px;
        text-align: center;
    }
    /* « Personnaliser » passe sur sa propre ligne, en lien discret. */
    .pep-consent-actions .pep-consent-btn:last-child {
        flex: 1 1 100%;
        border-color: transparent;
        text-decoration: underline;
        min-height: 40px;
        padding: 8px 12px;
    }
}

/* ── Mobile, version compacte (10/10) : deux lignes au lieu de quatre.
   Texte court + « Personnaliser » en lien ; « Refuser » et « Tout accepter »
   côte à côte, même poids visuel (refuser aussi simple qu'accepter). ── */
.pep-consent-court, .pep-consent-perso-mobile { display: none; }
@media screen and (max-width: 700px) {
    .pep-consent-bandeau { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important; gap: 10px !important; }
    .pep-consent-texte { font-size: 0.84rem !important; line-height: 1.45 !important; }
    .pep-consent-perso-mobile { display: inline; background: none; border: 0; padding: 0; margin-left: 4px; font: inherit; font-weight: 600; cursor: pointer; }
    .pep-consent-actions .pep-consent-btn:last-child { display: none !important; }
    .pep-consent-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
    .pep-consent-actions .pep-consent-btn-plein { order: 2; }
    .pep-consent-btn { min-height: 44px; padding: 10px 12px !important; }
    .pep-consent-long { display: none; }
    .pep-consent-court { display: inline; }
}
