/**
 * cookie-banner.css — Sprint Vitrine-03 Phase 3
 *
 * Bannière cookies EDPB-compliant + modal Personnaliser.
 * Réutilise les design tokens existants (--navy, --accent, --green, --cta-*).
 *
 * Hiérarchie visuelle : Accepter / Refuser au MÊME niveau visuel (EDPB 03/2022 §3.3).
 * Personnaliser secondary mais lisible. Pas de croix de fermeture (D2).
 */

/* ====== Bannière (bandeau bas) ====== */

#cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #12202f;            /* --navy */
    color: #ffffff;
    border-top: 2px solid #f0e3a4;  /* --accent */
    padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

#cookie-banner[hidden] {
    display: none !important;
}

.cookie-banner-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.cookie-banner-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: #f0e3a4;  /* --accent */
}

.cookie-banner-text {
    font-size: 0.92rem;
    margin: 0;
    color: #e8eaed;
    max-width: 900px;
}

.cookie-banner-text a {
    color: #f0e3a4;
    text-decoration: underline;
}

.cookie-banner-text a:hover,
.cookie-banner-text a:focus {
    color: #61C452;  /* --green */
    outline: 2px solid #61C452;
    outline-offset: 2px;
}

.cookie-banner-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

.cookie-btn {
    /* Tap-target a11y 48x48 minimum */
    min-height: 48px;
    min-width: 160px;
    padding: 12px 24px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease, border-color 150ms ease;
    text-align: center;
}

/* Accepter ET Refuser : couleur Petzerhiel primary turquoise, EDPB §3.3 (égalité) */
.cookie-btn-primary {
    background: #009FCB;            /* --cta-primary-bg */
    color: #ffffff;
    border-color: #009FCB;
}

.cookie-btn-primary:hover,
.cookie-btn-primary:focus {
    background: #61C452;            /* --cta-primary-bg-hover (vert) */
    border-color: #61C452;
    color: #ffffff;
    transform: translateY(-1px);
    outline: none;
}

/* Personnaliser : accent crème Petzerhiel, distinct du primary mais bien visible */
.cookie-btn-secondary {
    background: #f0e3a4;            /* --cta-accent-bg */
    color: #12202f;                 /* --cta-accent-color */
    border-color: #f0e3a4;
}

.cookie-btn-secondary:hover,
.cookie-btn-secondary:focus {
    background: #ffffff;
    border-color: #ffffff;
    color: #12202f;
    transform: translateY(-1px);
    outline: none;
}

/* Ghost : utilisé sur le bouton Annuler de la modal */
.cookie-btn-ghost {
    background: transparent;
    color: #6b7280;
    border-color: transparent;
}

.cookie-btn-ghost:hover,
.cookie-btn-ghost:focus {
    color: #12202f;
    background: #e8eaed;
    outline: none;
}

/* ====== Modal Personnaliser ====== */

#cookie-customize-modal {
    position: fixed;
    inset: 0;
    z-index: 1010;
    background: rgba(18, 32, 47, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

#cookie-customize-modal[hidden] {
    display: none !important;
}

.cookie-modal-content {
    background: #ffffff;
    color: #12202f;
    max-width: 600px;
    width: 100%;
    border-radius: 14px;
    padding: 28px 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.30);
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 90vh;
    overflow-y: auto;
}

.cookie-modal-content h2 {
    font-size: 1.25rem;
    margin: 0;
    color: #12202f;
    outline: none;  /* le focus visible vient des fieldsets / boutons */
}

.cookie-modal-content > p {
    font-size: 0.92rem;
    margin: 0;
    color: #4b5563;
}

.cookie-purpose-block {
    border: 1px solid #e8eaed;
    border-radius: 10px;
    padding: 16px;
    background: #fafbfc;
}

.cookie-purpose-block legend {
    font-weight: 600;
    color: #12202f;
    font-size: 0.95rem;
    padding: 0 6px;
}

.cookie-purpose-block label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    color: #4b5563;
    margin-top: 8px;
}

.cookie-purpose-block label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #61C452;  /* --green */
    cursor: pointer;
}

.cookie-purpose-block label input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.cookie-purpose-block label input[type="checkbox"]:disabled + .cookie-purpose-text {
    color: #6b7280;
}

.cookie-purpose-text {
    display: block;
}

.cookie-purpose-text strong {
    display: block;
    color: #12202f;
    margin-bottom: 2px;
}

.cookie-modal-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    justify-content: flex-end;
}

/* Body scrolling : on bloque le scroll du fond quand la modal est ouverte */
body.cookie-modal-open {
    overflow: hidden;
}

/* ====== Page legal : override hover qui blanchit le fond et réduit le contraste ====== */
/* Sur les autres pages construction (.square-block), le hover éclaircit le fond
 * (rgba(255,255,255,0.18)) — design choice global de layout-b.css. Sur la page
 * legal, le texte est dense (politique de confidentialité) et le hover clair
 * réduit la lisibilité (texte blanc sur fond presque blanc). On force un hover
 * plus sombre, qui augmente le contraste au lieu de le réduire. */
body.page-legal .content-blocks.construction-content .square-block:hover {
    background: rgba(0, 0, 0, 0.45) !important;
}

/* ====== Withdraw button (page legal) ====== */

.cookie-withdraw-wrapper {
    margin-top: 24px;
    padding: 16px;
    background: #fafbfc;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    text-align: center;
}

#cookie-withdraw-btn {
    background: transparent;
    color: #aa2e25;
    border: 2px solid #aa2e25;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    transition: background 150ms ease;
}

#cookie-withdraw-btn:hover,
#cookie-withdraw-btn:focus {
    background: #aa2e25;
    color: #ffffff;
    outline: none;
}

/* ====== Responsive mobile (≤ 768px) ====== */

@media (max-width: 768px) {
    #cookie-banner {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .cookie-banner-title {
        font-size: 1.0rem;
    }
    .cookie-banner-text {
        font-size: 0.88rem;
    }
    .cookie-banner-buttons {
        flex-direction: column;
    }
    .cookie-btn {
        width: 100%;
        min-width: 0;
    }
    .cookie-modal-content {
        padding: 20px 16px;
        max-height: 95vh;
    }
    .cookie-modal-buttons {
        flex-direction: column;
    }
    .cookie-modal-buttons .cookie-btn {
        width: 100%;
    }
}

/* ====== Reduced motion ====== */

@media (prefers-reduced-motion: reduce) {
    .cookie-btn,
    #cookie-withdraw-btn {
        transition: none;
    }
    .cookie-btn:hover,
    .cookie-btn:focus,
    .cookie-btn-primary:hover,
    .cookie-btn-primary:focus,
    .cookie-btn-secondary:hover,
    .cookie-btn-secondary:focus {
        transform: none;
    }
}
