/* ════════════════════════════════════════════════════════════════
   FICHE-CONTENT.CSS — Charte navy/gold/Garamond pour les fiches BDD
   Réécrit depuis le brief de redesign-fiches-css.css
   Variables compatibles avec blue-theme.css (var(--ink), var(--gold), …)
   ════════════════════════════════════════════════════════════════ */

/* ───── A. VARIABLES THÉMATIQUES (palette navy/gold) ───── */
.fiche-content-wrapper {
    --couleur-principale: #0d1f3c;
    --couleur-principale-foncee: #061025;
    --couleur-secondaire: #4a6a90;
    --couleur-accent: #b8892a;
    --couleur-accent-clair: #d4a843;

    --couleur-fond: #f8faff;
    --couleur-texte: #2c3e50;
    --couleur-texte-clair: #6a7a8a;
    --couleur-bordure: #e1e6ee;

    --border-radius: 4px;
    --ombre-legere: 0 1px 3px rgba(13, 31, 60, 0.04);
    --ombre-moyenne: 0 4px 12px rgba(13, 31, 60, 0.06);
    --ombre-forte: 0 8px 24px rgba(13, 31, 60, 0.08);
}

/* Mode sombre : variables adaptées si le wrapper est en data-theme=dark */
[data-theme="dark"] .fiche-content-wrapper {
    --couleur-fond: transparent;
    --couleur-texte: #e8f0fa;
    --couleur-texte-clair: rgba(232, 240, 250, 0.7);
    --couleur-bordure: rgba(91, 163, 217, 0.18);
    --couleur-secondaire: rgba(232, 240, 250, 0.6);
}

/* ───── B. BASE ───── */
.fiche-content-wrapper {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7;
    color: var(--couleur-texte);
    font-size: 16px;
}

.fiche-content-wrapper .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ───── C. HEADER (bannière en haut de fiche) ───── */
/* Mode clair : fond ivoire sobre, accent gold ; Mode sombre : navy profond */
.fiche-content-wrapper .header {
    background: #ffffff;
    color: var(--couleur-principale);
    padding: 40px;
    text-align: center;
    border: 1px solid var(--couleur-bordure);
    border-radius: var(--border-radius);
    word-wrap: break-word;
    overflow: visible;
    position: relative;
    margin-bottom: 30px;
    box-shadow: var(--ombre-legere);
}
.fiche-content-wrapper .header::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--couleur-accent);
}
.fiche-content-wrapper .header h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 2.4rem;
    margin-bottom: 12px;
    line-height: 1.25;
    color: var(--couleur-principale);
}
.fiche-content-wrapper .header .subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.15rem;
    color: var(--couleur-accent);
    margin-bottom: 18px;
}
.fiche-content-wrapper .header .reference {
    background: rgba(184, 137, 42, 0.08);
    border: 1px solid var(--couleur-accent);
    color: var(--couleur-principale);
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 0.82rem;
    display: inline-block;
    letter-spacing: 0.04em;
}
.fiche-content-wrapper .header .reference .terme-technique {
    color: var(--couleur-principale);
    border-bottom-color: var(--couleur-accent);
}
/* Mode sombre : header en navy profond avec texte ivoire */
[data-theme="dark"] .fiche-content-wrapper .header {
    background: rgba(13, 50, 96, 0.6);
    border-color: rgba(91, 163, 217, 0.25);
    color: #e8f0fa;
}
[data-theme="dark"] .fiche-content-wrapper .header h1 {
    color: #e8f0fa;
}
[data-theme="dark"] .fiche-content-wrapper .header .subtitle {
    color: var(--couleur-accent-clair);
}
[data-theme="dark"] .fiche-content-wrapper .header .reference {
    background: rgba(184, 137, 42, 0.15);
    color: #e8f0fa;
}
[data-theme="dark"] .fiche-content-wrapper .header .reference .terme-technique {
    color: #e8f0fa;
}

/* ───── D. AIDE À LA LECTURE ───── */
.fiche-content-wrapper .aide-lecture {
    background: #ffffff;
    border-left: 2px solid var(--couleur-accent);
    border-radius: 0;
    padding: 20px 24px;
    margin: 24px 30px;
    text-align: left;
    box-shadow: var(--ombre-legere);
}
.fiche-content-wrapper .aide-lecture h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    color: var(--couleur-principale);
    margin-bottom: 8px;
    font-size: 1.1rem;
}
.fiche-content-wrapper .aide-lecture p {
    color: var(--couleur-secondaire);
    font-size: 0.92rem;
    line-height: 1.65;
}
[data-theme="dark"] .fiche-content-wrapper .aide-lecture {
    background: rgba(13, 50, 96, 0.4);
}

