/* ==========================================
   THÈMES DE COULEURS DU PORTAIL (20/10/2026)
   Choisis par le client dans le menu utilisateur (cookie, core/themes.py) et
   posés sur <html data-theme="…">. variables.css reste la copie conforme du
   backoffice (test_charte_parite) : un thème SURCHARGE ici les variables
   --ece-* ; « ece » (la charte) ne surcharge rien.
   Rôles propres aux thèmes, lus avec repli sur la charte dans les feuilles :
   --theme-encre-accent      texte posé sur un fond « or » (accent)
   --theme-accent-sur-fonce  accent en TEXTE sur un fond foncé
   --theme-fond              fond de page
   --theme-teinte*           teintes claires des tableaux (SIG)
   Contrastes WCAG AA (4,5:1) verrouillés par core/tests/test_themes.py.
   ========================================== */

/* MEGPSM : anthracite + rouge du Pilotage HBI, encre blanche sur le rouge. */
:root[data-theme="megpsm"] {
    --ece-purple-dark: #17171c;
    --ece-purple: #232329;
    --ece-purple-light: #3a3a44;
    --ece-gold: #d81f2c;
    --ece-gold-light: #c41a26;
    --ece-gold-lighter: #dc2834;
    --ece-gold-dark: #b4161f;
    --ece-gold-hover: #c01a26;
    --bs-link-color: #b4161f;
    --bs-link-color-rgb: 180, 22, 31;
    --bs-link-hover-color: #8f1119;
    --bs-link-hover-color-rgb: 143, 17, 25;
    --theme-encre-accent: #ffffff;
    --theme-accent-sur-fonce: #ff7b84;
    --theme-fond: #ededf1;
    --theme-teinte: #f1f1f4;
    --theme-teinte-legere: #f8f8fa;
    --theme-teinte-survol: #ebebef;
    --theme-teinte-accent: #fdeced;
}

/* Océan : bleu marine + turquoise. */
:root[data-theme="ocean"] {
    --ece-purple-dark: #0b2239;
    --ece-purple: #12355a;
    --ece-purple-light: #1d4f7c;
    --ece-gold: #3fb8af;
    --ece-gold-light: #6fd0c8;
    --ece-gold-lighter: #57c4bb;
    --ece-gold-dark: #1d6b66;
    --ece-gold-hover: #35a39b;
    --bs-link-color: #12355a;
    --bs-link-color-rgb: 18, 53, 90;
    --bs-link-hover-color: #0b2239;
    --bs-link-hover-color-rgb: 11, 34, 57;
    --theme-fond: #e9eef3;
    --theme-teinte: #eef3f8;
    --theme-teinte-legere: #f7fafc;
    --theme-teinte-survol: #e6eef6;
    --theme-teinte-accent: #dcf1ef;
}

/* Forêt : vert sapin + cuivre. */
:root[data-theme="foret"] {
    --ece-purple-dark: #0f2a1f;
    --ece-purple: #1b4332;
    --ece-purple-light: #2d6a4f;
    --ece-gold: #d08c60;
    --ece-gold-light: #e3a97f;
    --ece-gold-lighter: #dc9c70;
    --ece-gold-dark: #8a4f24;
    --ece-gold-hover: #bd7a4f;
    --bs-link-color: #1b4332;
    --bs-link-color-rgb: 27, 67, 50;
    --bs-link-hover-color: #0f2a1f;
    --bs-link-hover-color-rgb: 15, 42, 31;
    --theme-fond: #e9efeb;
    --theme-teinte: #eef4f0;
    --theme-teinte-legere: #f7faf8;
    --theme-teinte-survol: #e5efe8;
    --theme-teinte-accent: #f6e9df;
}

/* ECE clair (10/11/2026, demande du user : « un thème où le fond est clair, pour voir la différence ») : les couleurs
   de la charte ECE, le fond de page blanc au lieu du gris de la charte (#eceef3). Les cartes se détachent par
   leur filet et leur ombre plutôt que par le fond. Le socle en déduit --s-bg (95 % de ce fond, 5 % d'encre). */
:root[data-theme="clair"] {
    --theme-fond: #ffffff;
}
/* 10/11/2026 (« le fond d’écran plus clair pour tester la différence de contrastes ») : fond BLANC, au-delà de
   la règle du socle (95 % du fond, 5 % d’encre) ; les cartes ne se détachent plus que par leur filet et leur ombre. */
:root[data-theme="clair"][data-apparence="socle"] {
    --s-bg: #ffffff;
}

/* Personnalisé (10/11/2026) : couleurs PAR DÉFAUT, rendues par core/theme_perso.py (DEFAUT) ; les couleurs
   choisies par l’utilisateur arrivent par /theme/perso.css, chargée après cette feuille (même sélecteur). */
:root[data-theme="perso"] {
    --ece-purple-dark: #1b2440;
    --ece-purple: #2b3a67;
    --ece-purple-light: #4b587e;
    --ece-gold: #e07a5f;
    --ece-gold-light: #e79782;
    --ece-gold-lighter: #e48a72;
    --ece-gold-dark: #864939;
    --ece-gold-hover: #ca6e56;
    --bs-link-color: #2b3a67;
    --bs-link-color-rgb: 43, 58, 103;
    --bs-link-hover-color: #1b2440;
    --bs-link-hover-color-rgb: 27, 36, 64;
    --theme-encre-accent: #1b2440;
    --theme-accent-sur-fonce: #e6927c;
    --theme-fond: #ede8dd;
    --theme-teinte: #f4f1eb;
    --theme-teinte-legere: #faf8f5;
    --theme-teinte-survol: #e5e0d7;
    --theme-teinte-accent: #fbece9;
}

/* Pastilles du menu : couleurs FIXES de chaque thème (visibles quel que soit le thème courant). */
.pastille-theme {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    vertical-align: -0.15em;
}

.pastille-theme-ece { background: linear-gradient(135deg, #2d2056 50%, #b6a54d 50%); }
.pastille-theme-megpsm { background: linear-gradient(135deg, #232329 50%, #d81f2c 50%); }
.pastille-theme-ocean { background: linear-gradient(135deg, #12355a 50%, #3fb8af 50%); }
.pastille-theme-foret { background: linear-gradient(135deg, #1b4332 50%, #d08c60 50%); }
.pastille-theme-clair { background: linear-gradient(135deg, #2d2056 50%, #f6f5f8 50%); }
.pastille-theme-perso { background: linear-gradient(135deg, #2b3a67 50%, #e07a5f 50%); }

.navbar-user-menu .choix-theme {
    display: flex;
    align-items: center;
}

.navbar-user-menu .choix-theme .bi-check2 {
    margin-left: auto;
    padding-left: 0.75rem;
}

/* Sous-menu « Thèmes » (collapse) : chevron retourné à l'ouverture, options en retrait. */
.navbar-user-menu .menu-themes-titre .bi-chevron-down {
    transition: transform 0.2s ease;
}

.navbar-user-menu .menu-themes-titre[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.navbar-user-menu .choix-theme-option {
    padding-left: 2.25rem;
}
