/* ═══════════════════════════════════════════════════════════════════════════
   AUDITS — Système de thèmes
   Thème 1 : Isotopic Dark (défaut)
   Thème 2 : Système de Design de l'État (DSFR)
   Thème 3 : Herb Agency
   ═══════════════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────────────────
   THÈME 1 : ISOTOPIC DARK (défaut — déjà défini dans main.css via :root)
   Aucune surcharge nécessaire
   ─────────────────────────────────────────────────────────────────────────── */

/* ───────────────────────────────────────────────────────────────────────────
   THÈME 2 : SYSTÈME DE DESIGN DE L'ÉTAT (DSFR)
   Inspiré de https://www.systeme-de-design.gouv.fr/
   Bleu Marianne officiel, typographie sobre, look institutionnel clair
   ─────────────────────────────────────────────────────────────────────────── */
[data-theme="dsfr"] {
    /* Palette DSFR officielle */
    --bg:           #f5f5fe;
    --bg-2:         #ffffff;
    --bg-3:         #eeeefd;
    --border:       #cecece;
    --border-light: #a0a0d0;

    --text:         #1e1e1e;
    --text-muted:   #3a3a3a;
    --text-dim:     #777777;

    /* Bleu Marianne : #003189 / action : #0067c9 */
    --accent:       #003189;
    --accent-dark:  #001f5e;
    --accent-glow:  rgba(0, 49, 137, 0.10);

    /* Scores — restent lisibles sur fond clair */
    --c-green:      #27a658;
    --c-green-bg:   rgba(39, 166, 88, 0.10);
    --c-orange:     #cf7600;
    --c-orange-bg:  rgba(207, 118, 0, 0.10);
    --c-red:        #ce0500;
    --c-red-bg:     rgba(206, 5, 0, 0.10);
    --c-grey:       #666666;
    --c-grey-bg:    rgba(102, 102, 102, 0.10);

    --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
    --shadow-md:  0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.14);

    /* Police Marianne — fallback Poppins */
    --font: 'Marianne', 'Poppins', sans-serif;
}