/* ───── E. TITRES ───── */
.fiche-content-wrapper .titre-niveau-1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    color: var(--couleur-principale);
    margin-bottom: 28px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 12px;
}
.fiche-content-wrapper .titre-niveau-2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--couleur-principale);
    margin: 28px 0 16px 0;
    line-height: 1.3;
}
.fiche-content-wrapper .titre-niveau-3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--couleur-principale);
    margin: 22px 0 14px 0;
    line-height: 1.35;
}
.fiche-content-wrapper .titre-icone {
    color: var(--couleur-accent);
    font-size: 1.2em;
}
[data-theme="dark"] .fiche-content-wrapper .titre-niveau-1,
[data-theme="dark"] .fiche-content-wrapper .titre-niveau-2,
[data-theme="dark"] .fiche-content-wrapper .titre-niveau-3 {
    color: var(--couleur-accent-clair);
}

/* ───── F. INFOBULLES ───── */
.fiche-content-wrapper .terme-technique {
    position: relative;
    border-bottom: 1px dotted var(--couleur-accent);
    cursor: help;
    color: var(--couleur-principale);
    font-weight: 500;
    transition: all 0.3s ease;
}
.fiche-content-wrapper .terme-technique:hover {
    background-color: rgba(184, 137, 42, 0.08);
    border-bottom-style: solid;
}
[data-theme="dark"] .fiche-content-wrapper .terme-technique {
    color: var(--couleur-accent-clair);
}

/* L'infobulle est positionnée en JS (position fixed sur le viewport) */
.fiche-content-wrapper .infobulle,
.infobulle {
    background: var(--couleur-principale);
    color: white;
    padding: 12px 16px;
    border-radius: 2px;
    border-left: 2px solid var(--couleur-accent);
    box-shadow: var(--ombre-moyenne);
    font-size: 0.85rem;
    line-height: 1.4;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    width: 280px;
    max-width: calc(100vw - 20px);
}

/* ───── G. FIL D'ARIANE INTERNE (navigation entre sections) ───── */
.fiche-content-wrapper .fil-ariane-unifie {
    background: var(--couleur-fond);
    border-bottom: 1px solid var(--couleur-bordure);
    box-shadow: var(--ombre-legere);
}
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-unifie {
    background: rgba(10, 40, 80, 0.95);
    backdrop-filter: blur(8px);
}
.fiche-content-wrapper .fil-ariane-titre {
    color: var(--couleur-principale);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
}
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-titre {
    color: var(--couleur-accent-clair);
}
.fiche-content-wrapper .fil-ariane-navigation {
    padding: 8px 0;
}
.fiche-content-wrapper .fil-ariane-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 15px 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--couleur-accent) transparent;
}
.fiche-content-wrapper .fil-ariane-container::-webkit-scrollbar {
    height: 4px;
}
.fiche-content-wrapper .fil-ariane-container::-webkit-scrollbar-thumb {
    background: var(--couleur-accent);
    border-radius: 2px;
}
.fiche-content-wrapper .fil-ariane-btn {
    background: #ffffff;
    border: 1px solid var(--couleur-bordure);
    color: var(--couleur-secondaire);
    padding: 6px 16px;
    border-radius: 2px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.fiche-content-wrapper .fil-ariane-btn:hover {
    background: rgba(184, 137, 42, 0.08);
    border-color: var(--couleur-accent);
    color: var(--couleur-principale);
}
.fiche-content-wrapper .fil-ariane-btn.active {
    background: var(--couleur-principale) !important;
    border-color: var(--couleur-principale) !important;
    color: white !important;
    box-shadow: var(--ombre-moyenne);
}
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-btn {
    background: rgba(13, 50, 96, 0.6);
    color: rgba(232, 240, 250, 0.7);
    border-color: rgba(91, 163, 217, 0.18);
}
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-btn.active {
    background: var(--couleur-accent) !important;
    border-color: var(--couleur-accent) !important;
    color: var(--couleur-principale) !important;
}

/* ───── H. NUMÉROS, LISTES ───── */
.fiche-content-wrapper .numero-element {
    background: transparent;
    color: var(--couleur-accent);
    padding: 4px 0;
    border-radius: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-size: 0.9rem;
    margin-right: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--couleur-accent);
    display: inline-block;
}
.fiche-content-wrapper .numero-liste {
    background: transparent;
    color: var(--couleur-accent);
    border: 1px solid var(--couleur-accent);
    padding: 4px 10px;
    border-radius: 50%;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-size: 0.85rem;
    min-width: 32px;
    text-align: center;
    display: inline-block;
}
.fiche-content-wrapper .puce-icone {
    color: var(--couleur-accent);
    font-weight: bold;
    margin-right: 8px;
}
.fiche-content-wrapper .liste-numerotee,
.fiche-content-wrapper .liste-puces {
    list-style: none;
    padding-left: 0;
    margin: 14px 0;
}
.fiche-content-wrapper .liste-numerotee li,
.fiche-content-wrapper .liste-puces li {
    padding: 8px 0;
    line-height: 1.7;
    display: flex;
    gap: 12px;
}

