/* ==============================================================
   Consentement aux cookies et tableau de bord d'audience.
   Reprend les variables de main.css : aucune couleur en dur, hors
   nuances propres aux graphiques.
   ============================================================== */

/* ---------- Bannière ---------- */

.cookie-banniere {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.35rem clamp(1rem, 4vw, 3rem);
    background: var(--color-surface);
    border-top: 4px solid var(--color-primary);
    box-shadow: 0 -8px 28px rgba(4, 27, 58, 0.16);
    animation: cookie-monte 220ms ease-out;
}

@keyframes cookie-monte {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-banniere { animation: none; }
}

.cookie-banniere-texte {
    flex: 1 1 30rem;
    min-width: 0;
}

.cookie-banniere-texte h2 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    color: var(--color-primary);
}

.cookie-banniere-texte p {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--color-text-main);
    max-width: 60ch;
}

.cookie-lien,
.cookie-lien-pied {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 0.82rem;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
}

.cookie-lien-pied {
    color: inherit;
    font-size: inherit;
}

.cookie-lien:hover,
.cookie-lien-pied:hover { color: var(--color-secondary); }

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

/* Les trois choix ont le même poids visuel : un « refuser » discret
   viderait le consentement de sa valeur. */
.cookie-actions .nav-btn {
    min-width: 9.5rem;
    justify-content: center;
}

@media (max-width: 640px) {
    .cookie-actions { width: 100%; }
    .cookie-actions .nav-btn { flex: 1 1 100%; }
}

/* ---------- Panneau de personnalisation ---------- */

.cookie-modale {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(4, 27, 58, 0.55);
}

.cookie-modale-boite {
    background: var(--color-surface);
    border-radius: 10px;
    width: min(38rem, 100%);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cookie-modale-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--color-border);
}

.cookie-modale-entete h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-primary);
}

.cookie-fermer {
    background: none;
    border: 0;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    border-radius: 6px;
}
.cookie-fermer:hover { background: var(--color-bg); color: var(--color-text-main); }

.cookie-modale-corps {
    padding: 0.5rem 1.35rem;
    overflow-y: auto;
}

.cookie-categorie {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}
.cookie-categorie:last-child { border-bottom: 0; }

.cookie-categorie-titre {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-categorie-titre label {
    font-weight: 600;
    color: var(--color-text-main);
    cursor: pointer;
}

.cookie-categorie p {
    margin: 0.4rem 0 0;
    font-size: 0.83rem;
    line-height: 1.55;
    color: var(--color-text-muted);
    max-width: 62ch;
}

.cookie-obligatoire {
    display: inline-block;
    margin-top: 0.45rem;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-success);
    background: var(--color-success-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.cookie-interrupteur {
    width: 2.75rem;
    height: 1.5rem;
    flex: 0 0 auto;
    cursor: pointer;
    accent-color: var(--color-primary);
}
.cookie-interrupteur:disabled { cursor: not-allowed; opacity: 0.55; }

.cookie-modale-pied {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 1.05rem 1.35rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    border-radius: 0 0 10px 10px;
}

/* ---------- Tableau de bord Audience ---------- */

.audience-onglets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.audience-onglet {
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 0.65rem 1.1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
}
.audience-onglet:hover { color: var(--color-text-main); }
.audience-onglet.actif {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.audience-note {
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    max-width: 72ch;
    margin: 0 0 1.5rem;
}

.audience-cartes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}

.audience-carte {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.1rem;
}

.audience-carte-valeur {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

.audience-carte-libelle {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--color-text-main);
}

.audience-carte-precision {
    margin-top: 0.15rem;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.audience-grille {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.1rem;
}

.audience-bloc {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.1rem;
}
.audience-grille .audience-bloc { margin-bottom: 0; }

.audience-bloc h3 {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: var(--color-primary);
}

.audience-bloc h4 {
    color: var(--color-text-muted);
    margin: 0 0 0.6rem;
}

.audience-vide {
    font-size: 0.84rem;
    color: var(--color-text-muted);
    margin: 0;
    padding: 0.75rem 0;
}

/* --- Barres horizontales --- */

.audience-barre { margin-bottom: 0.85rem; }
.audience-barre:last-child { margin-bottom: 0; }

.audience-barre-entete {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}
.audience-barre-entete span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-main);
}
.audience-barre-entete strong {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}

.audience-barre-piste {
    height: 0.5rem;
    background: var(--color-bg);
    border-radius: 999px;
    overflow: hidden;
}

.audience-barre-remplissage {
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
    min-width: 2px;
}

/* --- Histogramme --- */

.audience-colonnes {
    display: flex;
    align-items: flex-end;
    gap: 0.2rem;
    height: 11rem;
    overflow-x: auto;
    padding-bottom: 1.35rem;
    position: relative;
}

.audience-colonne {
    flex: 1 0 1.4rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: relative;
}

.audience-colonne-barre {
    width: 100%;
    max-width: 2.25rem;
    background: var(--color-primary);
    border-radius: 3px 3px 0 0;
    transition: opacity 140ms ease;
}
.audience-colonne:hover .audience-colonne-barre { opacity: 0.75; }

.audience-colonne-libelle {
    position: absolute;
    bottom: -1.25rem;
    font-size: 0.62rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .audience-colonne-barre { transition: none; }
}

/* --- Repères de décision dans le tableau des consentements --- */

.data-table tr.consent-accepte td:first-child { box-shadow: inset 3px 0 0 var(--color-success); }
.data-table tr.consent-refuse td:first-child { box-shadow: inset 3px 0 0 var(--color-error); }
.data-table tr.consent-personnalise td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }

/* Utilitaire d'accessibilité : libellé lu par les lecteurs d'écran seulement. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
