/*
 * Palette du site, sur deux axes au choix du visiteur :
 *   - couleur : <html data-theme="green|blue|pink">  (cookie site_theme)
 *   - mode    : <html data-mode="dark|light">   (cookie site_mode)
 * Voir includes/site_nav.php. Les couleurs sont des triplets R,G,B pour pouvoir écrire rgba(var(--acc-rgb), .2).
 * --fg-rgb est la couleur du texte et des voiles (blanc en sombre, ardoise en clair).
 */
:root{
  --acc-rgb:16,185,129;        /* accent principal  (#10b981) */
  --acc-soft-rgb:110,231,183;  /* accent clair      (#6ee7b7) */
  --acc-pale-rgb:167,243,208;  /* accent très clair (#a7f3d0) */
  --acc-2-rgb:6,182,212;       /* fin des dégradés  (#06b6d4) */
  --bg:#050a08;
  --bg-2:#0a1310;
  --on-acc:#04110c;            /* texte sur un bouton plein */
  --surface-1-rgb:13,22,18;
  --surface-2-rgb:7,13,10;
  --surface-3-rgb:14,24,20;
  --option-bg:#0b1410;
  --fg-rgb:255,255,255;
  --shadow-k:1;                /* intensité des ombres */
  /* Lueurs du fond : accent en haut à gauche, 2e couleur en bas à droite */
  --glow-a:.14;
  --glow-2-rgb:34,211,238;     /* cyan */
  --glow-2-a:.08;
  /* Couleurs de texte (statuts, badges, rangs) */
  --tx-red:#fca5a5; --tx-red-pale:#fecaca; --tx-red-2:#f87171;
  --tx-amber:#fcd34d; --tx-amber-pale:#fde68a; --tx-amber-2:#fbbf24;
  --tx-cyan:#a5f3fc; --tx-cyan-pale:#cffafe; --tx-cyan-2:#67e8f9; --tx-cyan-3:#22d3ee;
  --tx-violet:#c4b5fd; --tx-violet-2:#a78bfa;
  --tx-slate:#cbd5e1; --tx-rose:#fda4af; --tx-copper:#f0a070; --tx-green:#4ade80;
  color-scheme:dark;
}
:root[data-theme="blue"]{
  --acc-rgb:59,130,246;        /* #3b82f6 */
  --acc-soft-rgb:147,197,253;  /* #93c5fd */
  --acc-pale-rgb:191,219,254;  /* #bfdbfe */
  --acc-2-rgb:99,102,241;      /* #6366f1 */
  --bg:#05070d;
  --bg-2:#0a0f1a;
  --on-acc:#030a18;
  --surface-1-rgb:13,18,30;
  --surface-2-rgb:7,10,18;
  --surface-3-rgb:14,20,34;
  --option-bg:#0b1020;
}
/* Rose : rose néon + lavande, sur un fond prune profond (pas un simple vert recoloré) */
:root[data-theme="pink"]{
  --acc-rgb:255,77,166;        /* #ff4da6 rose néon */
  --acc-soft-rgb:255,154,205;  /* #ff9acd */
  --acc-pale-rgb:255,214,236;  /* #ffd6ec */
  --acc-2-rgb:177,120,255;     /* #b178ff lavande : fin des dégradés */
  --bg:#0e0611;
  --bg-2:#1a0a1f;
  --on-acc:#2a0418;
  --surface-1-rgb:33,13,36;    /* cartes violet-prune */
  --surface-2-rgb:21,8,24;
  --surface-3-rgb:40,15,43;
  --option-bg:#22102a;
  --glow-a:.24;                /* lueur rose bien présente */
  --glow-2-rgb:150,90,255;     /* lueur lavande en bas à droite */
  --glow-2-a:.20;
}
:root[data-theme="blue"]{ --glow-2-rgb:99,102,241; --glow-2-a:.10; }