/* ───── I. ENCADRÉS ───── */
.fiche-content-wrapper .encadre,
.fiche-content-wrapper .encadre-info {
    background: #ffffff;
    border: 1px solid var(--couleur-bordure);
    border-left: 2px solid var(--couleur-principale);
    border-radius: 0;
    box-shadow: var(--ombre-legere);
    text-align: left;
    padding: 24px 28px;
    margin: 22px 0;
}
.fiche-content-wrapper .encadre-conseil {
    background: #ffffff;
    border: 1px solid var(--couleur-bordure);
    border-left: 2px solid var(--couleur-accent);
    border-radius: 0;
    box-shadow: var(--ombre-legere);
    padding: 24px 28px;
    margin: 22px 0;
}
.fiche-content-wrapper .encadre-vigilance,
.fiche-content-wrapper .encadre-important {
    background: #fdf8f8;
    border: 1px solid #e8c5c5;
    border-left: 2px solid #c0625f;
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(192, 98, 95, 0.06);
    padding: 24px 28px;
    margin: 22px 0;
}
.fiche-content-wrapper .encadre-contexte {
    background: #f8faff;
    border: 1px solid var(--couleur-bordure);
    border-left: 2px solid var(--couleur-secondaire);
    border-radius: 0;
    padding: 24px 28px;
    margin: 22px 0;
}
[data-theme="dark"] .fiche-content-wrapper .encadre,
[data-theme="dark"] .fiche-content-wrapper .encadre-info,
[data-theme="dark"] .fiche-content-wrapper .encadre-conseil {
    background: rgba(13, 50, 96, 0.4);
    border-color: rgba(91, 163, 217, 0.18);
}
[data-theme="dark"] .fiche-content-wrapper .encadre-vigilance,
[data-theme="dark"] .fiche-content-wrapper .encadre-important {
    background: rgba(80, 30, 30, 0.3);
    border-color: rgba(192, 98, 95, 0.4);
}

