/* =====================================================================
   ESPACE AGENT · MODE CLAIR (2026-11-12)
   Charge par base.html sur les pages de l'espace agent (drapeau
   `espace_agent`), juste apres socle.css. N'agit que si <html> porte
   `theme-clair` : choix du visiteur, memorise sur l'appareil et partage
   avec la vitrine (localStorage `caelys-theme`).

   Meme famille que la vitrine claire : papier chaud, lin, encre brune, le
   cuivre qui agit. Le sombre reste la reference : ce fichier redefinit les
   JETONS de socle.css (--bg-*, --text-*, --encre-rgb...), puis traduit les
   classes Tailwind ecrites « blanc sur noir » (text-white/70, border-white/10,
   bg-black/30...) et corrige les quelques couleurs posees en dur.

   Contrastes (WCAG, sur papier #F8F4EF) : texte 16:1, secondaire 7,7:1,
   tertiaire 4,8:1, cuivre de lien 5,3:1.
   ===================================================================== */

/* ---------- Jetons ------------------------------------------------------ */
html.espace-agent.theme-clair {
  --bg-primary: #F8F4EF;
  --bg-elevated-1: #FFFFFF;
  --bg-elevated-2: #F0E8DF;
  --border-default: #E2D6C8;
  --accent-light: #A93D16;
  --accent-tint: rgba(196, 74, 30, 0.08);
  --text-primary: #21160F;
  --text-secondary: rgba(33, 22, 15, 0.72);
  --text-tertiary: rgba(33, 22, 15, 0.58);
  --success: #15803D;
  --warning: #B45309;
  --error: #B91C1C;
  --encre-rgb: 33, 22, 15;
  --papier: #F8F4EF;
  background-color: var(--bg-primary) !important;
  color-scheme: light !important;
}
html.espace-agent.theme-clair body { color: var(--text-primary); }

/* Fond anime : la nebuleuse inversee devient une poussiere legere. */
html.espace-agent.theme-clair #bgMesh { filter: invert(1) hue-rotate(180deg); mix-blend-mode: multiply; opacity: .3; }

/* ---------- Tailwind « blanc sur noir » -> encre sur papier -------------- */
html.espace-agent.theme-clair .text-white { color: var(--text-primary); }
html.espace-agent.theme-clair .text-white\/20 { color: rgba(var(--encre-rgb), .3); }
html.espace-agent.theme-clair .text-white\/30 { color: rgba(var(--encre-rgb), .42); }
html.espace-agent.theme-clair .text-white\/40 { color: rgba(var(--encre-rgb), .55); }
html.espace-agent.theme-clair .text-white\/45 { color: rgba(var(--encre-rgb), .58); }
html.espace-agent.theme-clair .text-white\/50 { color: rgba(var(--encre-rgb), .62); }
html.espace-agent.theme-clair .text-white\/55 { color: rgba(var(--encre-rgb), .64); }
html.espace-agent.theme-clair .text-white\/60 { color: rgba(var(--encre-rgb), .68); }
html.espace-agent.theme-clair .text-white\/70 { color: rgba(var(--encre-rgb), .74); }
html.espace-agent.theme-clair .text-white\/75 { color: rgba(var(--encre-rgb), .78); }
html.espace-agent.theme-clair .text-white\/80 { color: rgba(var(--encre-rgb), .82); }
html.espace-agent.theme-clair .text-white\/85 { color: rgba(var(--encre-rgb), .86); }
html.espace-agent.theme-clair .text-white\/90 { color: rgba(var(--encre-rgb), .9); }
html.espace-agent.theme-clair .border-white\/10 { border-color: rgba(var(--encre-rgb), .1); }
html.espace-agent.theme-clair .border-white\/30 { border-color: rgba(var(--encre-rgb), .25); }
html.espace-agent.theme-clair .bg-white\/10 { background-color: rgba(var(--encre-rgb), .06); }
html.espace-agent.theme-clair .bg-black\/20 { background-color: rgba(var(--encre-rgb), .05); }
html.espace-agent.theme-clair .bg-black\/30 { background-color: rgba(var(--encre-rgb), .06); }
@media (hover: hover) and (pointer: fine) {
  html.espace-agent.theme-clair .hover\:text-white:hover { color: var(--text-primary); }
  html.espace-agent.theme-clair .hover\:text-white\/80:hover { color: rgba(var(--encre-rgb), .85); }
  html.espace-agent.theme-clair .hover\:text-white\/90:hover { color: rgba(var(--encre-rgb), .92); }
}