/* ---- Mode clair ---- */
:root[data-mode="light"]{
  --acc-rgb:5,150,105;         /* #059669 */
  --acc-soft-rgb:4,120,87;     /* #047857 : texte d'accent lisible sur fond clair */
  --acc-pale-rgb:6,95,70;      /* #065f46 */
  --acc-2-rgb:8,145,178;       /* #0891b2 */
  --bg:#f2f7f4;
  --bg-2:#e6efea;
  --on-acc:#ffffff;
  --surface-1-rgb:255,255,255;
  --surface-2-rgb:246,250,248;
  --surface-3-rgb:255,255,255;
  --option-bg:#ffffff;
  --fg-rgb:15,23,42;
  --shadow-k:.22;
  --tx-red:#b91c1c; --tx-red-pale:#991b1b; --tx-red-2:#dc2626;
  --tx-amber:#b45309; --tx-amber-pale:#a16207; --tx-amber-2:#d97706;
  --tx-cyan:#0e7490; --tx-cyan-pale:#155e75; --tx-cyan-2:#0891b2; --tx-cyan-3:#0891b2;
  --tx-violet:#6d28d9; --tx-violet-2:#7c3aed;
  --tx-slate:#475569; --tx-rose:#be123c; --tx-copper:#c2410c; --tx-green:#15803d;
  color-scheme:light;
}
:root[data-mode="light"][data-theme="blue"]{
  --acc-rgb:37,99,235;         /* #2563eb */
  --acc-soft-rgb:29,78,216;    /* #1d4ed8 */
  --acc-pale-rgb:30,64,175;    /* #1e40af */
  --acc-2-rgb:79,70,229;       /* #4f46e5 */
  --bg:#f2f5fb;
  --bg-2:#e5ebf6;
  --surface-2-rgb:245,248,253;
  --option-bg:#ffffff;
}
:root[data-mode="light"][data-theme="pink"]{
  --acc-rgb:236,38,132;        /* #ec2684 */
  --acc-soft-rgb:200,20,110;   /* #c8146e : texte lisible sur fond clair */
  --acc-pale-rgb:150,20,90;
  --acc-2-rgb:139,72,240;      /* #8b48f0 lavande foncée */
  --bg:#fdf0f7;                /* blanc rosé */
  --bg-2:#f8e1ef;
  --surface-1-rgb:255,255,255;
  --surface-2-rgb:255,246,251;
  --surface-3-rgb:255,255,255;
  --option-bg:#ffffff;
  --glow-a:.22;
  --glow-2-rgb:170,120,255;
  --glow-2-a:.22;
}