/* ───── J. ENCADRÉ FORMULE ───── */
.fiche-content-wrapper .encadre-formule {
    background: #ffffff;
    color: var(--couleur-principale);
    text-align: center;
    padding: 30px;
    border-radius: 0;
    border: 1px solid var(--couleur-bordure);
    border-top: 2px solid var(--couleur-accent);
    margin: 30px 0;
    box-shadow: var(--ombre-moyenne);
}
.fiche-content-wrapper .formule-principale {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-size: 1.25rem;
    margin: 18px 0;
    padding: 22px;
    background: #f8faff;
    border-radius: 0;
    border-left: 2px solid var(--couleur-accent);
    text-align: left;
}
.fiche-content-wrapper .formule-elements {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.fiche-content-wrapper .element-formule {
    background: #ffffff;
    padding: 16px 22px;
    border-radius: 2px;
    border: 1px solid var(--couleur-accent);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    color: var(--couleur-principale);
    text-align: center;
    flex: 1;
    min-width: 150px;
}
.fiche-content-wrapper .operateur {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    color: var(--couleur-accent);
    font-weight: 400;
}
[data-theme="dark"] .fiche-content-wrapper .encadre-formule,
[data-theme="dark"] .fiche-content-wrapper .formule-principale,
[data-theme="dark"] .fiche-content-wrapper .element-formule {
    background: rgba(13, 50, 96, 0.6);
}

/* ───── K. CONSEIL EXPERT ───── */
.fiche-content-wrapper .encadre-conseil-expert {
    background: #ffffff;
    border: 1px solid var(--couleur-bordure);
    border-left: 2px solid var(--couleur-accent);
    border-radius: 0;
    padding: 28px 32px;
    margin: 28px 0;
    box-shadow: var(--ombre-legere);
    text-align: left;
}
.fiche-content-wrapper .conseil-icone {
    font-size: 1.5rem;
    margin: 0 0 12px 0;
    color: var(--couleur-accent);
}
[data-theme="dark"] .fiche-content-wrapper .encadre-conseil-expert {
    background: rgba(13, 50, 96, 0.4);
}

/* ───── L. TABLEAUX ───── */
.fiche-content-wrapper .tableau-moderne {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 14px;
    border-radius: 0;
    overflow: hidden;
    box-shadow: var(--ombre-legere);
    border: 1px solid var(--couleur-bordure);
}
.fiche-content-wrapper .tableau-moderne th {
    /* Style de base (mode sombre) — restauré comme avant. Mode clair surchargé plus bas. */
    background: var(--couleur-principale);
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
[data-theme="light"] .fiche-content-wrapper .tableau-moderne th {
    /* Mode clair uniquement : blanc + texte cuivre, séparé du tbody par un trait cuivre */
    background: #ffffff;
    color: #b8892a;
    border-bottom: 2px solid #b8892a;
    padding: 14px 14px;
    font-size: 11px;
    letter-spacing: 0.14em;
}
.fiche-content-wrapper .tableau-moderne td {
    padding: 12px;
    border-bottom: 1px solid var(--couleur-bordure);
    vertical-align: top;
    text-align: left;
    font-weight: 400;
    background: #ffffff;
}
.fiche-content-wrapper .tableau-moderne tr:nth-child(even) td {
    background: #f8faff;
}
.fiche-content-wrapper .tableau-moderne tr:hover td {
    background: #fffaef;
}
[data-theme="dark"] .fiche-content-wrapper .tableau-moderne td {
    background: rgba(13, 50, 96, 0.4);
    color: rgba(232, 240, 250, 0.9);
}
[data-theme="dark"] .fiche-content-wrapper .tableau-moderne tr:nth-child(even) td {
    background: rgba(13, 50, 96, 0.7);
}

/* ───── M. CITATION ───── */
.fiche-content-wrapper .citation {
    background: var(--couleur-principale);
    color: #ffffff;
    padding: 24px 32px;
    border-radius: 0;
    border-left: 3px solid var(--couleur-accent);
    margin: 28px 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.55;
    box-shadow: var(--ombre-moyenne);
}

/* ───── N. MISE EN VALEUR ───── */
/* Highlight inline simple : pas de fond, pas de padding, juste gras + couleur accent */
.fiche-content-wrapper .mise-en-valeur {
    background: none;
    padding: 0;
    border: none;
    font-weight: 600;
    color: var(--couleur-accent);
}
[data-theme="dark"] .fiche-content-wrapper .mise-en-valeur {
    color: var(--couleur-accent-clair);
}

/* ───── O. BADGES ───── */
.fiche-content-wrapper .tranche-badge,
.fiche-content-wrapper .taux-badge,
.fiche-content-wrapper .date-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 2px;
    font-size: 0.78rem;
    font-weight: 500;
    margin: 2px;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.02em;
}
.fiche-content-wrapper .tranche-1 {
    background: #f0f7f0;
    color: #2d5f3f;
    border: 1px solid #c8e0cf;
}
.fiche-content-wrapper .tranche-2 {
    background: #fdf8f3;
    color: #8b6f3a;
    border: 1px solid #e8d4b8;
}
.fiche-content-wrapper .taux-badge {
    background: #f8faff;
    color: var(--couleur-principale);
    border: 1px solid var(--couleur-bordure);
}
.fiche-content-wrapper .date-badge {
    background: rgba(184, 137, 42, 0.08);
    color: var(--couleur-accent);
    border: 1px solid var(--couleur-accent);
}

/* ───── P. TIMELINE ───── */
.fiche-content-wrapper .evolution-timeline {
    background: var(--couleur-principale);
    height: 4px;
    border-radius: 0;
    margin: 32px 0 24px 0;
    position: relative;
}
.fiche-content-wrapper .timeline-marker {
    position: absolute;
    top: -14px;
    width: 32px;
    height: 32px;
    background: #ffffff;
    border: 2px solid var(--couleur-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--couleur-principale);
    transform: translateX(-50%);
}
[data-theme="dark"] .fiche-content-wrapper .timeline-marker {
    background: var(--couleur-principale-foncee);
    color: var(--couleur-accent-clair);
}

/* ───── Q. CALCUL EXEMPLE ───── */
.fiche-content-wrapper .calcul-exemple {
    background: #ffffff;
    border: 1px solid var(--couleur-bordure);
    border-left: 2px solid var(--couleur-accent);
    border-radius: 0;
    padding: 28px;
    margin: 28px 0;
}
.fiche-content-wrapper .etape-calcul {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
    padding: 16px 20px;
    background: #f8faff;
    border-radius: 0;
    border-left: 1px solid var(--couleur-accent);
}
.fiche-content-wrapper .etape-numero {
    background: transparent;
    color: var(--couleur-accent);
    border: 1px solid var(--couleur-accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-size: 0.9rem;
    flex-shrink: 0;
}
[data-theme="dark"] .fiche-content-wrapper .calcul-exemple,
[data-theme="dark"] .fiche-content-wrapper .etape-calcul {
    background: rgba(13, 50, 96, 0.4);
}

/* ───── R. PROGRESS BAR (lecture) ───── */
.fiche-content-wrapper .progress-indicator {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(232, 240, 250, 0.1);
    z-index: 1002;
}
.fiche-content-wrapper .progress-bar {
    height: 100%;
    background: var(--couleur-accent);
    width: 0%;
    transition: width 0.3s ease;
}

/* ───── S. SECTIONS ───── */
.fiche-content-wrapper .section {
    background: #ffffff;
    border-radius: 0;
    padding: 36px;
    margin-bottom: 32px;
    box-shadow: var(--ombre-legere);
    border: 1px solid var(--couleur-bordure);
}
/* Sections parents : pas de border-left coloré (réservé aux enfants) */
.fiche-content-wrapper .section-principale,
.fiche-content-wrapper .section-chapitre {
    border-left: 1px solid var(--couleur-bordure);
}
[data-theme="dark"] .fiche-content-wrapper .section {
    background: rgba(13, 50, 96, 0.3);
    border-color: rgba(91, 163, 217, 0.18);
}

/* ───── T. PARAGRAPHES ───── */
.fiche-content-wrapper .paragraphe {
    margin-bottom: 16px;
    line-height: 1.75;
    color: var(--couleur-texte);
}
.fiche-content-wrapper .paragraphe strong {
    color: var(--couleur-principale);
    font-weight: 600;
}
[data-theme="dark"] .fiche-content-wrapper .paragraphe strong {
    color: var(--couleur-accent-clair);
}

/* ───── PICTOGRAMME LARGE (cas particuliers) ───── */
.fiche-content-wrapper .pictogramme-large {
    font-size: 3rem;
    margin: 20px 0;
    color: var(--couleur-accent);
}

/* ───── RESPONSIVE ───── */
@media (max-width: 768px) {
    .fiche-content-wrapper .container { padding: 10px; }
    .fiche-content-wrapper .header { padding: 28px 20px; }
    .fiche-content-wrapper .header h1 { font-size: 1.6rem; }
    .fiche-content-wrapper .titre-niveau-1 { font-size: 1.5rem; }
    .fiche-content-wrapper .titre-niveau-2 { font-size: 1.25rem; }
    .fiche-content-wrapper .section { padding: 22px 18px; }
    .fiche-content-wrapper .aide-lecture { margin: 16px 4px; padding: 16px 18px; }
    .fiche-content-wrapper .formule-elements { flex-direction: column; }
    .fiche-content-wrapper .element-formule { width: 100%; }
    .fiche-content-wrapper .tableau-moderne { font-size: 12px; }
    .fiche-content-wrapper .tableau-moderne th,
    .fiche-content-wrapper .tableau-moderne td { padding: 8px 6px; }
}

/* ════════════════════════════════════════════════════════════════
   MODE SOMBRE — UNIFIÉ : surcharge tous les fonds clairs
   et garantit la lisibilité de tous les textes
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .fiche-content-wrapper {
    color: #e8f0fa;
}

/* Tous les fonds clairs deviennent sombres */
[data-theme="dark"] .fiche-content-wrapper .aide-lecture,
[data-theme="dark"] .fiche-content-wrapper .encadre-info,
[data-theme="dark"] .fiche-content-wrapper .encadre-conseil,
[data-theme="dark"] .fiche-content-wrapper .encadre-contexte,
[data-theme="dark"] .fiche-content-wrapper .encadre-conseil-expert,
[data-theme="dark"] .fiche-content-wrapper .encadre-formule,
[data-theme="dark"] .fiche-content-wrapper .calcul-exemple,
[data-theme="dark"] .fiche-content-wrapper .element-formule,
[data-theme="dark"] .fiche-content-wrapper .formule-principale,
[data-theme="dark"] .fiche-content-wrapper .etape-calcul,
[data-theme="dark"] .fiche-content-wrapper .section {
    background: rgba(13, 50, 96, 0.5) !important;
    border-color: rgba(91, 163, 217, 0.18);
    color: #e8f0fa;
}

/* Encadrés vigilance / important en mode sombre : bleu foncé charte
   (le rouge sombre était illisible et ne respectait pas la charte) */
[data-theme="dark"] .fiche-content-wrapper .encadre-vigilance,
[data-theme="dark"] .fiche-content-wrapper .encadre-important {
    background: rgba(13, 50, 96, 0.6) !important;
    border-color: rgba(184, 137, 42, 0.5) !important;
    color: #e8f0fa !important;
}

/* Tableau : lignes paires/hover */
[data-theme="dark"] .fiche-content-wrapper .tableau-moderne td {
    background: rgba(13, 50, 96, 0.4) !important;
    color: #e8f0fa;
    border-color: rgba(91, 163, 217, 0.18);
}
[data-theme="dark"] .fiche-content-wrapper .tableau-moderne tr:nth-child(even) td {
    background: rgba(13, 50, 96, 0.65) !important;
}
[data-theme="dark"] .fiche-content-wrapper .tableau-moderne tr:hover td {
    background: rgba(184, 137, 42, 0.15) !important;
}

/* Contenu textuel : forcer la lisibilité */
[data-theme="dark"] .fiche-content-wrapper p,
[data-theme="dark"] .fiche-content-wrapper li,
[data-theme="dark"] .fiche-content-wrapper td,
[data-theme="dark"] .fiche-content-wrapper .paragraphe,
[data-theme="dark"] .fiche-content-wrapper .aide-lecture p,
[data-theme="dark"] .fiche-content-wrapper .encadre p,
[data-theme="dark"] .fiche-content-wrapper .encadre-conseil p,
[data-theme="dark"] .fiche-content-wrapper .encadre-contexte p {
    color: #e8f0fa;
}
[data-theme="dark"] .fiche-content-wrapper strong,
[data-theme="dark"] .fiche-content-wrapper .paragraphe strong,
[data-theme="dark"] .fiche-content-wrapper .titre-niveau-1,
[data-theme="dark"] .fiche-content-wrapper .titre-niveau-2,
[data-theme="dark"] .fiche-content-wrapper .titre-niveau-3 {
    color: var(--couleur-accent-clair);
}

/* Citation reste navy mais avec texte ivoire en dark — déjà bon par défaut */
[data-theme="dark"] .fiche-content-wrapper .citation {
    background: rgba(13, 31, 60, 0.95);
    color: #ffffff;
}

/* Mise en valeur : juste un texte gold gras, pas de fond */
[data-theme="dark"] .fiche-content-wrapper .mise-en-valeur {
    background: none;
    color: var(--couleur-accent-clair);
}

/* Termes techniques (texte avec underline pointillé doré) */
[data-theme="dark"] .fiche-content-wrapper .terme-technique {
    color: var(--couleur-accent-clair) !important;
    border-bottom-color: var(--couleur-accent);
}
[data-theme="dark"] .fiche-content-wrapper .terme-technique:hover {
    background-color: rgba(184, 137, 42, 0.18);
}

/* Liste à puces */
[data-theme="dark"] .fiche-content-wrapper .liste-puces li,
[data-theme="dark"] .fiche-content-wrapper .liste-numerotee li {
    color: #e8f0fa;
}
[data-theme="dark"] .fiche-content-wrapper .puce-icone {
    color: var(--couleur-accent-clair);
}

/* Numéros de listes */
[data-theme="dark"] .fiche-content-wrapper .numero-liste,
[data-theme="dark"] .fiche-content-wrapper .etape-numero,
[data-theme="dark"] .fiche-content-wrapper .numero-element {
    color: var(--couleur-accent-clair);
    border-color: var(--couleur-accent-clair);
}

/* Badges */
[data-theme="dark"] .fiche-content-wrapper .taux-badge {
    background: rgba(13, 50, 96, 0.6);
    color: #e8f0fa;
    border-color: rgba(91, 163, 217, 0.25);
}
[data-theme="dark"] .fiche-content-wrapper .date-badge {
    background: rgba(184, 137, 42, 0.15);
    color: var(--couleur-accent-clair);
}
[data-theme="dark"] .fiche-content-wrapper .tranche-1 {
    background: rgba(45, 95, 63, 0.3);
    color: #c8e0cf;
    border-color: rgba(45, 95, 63, 0.5);
}
[data-theme="dark"] .fiche-content-wrapper .tranche-2 {
    background: rgba(139, 111, 58, 0.25);
    color: #e8d4b8;
    border-color: rgba(139, 111, 58, 0.5);
}

/* Header de timeline */
[data-theme="dark"] .fiche-content-wrapper .timeline-marker {
    background: rgba(13, 31, 60, 0.95);
    color: var(--couleur-accent-clair);
    border-color: var(--couleur-accent);
}
[data-theme="dark"] .fiche-content-wrapper .evolution-timeline {
    background: var(--couleur-accent);
}

/* ════════════════════════════════════════════════════════════════
   OVERRIDES de spécificité supérieure :
   bat les anciennes règles de fiche-viewer.css et fiche.css (qui ont
   été écrites avec !important pour l'ancien design bleu)
   ════════════════════════════════════════════════════════════════ */

/* Header (gradient bleu forcé) → fond clair sobre */
#fiche-content .fiche-content-wrapper .header,
.fiche-content-wrapper .header {
    background: #ffffff !important;
    color: var(--couleur-principale) !important;
    border: 1px solid var(--couleur-bordure) !important;
}
#fiche-content .fiche-content-wrapper .header h1,
.fiche-content-wrapper .header h1 {
    color: var(--couleur-principale) !important;
}
#fiche-content .fiche-content-wrapper .header .subtitle,
.fiche-content-wrapper .header .subtitle {
    color: var(--couleur-accent) !important;
}
#fiche-content .fiche-content-wrapper .header p,
#fiche-content .fiche-content-wrapper .header span,
.fiche-content-wrapper .header p,
.fiche-content-wrapper .header span {
    color: var(--couleur-principale) !important;
}
#fiche-content .fiche-content-wrapper .header .reference,
.fiche-content-wrapper .header .reference {
    background: rgba(184, 137, 42, 0.08) !important;
    color: var(--couleur-principale) !important;
    border: 1px solid var(--couleur-accent) !important;
}

/* Mode sombre : header sobre en navy translucide */
[data-theme="dark"] #fiche-content .fiche-content-wrapper .header,
[data-theme="dark"] .fiche-content-wrapper .header {
    background: rgba(13, 50, 96, 0.6) !important;
    color: #e8f0fa !important;
    border-color: rgba(91, 163, 217, 0.25) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .header h1,
[data-theme="dark"] .fiche-content-wrapper .header h1 {
    color: #e8f0fa !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .header .subtitle,
[data-theme="dark"] .fiche-content-wrapper .header .subtitle {
    color: var(--couleur-accent-clair) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .header p,
[data-theme="dark"] #fiche-content .fiche-content-wrapper .header span,
[data-theme="dark"] .fiche-content-wrapper .header p,
[data-theme="dark"] .fiche-content-wrapper .header span {
    color: #e8f0fa !important;
}

/* Badges "Point clé", "Définition", "Important" etc. : visibles dans les deux thèmes */
/* Ces badges sont des .numero-element en dur dans le contenu, qu'on ré-stylise sobrement */
#fiche-content .fiche-content-wrapper .numero-element,
.fiche-content-wrapper .numero-element {
    background: transparent !important;
    color: var(--couleur-accent) !important;
    border: none !important;
    border-bottom: 1px solid var(--couleur-accent) !important;
    border-radius: 0 !important;
    padding: 4px 0 !important;
    font-family: 'Cormorant Garamond', Georgia, serif !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    margin-right: 12px !important;
    display: inline-block !important;
}

/* Numéros de listes (bulles "1", "2", "3") : cercle gold sobre */
#fiche-content .fiche-content-wrapper .numero-liste,
.fiche-content-wrapper .numero-liste {
    background: transparent !important;
    color: var(--couleur-accent) !important;
    border: 1px solid var(--couleur-accent) !important;
    border-radius: 50% !important;
    padding: 4px 10px !important;
    font-family: 'Cormorant Garamond', Georgia, serif !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    min-width: 32px !important;
    text-align: center !important;
    display: inline-block !important;
}

/* Étape numéro (cercle pour calculs) */
#fiche-content .fiche-content-wrapper .etape-numero,
.fiche-content-wrapper .etape-numero {
    background: transparent !important;
    color: var(--couleur-accent) !important;
    border: 1px solid var(--couleur-accent) !important;
    border-radius: 50% !important;
}

/* Badges (taux, date, tranches) : pas de texte blanc forcé */
#fiche-content .fiche-content-wrapper .taux-badge,
.fiche-content-wrapper .taux-badge {
    background: #f8faff !important;
    color: var(--couleur-principale) !important;
    border: 1px solid var(--couleur-bordure) !important;
}
#fiche-content .fiche-content-wrapper .date-badge,
.fiche-content-wrapper .date-badge {
    background: rgba(184, 137, 42, 0.08) !important;
    color: var(--couleur-accent) !important;
    border: 1px solid var(--couleur-accent) !important;
}
#fiche-content .fiche-content-wrapper .mise-en-valeur,
.fiche-content-wrapper .mise-en-valeur {
    background: none !important;
    color: var(--couleur-accent) !important;
    padding: 0 !important;
    border: none !important;
    font-weight: 600 !important;
}

/* Mode sombre badges : ajusté pour visibilité */
[data-theme="dark"] #fiche-content .fiche-content-wrapper .numero-element,
[data-theme="dark"] .fiche-content-wrapper .numero-element,
[data-theme="dark"] #fiche-content .fiche-content-wrapper .numero-liste,
[data-theme="dark"] .fiche-content-wrapper .numero-liste,
[data-theme="dark"] #fiche-content .fiche-content-wrapper .etape-numero,
[data-theme="dark"] .fiche-content-wrapper .etape-numero {
    color: var(--couleur-accent-clair) !important;
    border-color: var(--couleur-accent-clair) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .taux-badge,
[data-theme="dark"] .fiche-content-wrapper .taux-badge {
    background: rgba(13, 50, 96, 0.6) !important;
    color: #e8f0fa !important;
    border-color: rgba(91, 163, 217, 0.25) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .date-badge,
[data-theme="dark"] .fiche-content-wrapper .date-badge {
    background: rgba(184, 137, 42, 0.18) !important;
    color: var(--couleur-accent-clair) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .mise-en-valeur,
[data-theme="dark"] .fiche-content-wrapper .mise-en-valeur {
    background: none !important;
    color: var(--couleur-accent-clair) !important;
}

/* Texte de base : laisser le mode sombre/clair décider */
#fiche-content .fiche-content-wrapper p,
#fiche-content .fiche-content-wrapper li,
#fiche-content .fiche-content-wrapper .paragraphe,
#fiche-content .fiche-content-wrapper .contenu-texte {
    color: var(--couleur-texte) !important;
}
#fiche-content .fiche-content-wrapper h1,
#fiche-content .fiche-content-wrapper h2,
#fiche-content .fiche-content-wrapper h3,
#fiche-content .fiche-content-wrapper strong {
    color: var(--couleur-principale) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper p,
[data-theme="dark"] #fiche-content .fiche-content-wrapper li,
[data-theme="dark"] #fiche-content .fiche-content-wrapper .paragraphe,
[data-theme="dark"] #fiche-content .fiche-content-wrapper .contenu-texte {
    color: #e8f0fa !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper h1,
[data-theme="dark"] #fiche-content .fiche-content-wrapper h2,
[data-theme="dark"] #fiche-content .fiche-content-wrapper h3,
[data-theme="dark"] #fiche-content .fiche-content-wrapper strong {
    color: var(--couleur-accent-clair) !important;
}

/* Fil-ariane interne : neutralise les couleurs bleues hardcodées */
#fiche-content .fiche-content-wrapper .fil-ariane-btn,
.fiche-content-wrapper .fil-ariane-btn {
    background: #ffffff !important;
    border: 1px solid var(--couleur-bordure) !important;
    color: var(--couleur-secondaire) !important;
    border-radius: 2px !important;
}
#fiche-content .fiche-content-wrapper .fil-ariane-btn:hover,
.fiche-content-wrapper .fil-ariane-btn:hover {
    background: rgba(184, 137, 42, 0.08) !important;
    border-color: var(--couleur-accent) !important;
    color: var(--couleur-principale) !important;
    transform: none !important;
}
#fiche-content .fiche-content-wrapper .fil-ariane-btn.active,
.fiche-content-wrapper .fil-ariane-btn.active,
#fiche-content .fiche-content-wrapper button.fil-ariane-btn.active,
.fiche-content-wrapper button.fil-ariane-btn.active {
    background: var(--couleur-accent) !important;
    border-color: var(--couleur-accent) !important;
    color: #ffffff !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(184, 137, 42, 0.3) !important;
}
#fiche-content .fiche-content-wrapper .fil-ariane-unifie,
.fiche-content-wrapper .fil-ariane-unifie {
    background: rgba(255, 255, 255, 0.98) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .fil-ariane-unifie,
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-unifie {
    background: rgba(10, 40, 80, 0.95) !important;
    border-bottom-color: rgba(91, 163, 217, 0.18) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .fil-ariane-btn,
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-btn {
    background: rgba(13, 50, 96, 0.6) !important;
    border-color: rgba(91, 163, 217, 0.18) !important;
    color: rgba(232, 240, 250, 0.7) !important;
}
[data-theme="dark"] #fiche-content .fiche-content-wrapper .fil-ariane-btn.active,
[data-theme="dark"] .fiche-content-wrapper .fil-ariane-btn.active {
    background: var(--couleur-accent) !important;
    border-color: var(--couleur-accent) !important;
    color: var(--couleur-principale) !important;
}

/* ════════════════════════════════════════════════════════════════
   MODE SOMBRE — Override des inline styles "background:#xxxxxx"
   héritage BDD (148+ occurrences de fonds clairs en dur).
   En mode sombre on neutralise au profit d'un bleu foncé charte
   pour préserver la lisibilité.
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .fiche-content-wrapper [style*="background:"],
[data-theme="dark"] .fiche-content-wrapper [style*="background-color:"] {
    background: rgba(13, 50, 96, 0.5) !important;
    background-color: rgba(13, 50, 96, 0.5) !important;
    color: #e8f0fa !important;
    border-color: rgba(91, 163, 217, 0.18) !important;
}

/* Couleurs de texte en dur (#4a90e2, #2c3e50, #666, etc.) → texte clair charte */
[data-theme="dark"] .fiche-content-wrapper [style*="color:"] {
    color: #e8f0fa !important;
}

/* Préserve les liens (gold) malgré l'override couleur */
[data-theme="dark"] .fiche-content-wrapper a[style*="color:"] {
    color: var(--couleur-accent, #c9a84c) !important;
}