/* ---------- Surfaces communes ---------------------------------------------- */
html.espace-agent.theme-clair { --text-offwhite: #21160F; --creux-rgb: 196, 160, 125; }
/* Carte « verre » (verre.css) : le jour, du verre DEPOLI blanc. Les teintes
   propres a chaque carte (--verre-teinte) restent. */
html.espace-agent.theme-clair .verre {
  --verre-fond: rgba(255, 255, 255, 0.62);
  --verre-ombre: 0 14px 36px rgba(90, 60, 35, 0.12);
  --verre-reflets:
    inset 1px 1px 0 rgba(255, 255, 255, 0.95),
    inset -1px -1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -20px 34px -18px rgba(120, 90, 60, 0.10);
  border-color: rgba(33, 22, 15, 0.08);
}
@media (hover: none) and (pointer: coarse) {
  html.espace-agent.theme-clair .verre { --verre-fond: rgba(255, 255, 255, 0.94); }
}
html.espace-agent.theme-clair.eco .verre { --verre-fond: rgba(255, 255, 255, 0.94); }
/* Carte « glass » du socle. */
html.espace-agent.theme-clair .card-glass {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(33, 22, 15, 0.08);
  box-shadow: 0 8px 28px rgba(90, 60, 35, 0.10);
}
/* Barre du haut. */
html.espace-agent.theme-clair .mp-topbar { background: rgba(248, 244, 239, 0.86); }
@media (hover: none) and (pointer: coarse) {
  html.espace-agent.theme-clair .mp-topbar { background: rgba(248, 244, 239, 0.97); }
}

/* ---------- Bouton jour / nuit (partiel _bouton_theme.html) --------------- */
/* Ces regles agissent dans les DEUX modes (le bouton existe aussi la nuit). */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(var(--encre-rgb), .08); color: var(--text-primary);
  transition: transform 160ms cubic-bezier(.23, 1, .32, 1), background-color 200ms ease;
}
.theme-btn:active { transform: scale(.94); }
.theme-btn svg { width: 19px; height: 19px; }
@media (hover: hover) and (pointer: fine) { .theme-btn:hover { background: rgba(var(--encre-rgb), .14); } }
@media (pointer: coarse) { .theme-btn { width: 44px; height: 44px; } }
.theme-lune, .theme-lib-sombre { display: none; }
html.theme-clair .theme-soleil, html.theme-clair .theme-lib-clair { display: none; }
html.theme-clair .theme-lune { display: block; }
html.theme-clair .theme-lib-sombre { display: inline; }
.menu-espace-theme { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-bottom: 1px solid rgba(var(--encre-rgb), 0.06); background: none; font-family: inherit; text-align: left; cursor: pointer; }
.menu-espace-theme svg { width: 20px; height: 20px; flex: none; }
html.theme-bascule, html.theme-bascule * {
  transition: background-color 280ms ease, color 280ms ease, border-color 280ms ease !important;
}