/* Navbar Bleu : fond bleu marine, sans barre tricolore */
[data-theme="dsfr"] .navbar {
    background: #003189;
    border-bottom: 3px solid #0050c8;
    box-shadow: none;
}
[data-theme="dsfr"] .navbar { position: relative; }
[data-theme="dsfr"] .navbar-isotopic {
    color: rgba(255,255,255,.9);
    border-right-color: rgba(255,255,255,.3);
}
[data-theme="dsfr"] .navbar-brand { color: #ffffff; }
[data-theme="dsfr"] .navbar-brand svg { color: #6af0ff; }
[data-theme="dsfr"] .navbar-user { color: rgba(255,255,255,.75); }
[data-theme="dsfr"] .navbar-user svg { stroke: rgba(255,255,255,.6); }

/* Boutons DSFR */
[data-theme="dsfr"] .btn-outline { border-color: #003189; color: #003189; background: transparent; }
[data-theme="dsfr"] .btn-outline:hover { background: #eeeefd; color: #003189; }
[data-theme="dsfr"] .btn-ghost { color: #3a3a3a; }
[data-theme="dsfr"] .btn-ghost:hover { background: #eeeefd; color: #003189; }
[data-theme="dsfr"] .navbar .btn-ghost { color: rgba(255,255,255,.8); }
[data-theme="dsfr"] .navbar .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Inputs DSFR */
[data-theme="dsfr"] .form-input {
    background: #ffffff;
    border: 2px solid #cecece;
    border-radius: 4px 4px 0 0;
    border-bottom-color: #3a3a3a;
}
[data-theme="dsfr"] .form-input:focus {
    border-color: #003189;
    box-shadow: 0 0 0 2px rgba(0,49,137,.2);
}

/* Cards DSFR */
[data-theme="dsfr"] .mesure-card,
[data-theme="dsfr"] .audit-card,
[data-theme="dsfr"] .ref-card,
[data-theme="dsfr"] .stat-item {
    border-radius: 4px;
    border-color: #cecece;
}
[data-theme="dsfr"] .mesure-card--scored {
    border-left-color: #003189;
}

/* Badges DSFR */
[data-theme="dsfr"] .mesure-id {
    background: rgba(0,49,137,.08);
    border-color: rgba(0,49,137,.25);
    color: #003189;
}
[data-theme="dsfr"] .ref-badge--iso  { background: #dce4f5; color: #003189; border-color: #a4b8e0; }
[data-theme="dsfr"] .ref-badge--nis2 { background: #ede8f7; color: #5b21b6; border-color: #c4b5f0; }

/* Sidebar DSFR */
[data-theme="dsfr"] .audit-sidebar { background: #ffffff; border-right-color: #cecece; }
[data-theme="dsfr"] .sidebar-link:hover { background: #f5f5fe; border-left-color: #003189; }
[data-theme="dsfr"] .sidebar-score { background: #eeeefd; border-color: #cecece; }

/* Score options DSFR */
[data-theme="dsfr"] .score-option__label {
    background: #f5f5fe; border-color: #cecece; color: #3a3a3a;
}
[data-theme="dsfr"] .score-option:hover .score-option__label { border-color: #003189; color: #003189; }

/* Bande RF en haut de la login page */
[data-theme="dsfr"] .login-bg {
    background: radial-gradient(ellipse at top, #eeeefd 0%, #f5f5fe 100%);
}
[data-theme="dsfr"] .login-grid {
    background-image:
        linear-gradient(rgba(0,49,137,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,49,137,.04) 1px, transparent 1px);
}
[data-theme="dsfr"] .login-card {
    background: #ffffff;
    border-color: #cecece;
    box-shadow: 0 4px 24px rgba(0,0,0,.1);
}
[data-theme="dsfr"] .login-card * { color: initial; }
[data-theme="dsfr"] .login-title { color: #1e1e1e; }
[data-theme="dsfr"] .login-subtitle { color: #3a3a3a; }
[data-theme="dsfr"] .login-isotopic { color: #003189; }
[data-theme="dsfr"] .brand-icon { background: rgba(0,49,137,.08); border-color: rgba(0,49,137,.2); color: #003189; }
[data-theme="dsfr"] .brand-name { color: #1e1e1e; }
[data-theme="dsfr"] .orb-1, [data-theme="dsfr"] .orb-2 { opacity: .15; }

/* Famille headers DSFR */
[data-theme="dsfr"] .famille-title { color: #3a3a3a; }
[data-theme="dsfr"] .famille-progress__fill { background: #003189; }

/* Rapport DSFR */
[data-theme="dsfr"] .score-big-ring .score-fill--good   { stroke: #27a658; }
[data-theme="dsfr"] .score-big-ring .score-fill--medium { stroke: #cf7600; }
[data-theme="dsfr"] .score-big-ring .score-fill--low    { stroke: #ce0500; }

/* PJ zone DSFR */
[data-theme="dsfr"] .pj-zone { border-color: #cecece; }
[data-theme="dsfr"] .pj-header { background: #f5f5fe; }
[data-theme="dsfr"] .pj-add-btn { background: rgba(0,49,137,.08); border-color: rgba(0,49,137,.2); color: #003189; }
[data-theme="dsfr"] .pj-add-btn:hover { background: #003189; color: #fff; }

/* Scrollbar DSFR */
[data-theme="dsfr"] ::-webkit-scrollbar-track { background: #f5f5fe; }
[data-theme="dsfr"] ::-webkit-scrollbar-thumb { background: #a0a0d0; }


/* ───────────────────────────────────────────────────────────────────────────
   THÈME 3 : HERB AGENCY
   Inspiré de https://dribbble.com/shots/26818381
   Vert organique, beige chaud, typographie éditoriale, ambiance naturelle
   ─────────────────────────────────────────────────────────────────────────── */
[data-theme="herb"] {
    /* Palette organique */
    --bg:           #f7f4ee;
    --bg-2:         #ffffff;
    --bg-3:         #f0ece3;
    --border:       #d6cfc0;
    --border-light: #b8ae9e;

    --text:         #1a1a0e;
    --text-muted:   #4a4a30;
    --text-dim:     #8a8a6a;

    /* Vert herbe signature */
    --accent:       #3d6b35;
    --accent-dark:  #2a4a24;
    --accent-glow:  rgba(61, 107, 53, 0.12);

    /* Scores naturels */
    --c-green:      #3d6b35;
    --c-green-bg:   rgba(61, 107, 53, 0.10);
    --c-orange:     #b85c00;
    --c-orange-bg:  rgba(184, 92, 0, 0.10);
    --c-red:        #9b2020;
    --c-red-bg:     rgba(155, 32, 32, 0.10);
    --c-grey:       #7a7a60;
    --c-grey-bg:    rgba(122, 122, 96, 0.10);

    --shadow-sm:  0 1px 4px rgba(26,26,14,.08);
    --shadow-md:  0 4px 20px rgba(26,26,14,.10);
    --shadow-lg:  0 8px 40px rgba(26,26,14,.14);
}

/* Navbar Herb : fond beige foncé, touche verte */
[data-theme="herb"] .navbar {
    background: #1a1a0e;
    border-bottom: 1px solid #2d2d18;
}
[data-theme="herb"] .navbar-isotopic {
    color: #8cc87a;
    border-right-color: rgba(140,200,122,.25);
    letter-spacing: .2em;
}
[data-theme="herb"] .navbar-brand { color: #f7f4ee; }
[data-theme="herb"] .navbar-brand svg { color: #8cc87a; }
[data-theme="herb"] .navbar-user { color: rgba(247,244,238,.6); }
[data-theme="herb"] .navbar .btn-ghost { color: rgba(247,244,238,.7); }
[data-theme="herb"] .navbar .btn-ghost:hover { background: rgba(255,255,255,.08); color: #f7f4ee; }

/* Boutons Herb */
[data-theme="herb"] .btn-outline { border-color: #b8ae9e; color: #1a1a0e; background: transparent; }
[data-theme="herb"] .btn-outline:hover { border-color: #3d6b35; color: #3d6b35; background: rgba(61,107,53,.06); }
[data-theme="herb"] .btn-ghost { color: #4a4a30; }
[data-theme="herb"] .btn-ghost:hover { background: #f0ece3; color: #1a1a0e; }

/* Inputs Herb */
[data-theme="herb"] .form-input {
    background: #ffffff;
    border: 1.5px solid #d6cfc0;
    border-radius: 8px;
}
[data-theme="herb"] .form-input:focus {
    border-color: #3d6b35;
    box-shadow: 0 0 0 3px rgba(61,107,53,.12);
}

/* Cards Herb — coins plus arrondis, texture douce */
[data-theme="herb"] .mesure-card,
[data-theme="herb"] .audit-card,
[data-theme="herb"] .ref-card {
    border-radius: 12px;
    border-color: #d6cfc0;
}
[data-theme="herb"] .mesure-card:hover,
[data-theme="herb"] .audit-card:hover,
[data-theme="herb"] .ref-card:hover {
    border-color: #b8ae9e;
    box-shadow: 0 4px 12px rgba(26,26,14,.08);
}
[data-theme="herb"] .mesure-card--scored { border-left-color: #3d6b35; }

/* Badges Herb */
[data-theme="herb"] .mesure-id {
    background: rgba(61,107,53,.1);
    border-color: rgba(61,107,53,.25);
    color: #3d6b35;
}
[data-theme="herb"] .ref-badge--iso  { background: rgba(61,107,53,.12); color: #2a4a24; border-color: rgba(61,107,53,.25); }
[data-theme="herb"] .ref-badge--nis2 { background: rgba(184,92,0,.10);  color: #804000; border-color: rgba(184,92,0,.25); }
[data-theme="herb"] .audit-badge--iso  { background: rgba(61,107,53,.12);  color: #2a4a24; }
[data-theme="herb"] .audit-badge--nis2 { background: rgba(184,92,0,.10);   color: #804000; }

/* Question / hint Herb */
[data-theme="herb"] .mesure-question {
    background: rgba(61,107,53,.06);
    border-color: rgba(61,107,53,.2);
}
[data-theme="herb"] .mesure-question svg { color: #3d6b35; }

/* Sidebar Herb */
[data-theme="herb"] .audit-sidebar { background: #faf8f2; border-right-color: #d6cfc0; }
[data-theme="herb"] .sidebar-link:hover { background: #f0ece3; border-left-color: #3d6b35; }
[data-theme="herb"] .sidebar-score { background: #f0ece3; border-color: #d6cfc0; }
[data-theme="herb"] .sidebar-header { border-bottom-color: #d6cfc0; }
[data-theme="herb"] .sidebar-footer { border-top-color: #d6cfc0; }

/* Score options Herb */
[data-theme="herb"] .score-option__label {
    background: #faf8f2; border-color: #d6cfc0; color: #4a4a30;
    border-radius: 20px;
}
[data-theme="herb"] .score-option:hover .score-option__label { border-color: #3d6b35; color: #3d6b35; }
[data-theme="herb"] .score-option--green  input:checked ~ .score-option__label { background: rgba(61,107,53,.12); border-color: #3d6b35; color: #3d6b35; }
[data-theme="herb"] .score-option--orange input:checked ~ .score-option__label { background: rgba(184,92,0,.10);  border-color: #b85c00; color: #b85c00; }
[data-theme="herb"] .score-option--red    input:checked ~ .score-option__label { background: rgba(155,32,32,.10); border-color: #9b2020; color: #9b2020; }
[data-theme="herb"] .score-option--grey   input:checked ~ .score-option__label { background: rgba(122,122,96,.10); border-color: #7a7a60; color: #7a7a60; }

/* Famille header Herb */
[data-theme="herb"] .famille-title { color: #4a4a30; }
[data-theme="herb"] .famille-progress__fill { background: #3d6b35; }
[data-theme="herb"] .famille-header { border-bottom: 1px solid #d6cfc0; padding-bottom: var(--sp-3); }

/* Progress bar Herb */
[data-theme="herb"] .famille-progress__bar { background: #d6cfc0; }

/* Login page Herb */
[data-theme="herb"] .login-bg {
    background: radial-gradient(ellipse at 30% 10%, #e8f0e4 0%, #f7f4ee 70%);
}
[data-theme="herb"] .login-grid {
    background-image:
        linear-gradient(rgba(61,107,53,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(61,107,53,.05) 1px, transparent 1px);
}
[data-theme="herb"] .orb-1 {
    background: radial-gradient(circle, rgba(61,107,53,.15) 0%, transparent 70%);
}
[data-theme="herb"] .orb-2 {
    background: radial-gradient(circle, rgba(184,92,0,.08) 0%, transparent 70%);
}
[data-theme="herb"] .login-card {
    background: rgba(255,255,255,.95);
    border-color: #d6cfc0;
    box-shadow: 0 8px 40px rgba(26,26,14,.12);
}
[data-theme="herb"] .login-isotopic { color: #3d6b35; }
[data-theme="herb"] .login-brand-sep { background: #d6cfc0; }
[data-theme="herb"] .brand-icon { background: rgba(61,107,53,.1); border-color: rgba(61,107,53,.25); color: #3d6b35; }
[data-theme="herb"] .brand-name { color: #1a1a0e; }
[data-theme="herb"] .login-title { color: #1a1a0e; }
[data-theme="herb"] .login-subtitle { color: #4a4a30; }
[data-theme="herb"] .toggle-pwd { color: #7a7a60; }
[data-theme="herb"] .toggle-pwd:hover { color: #3d6b35; }

/* Rapport Herb */
[data-theme="herb"] .score-overview { border-radius: 16px; }
[data-theme="herb"] .score-big-ring .score-bg { stroke: #f0ece3; }
[data-theme="herb"] .famille-synthese__fill--good   { background: #3d6b35; }
[data-theme="herb"] .famille-synthese__fill--medium { background: #b85c00; }
[data-theme="herb"] .famille-synthese__fill--low    { background: #9b2020; }

/* Audit topbar Herb */
[data-theme="herb"] .audit-topbar { background: #faf8f2; border-bottom-color: #d6cfc0; }
[data-theme="herb"] .audit-content { background: #f7f4ee; }

/* PJ Herb */
[data-theme="herb"] .pj-zone { border-color: #d6cfc0; border-radius: 8px; }
[data-theme="herb"] .pj-header { background: #f0ece3; border-bottom-color: #d6cfc0; }
[data-theme="herb"] .pj-add-btn { background: rgba(61,107,53,.1); border-color: rgba(61,107,53,.2); color: #3d6b35; }
[data-theme="herb"] .pj-add-btn:hover { background: #3d6b35; color: #fff; }
[data-theme="herb"] .pj-item { border-bottom-color: #d6cfc0; }
[data-theme="herb"] .pj-item:hover { background: rgba(61,107,53,.04); }

/* Commentaire Herb */
[data-theme="herb"] .comment-input {
    background: #faf8f2;
    border-color: #d6cfc0;
    border-radius: 8px;
}
[data-theme="herb"] .comment-input:focus { border-color: #3d6b35; }

/* Modal Herb */
[data-theme="herb"] .modal { border-color: #d6cfc0; border-radius: 16px; }
[data-theme="herb"] .modal-header { border-bottom-color: #d6cfc0; }
[data-theme="herb"] .modal-footer { border-top-color: #d6cfc0; }
[data-theme="herb"] .selected-ref { background: #f0ece3; border-color: #d6cfc0; }

/* Scrollbar Herb */
[data-theme="herb"] ::-webkit-scrollbar-track { background: #f0ece3; }
[data-theme="herb"] ::-webkit-scrollbar-thumb { background: #b8ae9e; }

/* Section title Herb */
[data-theme="herb"] .section-title { border-bottom-color: #d6cfc0; }

/* Score ring Herb */
[data-theme="herb"] .score-bg { stroke: #f0ece3; }
[data-theme="herb"] .score-ring--good .score-fill   { stroke: #3d6b35; }
[data-theme="herb"] .score-ring--medium .score-fill { stroke: #b85c00; }
[data-theme="herb"] .score-ring--low .score-fill    { stroke: #9b2020; }

/* ───────────────────────────────────────────────────────────────────────────
   SÉLECTEUR DE THÈME — widget dans la navbar
   ─────────────────────────────────────────────────────────────────────────── */
.theme-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}
.theme-btn {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .2s, border-color .2s;
    padding: 0;
    position: relative;
}
.theme-btn:hover { transform: scale(1.2); }
.theme-btn.active { border-color: var(--text); transform: scale(1.15); }

.theme-btn--dark   { background: #0d1117; box-shadow: 0 0 0 1px #3a4a60; }
.theme-btn--dsfr   { background: linear-gradient(135deg, #003189 50%, #f7f5f4 50%); }
.theme-btn--herb   { background: linear-gradient(135deg, #3d6b35 50%, #f7f4ee 50%); }

/* Tooltip sur les boutons thème */
.theme-btn::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.85);
    color: #fff;
    font-size: .68rem;
    font-family: var(--font);
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: opacity .15s;
}
.theme-btn:hover::after { opacity: 1; }

/* ─── Adaptations select thème selon thème ────────────────────────────────── */
[data-theme="dsfr"] .theme-select-wrap { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); }
[data-theme="dsfr"] .theme-select      { color: rgba(255,255,255,.85); }
[data-theme="dsfr"] .theme-select-icon { color: rgba(255,255,255,.6); }

[data-theme="herb"] .theme-select-wrap { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
[data-theme="herb"] .theme-select      { color: rgba(247,244,238,.8); }
[data-theme="herb"] .theme-select-icon { color: rgba(247,244,238,.5); }

/* Adapations MFA pour thème DSFR */
[data-theme="dsfr"] .mfa-card         { border-color: #cecece; }
[data-theme="dsfr"] .mfa-status--on   { background: rgba(39,166,88,.08); border-color: rgba(39,166,88,.2); }
[data-theme="dsfr"] .mfa-status--off  { background: rgba(102,102,102,.08); }
[data-theme="dsfr"] .mfa-benefits svg { color: #003189 !important; }
[data-theme="dsfr"] .mfa-benefits svg path { stroke: #003189; }
[data-theme="dsfr"] .alert-success { background: rgba(39,166,88,.08); border-color: rgba(39,166,88,.3); color: #166534; }

/* Adapations MFA pour thème Herb */
[data-theme="herb"] .mfa-card          { border-color: #d6cfc0; border-radius: 12px; }
[data-theme="herb"] .mfa-status--on    { background: rgba(61,107,53,.1); border-color: rgba(61,107,53,.2); }
[data-theme="herb"] .mfa-status--off   { background: rgba(122,122,96,.08); }
[data-theme="herb"] .mfa-secret-display{ background: #f0ece3; border-color: #d6cfc0; }
[data-theme="herb"] .mfa-secret-display code { color: #3d6b35; }
[data-theme="herb"] .alert-success     { background: rgba(61,107,53,.1); border-color: rgba(61,107,53,.25); color: #2a4a24; }