/* Flèche des listes déroulantes (image SVG : la couleur ne peut pas venir d'une variable) */
:root[data-theme="blue"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2393c5fd' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
:root[data-mode="light"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23047857' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
:root[data-mode="light"][data-theme="blue"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231d4ed8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
:root[data-theme="pink"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f9a8d4' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
:root[data-mode="light"][data-theme="pink"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23be185d' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}

/* Rose : encadrés d'information en lavande (le cyan par défaut jure avec le rose) */
:root[data-theme="pink"] .alert.info{background:rgba(var(--glow-2-rgb),.12);border-color:rgba(var(--glow-2-rgb),.4);color:#e4d4ff}
:root[data-theme="pink"] .alert.info a{color:rgb(var(--acc-soft-rgb))}
:root[data-mode="light"][data-theme="pink"] .alert.info{color:#5b2a9e}

/* =====================================================================
   Thème Noël : rouge, or et vert sapin. Décorations : neige qui tombe et guirlande
   lumineuse (assets/christmas.js), neige posée sur les cartes, bonnet sur le logo.
   ===================================================================== */
:root[data-theme="christmas"]{
  --acc-rgb:230,57,70;         /* #e63946 rouge Noël */
  --acc-soft-rgb:255,138,138;  /* #ff8a8a */
  --acc-pale-rgb:255,214,214;  /* #ffd6d6 */
  --acc-2-rgb:242,193,78;      /* #f2c14e or : fin des dégradés */
  --bg:#05120c;                /* nuit vert sapin */
  --bg-2:#0a1f15;
  --on-acc:#2a0508;
  --surface-1-rgb:13,34,24;
  --surface-2-rgb:8,22,15;
  --surface-3-rgb:16,40,29;
  --option-bg:#0e2219;
  --glow-a:.22;                /* lueur rouge en haut à gauche */
  --glow-2-rgb:242,193,78;     /* lueur dorée en bas à droite */
  --glow-2-a:.13;
  --xmas-gold:#f2c14e;
  --xmas-green:#1f9d55;
}
:root[data-mode="light"][data-theme="christmas"]{
  --acc-rgb:200,30,45;         /* #c81e2d */
  --acc-soft-rgb:170,20,35;    /* texte rouge lisible sur fond clair */
  --acc-pale-rgb:120,15,25;
  --acc-2-rgb:196,140,20;      /* or foncé */
  --bg:#f3f8f6;                /* blanc neige légèrement sapin */
  --bg-2:#e4efe9;
  --surface-1-rgb:255,255,255;
  --surface-2-rgb:247,251,249;
  --surface-3-rgb:255,255,255;
  --option-bg:#ffffff;
  --glow-a:.16;
  --glow-2-rgb:31,157,85;      /* lueur vert sapin */
  --glow-2-a:.14;
}
:root[data-theme="christmas"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f2c14e' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
:root[data-mode="light"][data-theme="christmas"] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aa1423' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
:root[data-theme="christmas"] .alert.info{background:rgba(242,193,78,.1);border-color:rgba(242,193,78,.38);color:#fbe7b0}
:root[data-mode="light"][data-theme="christmas"] .alert.info{color:#7a5300}

/* Neige qui tombe (canvas créé par christmas.js) : derrière les cartes pour garder le texte lisible */
.xmas-snow{position:fixed;inset:0;width:100%;height:100%;z-index:0;pointer-events:none}
:root[data-mode="light"] .ts-menu .ts-count{background:rgba(200,30,45,.12);color:#aa1423}

/* Guirlande lumineuse en haut de l'écran */
.xmas-garland{position:fixed;top:0;left:0;right:0;height:30px;z-index:90;pointer-events:none;overflow:visible}
.xmas-garland svg{display:block;width:100%;height:30px;overflow:visible}
.xmas-garland .wire{fill:none;stroke:#1d3b2a;stroke-width:1.6}
:root[data-mode="light"] .xmas-garland .wire{stroke:#2f5a43}
.xmas-garland .cap{fill:#3b4a42}
.xmas-garland .bulb{animation:xmas-blink 2.4s ease-in-out infinite}
.xmas-garland .c0{fill:#ff4d5e;color:#ff4d5e}
.xmas-garland .c1{fill:#ffd166;color:#ffd166}
.xmas-garland .c2{fill:#34d27b;color:#34d27b}
.xmas-garland .c3{fill:#5aa9ff;color:#5aa9ff}
.xmas-garland .bulb{filter:drop-shadow(0 0 5px currentColor)}
@keyframes xmas-blink{0%,100%{opacity:1}50%{opacity:.28;filter:none}}
@media (prefers-reduced-motion:reduce){.xmas-garland .bulb{animation:none}}

/* Neige posée sur le haut des cartes : dessinée par christmas.js à la largeur exacte de chaque carte
   (contour aléatoire mais stable, bouts arrondis qui débordent et retombent sur l'arête, quelques coulures). */
.xmas-cap{position:absolute;left:-6px;right:-6px;top:-21px;height:32px;pointer-events:none;z-index:3;
  filter:drop-shadow(0 4px 4px rgba(0,0,0,.32))}
.xmas-cap svg{display:block;width:100%;height:100%;overflow:visible}
.xmas-cap.inside{top:-6px;left:0;right:0}  /* fenêtres qui défilent : posée à l'intérieur du bord */
:root[data-mode="light"] .xmas-cap{filter:drop-shadow(0 3px 3px rgba(60,100,150,.35))}
:root[data-theme="christmas"] .glass-card{overflow:visible}   /* les cartes de l'accueil coupaient la neige */
:root[data-theme="christmas"] .case-panel{position:relative}
/* Bonnet de Père Noël sur le logo */
:root[data-theme="christmas"] .top .brand{position:relative}
:root[data-theme="christmas"] .brand::before{
  content:'';position:absolute;left:-7px;top:-13px;width:30px;height:27px;pointer-events:none;transform:rotate(-16deg);z-index:2;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 36'%3E%3Cpath d='M5 27 C8 15 16 6 29 4 C30 11 33 18 36 23 C26 21 15 23 5 27Z' fill='%23e63946'/%3E%3Cpath d='M29 4 C31 10 34 16 36 23' stroke='%23a51d2a' stroke-width='2' fill='none'/%3E%3Crect x='2' y='23' width='31' height='9' rx='4.5' fill='%23f7f7f7'/%3E%3Ccircle cx='35' cy='24' r='4.5' fill='%23f7f7f7'/%3E%3C/svg%3E") center/contain no-repeat;
  filter:drop-shadow(0 2px 3px rgba(0,0,0,.35))}

/* Titres en dégradé rouge → or, boutons principaux en sucre d'orge discret */
:root[data-theme="christmas"] .h-display .grd,
:root[data-theme="christmas"] h1 .grd{background:linear-gradient(120deg,#fff 0%,#ffd6d6 30%,#e63946 60%,#f2c14e 100%);-webkit-background-clip:text;background-clip:text;color:transparent}
:root[data-mode="light"][data-theme="christmas"] h1 .grd{background:linear-gradient(120deg,#7a0e17,#c81e2d 55%,#b8860b);-webkit-background-clip:text;background-clip:text}
:root[data-theme="christmas"] .btn-submit:not(.alt),
:root[data-theme="christmas"] .nav-login{background:repeating-linear-gradient(-45deg,rgba(255,255,255,.14) 0 8px,transparent 8px 16px),linear-gradient(135deg,#ff6b6b,#e63946 50%,#c1121f);color:#fff}
:root[data-theme="christmas"] .btn-submit:not(.alt):disabled{filter:grayscale(.5)}

/* =====================================================================
   Barres de défilement aux couleurs du thème (toutes les pages)
   Chrome / Edge / Safari : ::-webkit-scrollbar ; Firefox : scrollbar-color.
   ===================================================================== */
::-webkit-scrollbar{width:11px;height:11px}
html::-webkit-scrollbar,.slide::-webkit-scrollbar{width:14px;background:var(--bg)}  /* .slide = zone qui défile sur l'accueil */
::-webkit-scrollbar-track{background:transparent}
html::-webkit-scrollbar-track,.slide::-webkit-scrollbar-track{background:var(--bg);box-shadow:inset 1px 0 0 rgba(var(--fg-rgb),.05)}
::-webkit-scrollbar-thumb{
  border-radius:100px;border:2px solid transparent;background-clip:padding-box;
  background-image:linear-gradient(180deg,rgba(var(--acc-soft-rgb),.75),rgba(var(--acc-rgb),.85) 50%,rgba(var(--acc-2-rgb),.8))}
html::-webkit-scrollbar-thumb,.slide::-webkit-scrollbar-thumb{border-width:3px;min-height:60px}
::-webkit-scrollbar-thumb:hover{background-image:linear-gradient(180deg,rgb(var(--acc-soft-rgb)),rgb(var(--acc-rgb)) 50%,rgb(var(--acc-2-rgb)))}
::-webkit-scrollbar-thumb:active{background-image:linear-gradient(180deg,rgb(var(--acc-rgb)),rgb(var(--acc-2-rgb)))}
::-webkit-scrollbar-corner{background:transparent}
::-webkit-scrollbar-button{display:none;width:0;height:0}   /* pas de flèches */

/* Noël : barre en sucre d'orge */
:root[data-theme="christmas"] ::-webkit-scrollbar-thumb{
  background-image:repeating-linear-gradient(-45deg,#e63946 0 7px,#fff6f6 7px 14px)}
:root[data-theme="christmas"] ::-webkit-scrollbar-thumb:hover{
  background-image:repeating-linear-gradient(-45deg,#ff4d5e 0 7px,#ffffff 7px 14px)}

/* Firefox (pas de dégradé possible : couleur pleine du thème) */
@supports not selector(::-webkit-scrollbar){
  *{scrollbar-width:thin;scrollbar-color:rgba(var(--acc-rgb),.7) transparent}
  html,.slide{scrollbar-color:rgb(var(--acc-rgb)) var(--bg)}
}