/* ---------- Classes Tailwind du theme (tailwind.config.js) ------------------ */
html.espace-agent.theme-clair .text-offwhite { color: var(--text-primary); }
html.espace-agent.theme-clair .bg-anthracite-3 { background-color: #E7DCCF; }

/* ---------- Selecteur de langue, tiroir de menu ------------------------------ */
html.espace-agent.theme-clair .lsw-btn { background: rgba(255, 255, 255, 0.8); }
html.espace-agent.theme-clair .lsw-menu { background: #fff; box-shadow: 0 16px 40px rgba(90, 60, 35, 0.16); }
html.espace-agent.theme-clair .menu-espace-panneau { background: #F8F4EF; }

/* ---------- Logos : pas d'ombre noire sous le logo, le jour ------------------ */
html.espace-agent.theme-clair img[src*="/branding/logo"] { filter: none !important; }

/* ---------- Connexion (accueil.html) ------------------------------------------ */
/* Le voile orange translucide de la nuit devient du cuivre plein : sur le
   papier, un orange a 50 % avec un texte blanc ne se lisait plus. */
html.espace-agent.theme-clair .agent-fade-col .btn-connexion { background: var(--accent); border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  html.espace-agent.theme-clair .agent-fade-col .btn-connexion:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: none; }
}
html.espace-agent.theme-clair .espace-pastille { background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 18px rgba(196, 74, 30, 0.22); }

/* ---------- Tableau de bord (agent_dashboard.html) ------------------------------ */
html.espace-agent.theme-clair .module-foot { color: rgba(33, 22, 15, 0.86); }

/* ---------- Page module en chapitres (agent_module_chapitres.html) ------------- */
html.espace-agent.theme-clair .mc-barre { background: #E7DCCF; }
html.espace-agent.theme-clair .mc-ch:hover { background: rgba(33, 22, 15, 0.05); }
html.espace-agent.theme-clair .mc-ch.is-contour { border-color: rgba(33, 22, 15, 0.16); }
/* L'ombre sous les titres servait a les detacher du fond etoile : inutile le jour. */
html.espace-agent.theme-clair .mc-lecons .mc-lecon-titre,
html.espace-agent.theme-clair .mc-liste .mc-ligne-txt b,
html.espace-agent.theme-clair .mc-lecons .mc-fmt,
html.espace-agent.theme-clair .mc-lecons .mc-lecon-num { text-shadow: none; }
html.espace-agent.theme-clair .mc-ligne-serie.is-choisie { background: rgba(196, 74, 30, 0.08); }
html.espace-agent.theme-clair .mc-series { box-shadow: 0 10px 28px rgba(90, 60, 35, 0.10); }
html.espace-agent.theme-clair .mc-pt { border-color: rgba(33, 22, 15, 0.18); }
html.espace-agent.theme-clair .mc-pt.is-ok { background: rgba(21, 128, 61, 0.12); color: #15803D; }
html.espace-agent.theme-clair .mc-pt.is-ko { background: rgba(180, 83, 9, 0.12); color: #B45309; }
html.espace-agent.theme-clair .mc-pt-pause { background: #F0E8DF; }
html.espace-agent.theme-clair .mc-detail p.is-pause { color: #9A6A1F; }

/* ---------- Quiz (quiz.html) ---------------------------------------------------- */
/* Barre du haut : fond pose en ligne dans le gabarit. */
html.espace-agent.theme-clair header.sticky.backdrop-blur-xl { background: rgba(248, 244, 239, 0.92) !important; }
html.espace-agent.theme-clair .marge-temps,
html.espace-agent.theme-clair .timer-num { color: rgba(33, 22, 15, 0.9); }
html.espace-agent.theme-clair .marge-chrono.warning .marge-temps,
html.espace-agent.theme-clair .timer-wrap.warning .timer-num { color: #B45309; }
html.espace-agent.theme-clair .marge-chrono.critical .marge-temps,
html.espace-agent.theme-clair .timer-wrap.critical .timer-num { color: #B91C1C; }
html.espace-agent.theme-clair .choice-row { background: #fff; border-color: rgba(33, 22, 15, 0.12); }
html.espace-agent.theme-clair .choice-row:hover { background: #fff; border-color: rgba(33, 22, 15, 0.3); }
html.espace-agent.theme-clair .choice-row.checked { background: rgba(196, 74, 30, 0.08); }
/* « Processus d'assurance · Plusieurs reponses possibles » : l'or devient bronze. */
html.espace-agent.theme-clair .type-reponse { color: #8E6A1F; }
html.espace-agent.theme-clair .type-reponse .type-attendu { color: rgba(142, 106, 31, 0.8); }
html.espace-agent.theme-clair .cas-decor .who,
html.espace-agent.theme-clair .chat-decor .who,
html.espace-agent.theme-clair .cas-consigne { color: #A93D16; }
html.espace-agent.theme-clair .chat-decor { background: rgba(255, 255, 255, 0.94); }
html.espace-agent.theme-clair .chat-panel { background: rgba(255, 255, 255, 0.9); box-shadow: 0 10px 40px rgba(90, 60, 35, 0.12); }
html.espace-agent.theme-clair .assoc-select { border-color: rgba(33, 22, 15, 0.2); background-color: #fff; color: var(--text-primary); }
@media (hover: none) and (pointer: coarse) {
  html.espace-agent.theme-clair .chat-decor { background: rgba(255, 255, 255, 0.98); }
}

/* ---------- Resultats (resultats.html) ------------------------------------------ */
/* Les trois cadres « reussi / partiel / echoue » : fondus vers un brun sombre
   la nuit, vers le blanc le jour. Fonds poses en ligne dans le gabarit. */
html.espace-agent.theme-clair [style*="rgba(20,40,30,0.55)"] { background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(255, 255, 255, 0.85)) !important; }
html.espace-agent.theme-clair [style*="rgba(40,30,15,0.55)"] { background: linear-gradient(135deg, rgba(245, 180, 60, 0.18), rgba(255, 255, 255, 0.85)) !important; }
html.espace-agent.theme-clair [style*="rgba(40,15,15,0.55)"] { background: linear-gradient(135deg, rgba(220, 55, 55, 0.14), rgba(255, 255, 255, 0.85)) !important; }

/* ---------- Consignes (consignes.html) ------------------------------------------ */
html.espace-agent.theme-clair .briefing-card > .inner { background: rgba(255, 255, 255, 0.94); }

/* ---------- Quiz live (live_quiz.html, live_waiting.html) ---------------------- */
html.espace-agent.theme-clair .question-card-galaxy > .inner,
html.espace-agent.theme-clair .wait-card > .inner { background: rgba(255, 255, 255, 0.94); }
html.espace-agent.theme-clair .sujet-question { color: #8E6A1F; }
html.espace-agent.theme-clair .timer-pill.warning { color: #B45309; }

/* ---------- Messagerie (agent_messagerie.html) --------------------------------- */
html.espace-agent.theme-clair .msg-card { background: rgba(255, 255, 255, 0.86); }
html.espace-agent.theme-clair .msg-tab.active .msg-tab-count { color: #A93D16; }
html.espace-agent.theme-clair .msg-btn.danger { color: #B91C1C; }

/* ---------- Cas d'examen (agent_cas_examen.html) ------------------------------- */
/* Le dossier lui-meme (.cx-page) est deja un papier clair dans les deux modes. */
html.espace-agent.theme-clair .cx-tab[aria-selected="true"] { color: var(--text-primary); }
@media (hover: hover) and (pointer: fine) { html.espace-agent.theme-clair .cx-toc a:hover { color: var(--text-primary); } }
html.espace-agent.theme-clair .cx-field input,
html.espace-agent.theme-clair .cx-field select { background: #fff; border-color: rgba(33, 22, 15, 0.2); }
html.espace-agent.theme-clair .cx-del { border-color: rgba(33, 22, 15, 0.2); color: rgba(33, 22, 15, 0.6); }
html.espace-agent.theme-clair .cx-del:hover { color: #B91C1C; }
html.espace-agent.theme-clair .cx-btn { border-color: rgba(33, 22, 15, 0.16); color: var(--text-primary); }
html.espace-agent.theme-clair .cx-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html.espace-agent.theme-clair .cx-verrou { color: #15803D; }

/* ---------- Demandes d'aide (support_mes_tickets.html) ------------------------- */
html.espace-agent.theme-clair .st-nouveau  { color: #92400E; }
html.espace-agent.theme-clair .st-en_cours { color: #1D4ED8; }
html.espace-agent.theme-clair .st-resolu   { color: #15803D; }
html.espace-agent.theme-clair .st-archive  { color: #475569; }

/* ---------- Achat de modules (agent_buy_selection.html) ------------------------ */
html.espace-agent.theme-clair .bs-disclosure strong,
html.espace-agent.theme-clair .bs-test-note strong { color: #92400E; }
html.espace-agent.theme-clair .bs-code-err { color: #B91C1C; }

/* ---------- Securite (agent_securite.html) : pastilles en ligne ---------------- */
html.espace-agent.theme-clair [style*="color:#34A853"] { color: #15803D !important; }
html.espace-agent.theme-clair [style*="color:#FFB84D"] { color: #92400E !important; }

/* ---------- Couleurs d'etat Tailwind (vert / ambre / rouge clairs) ------------ */
/* Pensees pour le noir (nuances 200 a 400) : sur le blanc elles disparaissent.
   Le jour, les memes etats passent aux nuances 700. */
html.espace-agent.theme-clair :is(.text-green-300, .text-green-400) { color: #15803D; }
html.espace-agent.theme-clair .text-green-200\/70 { color: rgba(21, 128, 61, 0.8); }
html.espace-agent.theme-clair :is(.text-amber-200, .text-amber-300, .text-amber-400) { color: #B45309; }
html.espace-agent.theme-clair :is(.text-amber-200\/70, .text-amber-200\/90, .text-amber-300\/80) { color: rgba(146, 64, 14, 0.85); }
html.espace-agent.theme-clair :is(.text-red-300, .text-red-400) { color: #B91C1C; }
html.espace-agent.theme-clair :is(.text-red-200\/70, .text-red-200\/90) { color: rgba(185, 28, 28, 0.85); }
html.espace-agent.theme-clair .text-blue-300 { color: #1D4ED8; }

/* ---------- Tableau de bord : scores de l'historique --------------------------- */

html.espace-agent.theme-clair .histo-score.est-faible { color: #B91C1C; }

/* ---------- Cas d'examen : accueil « Deroulement de l'oral » --------------------- */
html.espace-agent.theme-clair .ox-title { background: linear-gradient(90deg, #21160F 0%, #6B3A22 55%, #C44A1E 100%); -webkit-background-clip: text; background-clip: text; }
html.espace-agent.theme-clair .ox-stat strong,
html.espace-agent.theme-clair .ox-part strong { color: var(--text-primary); }
html.espace-agent.theme-clair .ox-checks li { color: rgba(33, 22, 15, 0.82); }
html.espace-agent.theme-clair .ox-steps p { color: rgba(33, 22, 15, 0.74); }
html.espace-agent.theme-clair .ox-step-n { color: #A93D16; }
html.espace-agent.theme-clair .ox-checks li::before { border-color: #C44A1E; }

/* ---------- Tableau de bord : liens d'acces rapide, dates, historique ----------- */
html.espace-agent.theme-clair .acces-lien { color: rgba(33, 22, 15, 0.84); }
html.espace-agent.theme-clair :is(.acces-lien, .acces-lien-fort, .qa-fermer, .dates-ok, .histo-plus):hover { color: var(--text-primary); }
html.espace-agent.theme-clair .dates-ok.a-valider { background: var(--accent); border-color: var(--accent); color: #fff; }
html.espace-agent.theme-clair .histo-ligne, html.espace-agent.theme-clair .histo-date { color: rgba(33, 22, 15, 0.82); }
html.espace-agent.theme-clair .histo-score { color: rgba(33, 22, 15, 0.86); }
html.espace-agent.theme-clair .histo-score.est-bon { color: #15803D; }
html.espace-agent.theme-clair .histo-score.est-faible { color: #B91C1C; }

/* ---------- Telephone : barre d'action du quiz collee en bas ------------------ */
@media (hover: none) and (pointer: coarse) {
  html.espace-agent.theme-clair .qz-actions {
    background: linear-gradient(to top, rgba(248, 244, 239, 0.97) 62%, rgba(248, 244, 239, 0));
  }
}

/* ---------- Pages « premier acces » cote agent --------------------------------
   Invitation, rattachement, nouveau mot de passe. Leur feuille
   (entreprise/_premier_acces_style.html) est PARTAGEE avec l'espace entreprise
   et l'administration, qui restent sombres : on ne la touche pas, on la
   corrige ici, sous .espace-agent seulement. */
html.espace-agent.theme-clair .pa-surtitre { color: rgba(33, 22, 15, 0.58); }
html.espace-agent.theme-clair .pa-titre,
html.espace-agent.theme-clair .pa-etapes strong { color: var(--text-primary); }
html.espace-agent.theme-clair .pa-accent { background: linear-gradient(120deg, #6B3A22, #A93D16 45%, #C44A1E); -webkit-background-clip: text; background-clip: text; }
html.espace-agent.theme-clair :is(.pa-chapeau, .pa-etapes li, .pa-info) { color: rgba(33, 22, 15, 0.76); }
html.espace-agent.theme-clair .pa-num { background: var(--accent); border-color: var(--accent); }
html.espace-agent.theme-clair .pa-pastille { color: #A93D16; }
html.espace-agent.theme-clair .pa-form label { color: rgba(33, 22, 15, 0.85); }
html.espace-agent.theme-clair .pa-btn-second { color: rgba(33, 22, 15, 0.76); border-color: rgba(33, 22, 15, 0.16); }
html.espace-agent.theme-clair .pa-btn-second:hover { color: var(--text-primary); border-color: rgba(33, 22, 15, 0.32); }
html.espace-agent.theme-clair .pa-note { color: rgba(33, 22, 15, 0.58); }
html.espace-agent.theme-clair .pa-recap { border-color: rgba(33, 22, 15, 0.1); }
html.espace-agent.theme-clair .pa-recap > div + div { border-left-color: rgba(33, 22, 15, 0.1); }
html.espace-agent.theme-clair .pa-recap b { color: var(--text-primary); }
html.espace-agent.theme-clair .pa-recap b.pa-chaud { color: #B45309; }
html.espace-agent.theme-clair .pa-recap small { color: rgba(33, 22, 15, 0.64); }
html.espace-agent.theme-clair .pa-siege { background: rgba(255, 255, 255, 0.9); }
html.espace-agent.theme-clair .pa-siege-tete b { color: var(--text-primary); }
html.espace-agent.theme-clair .pa-siege-tete span { color: rgba(33, 22, 15, 0.58); }
