/* ============================================================
   MINDUS — THÈME SOMBRE / CLAIR (partagé par toutes les pages connectées)
   - Le thème est porté par  <html data-theme="dark|light">  (posé avant le 1er rendu)
   - Les règles du mode clair propres à chaque page sont dans le bloc
     <style id="mf-light-auto"> de la page ; ce fichier contient la base commune
     et le style du petit menu de la carte profil.
   ============================================================ */

/* ---------- Base commune du mode clair ---------- */
html[data-theme="light"]:not([data-mf-own]) {
  color-scheme: light;
  --bg-dark: #f4f6f3;
  --bg-card: #ffffff;
  --bg-card-hover: #f2f5f2;
  --bg-input: #ffffff;
  --bg-raised: #f2f5f2;
  --bg-sidebar: #f9fbf8;
  --bg-light-section: #e9eee9;
  --text-primary: #0f1a14;
  --text-secondary: #4b5b51;
  --text-muted: #66766c;
  --border-color: rgba(15, 32, 22, .14);
  --border: rgba(15, 32, 22, .14);
  --border-soft: rgba(15, 32, 22, .09);
  --border-hover: rgba(15, 32, 22, .24);
  --mf-surface-raised: #ffffff;
  --mf-line-strong: rgba(15, 32, 22, .22);
  --mf-mint: #2b6a4c;
  --bubble-in: #e8ede8;
}
html[data-theme="light"]:not([data-mf-own]) body { background-color: var(--bg-dark); color: var(--text-primary); }
html[data-theme="light"]:not([data-mf-own]) ::selection { background: rgba(43, 106, 76, .22); color: #0f1a14; }
html[data-theme="light"]:not([data-mf-own]) ::-webkit-scrollbar-thumb { background: #c3cdc5; }
html[data-theme="light"]:not([data-mf-own]) * { scrollbar-color: #c3cdc5 transparent; }
html[data-theme="light"]:not([data-mf-own]) input::placeholder,
html[data-theme="light"]:not([data-mf-own]) textarea::placeholder { color: #7a8a80; opacity: 1; }
html[data-theme="light"]:not([data-mf-own]) input,
html[data-theme="light"]:not([data-mf-own]) textarea,
html[data-theme="light"]:not([data-mf-own]) select { color-scheme: light; }

/* Texte blanc conservé sur les fonds colorés (boutons d'accent, badges, avatars dégradés) */
html[data-theme="light"] :is(
  [class~="bg-red-500"], [class~="bg-red-600"], [class~="bg-red-700"],
  [class~="bg-green-500"], [class~="bg-green-600"], [class~="bg-green-700"],
  [class~="bg-emerald-500"], [class~="bg-emerald-600"], [class~="bg-emerald-700"],
  [class~="bg-blue-500"], [class~="bg-blue-600"], [class~="bg-blue-700"],
  [class~="bg-indigo-500"], [class~="bg-indigo-600"], [class~="bg-purple-500"], [class~="bg-purple-600"],
  [class~="bg-violet-500"], [class~="bg-violet-600"], [class~="bg-pink-500"], [class~="bg-pink-600"],
  [class~="bg-orange-500"], [class~="bg-orange-600"], [class~="bg-amber-500"], [class~="bg-amber-600"],
  [class~="bg-teal-500"], [class~="bg-teal-600"], [class~="bg-cyan-500"], [class~="bg-cyan-600"],
  [class~="bg-sky-500"], [class~="bg-sky-600"], [class~="bg-rose-500"], [class~="bg-rose-600"],
  [class*="bg-gradient-to"], [class*="from-blue-"], [class*="from-indigo-"], [class*="from-purple-"],
  [class*="from-emerald-"], [class*="from-green-"], [class*="from-red-"], [class*="from-orange-"], [class*="from-pink-"]
) :is(.text-white, [class~="text-white"]),
html[data-theme="light"] :is(
  [class~="bg-red-500"], [class~="bg-red-600"], [class~="bg-green-500"], [class~="bg-green-600"],
  [class~="bg-emerald-500"], [class~="bg-emerald-600"], [class~="bg-blue-500"], [class~="bg-blue-600"],
  [class~="bg-indigo-500"], [class~="bg-indigo-600"], [class~="bg-purple-500"], [class~="bg-purple-600"],
  [class~="bg-orange-500"], [class~="bg-orange-600"], [class~="bg-amber-500"], [class~="bg-pink-500"],
  [class*="bg-gradient-to"]
):is(.text-white, [class~="text-white"]) { color: #ffffff !important; }

/* Image / vidéo / canvas : jamais altérés */
html[data-theme="light"] img, html[data-theme="light"] video, html[data-theme="light"] canvas { filter: none; }

/* Transition douce lors du changement de thème */
html.mf-theme-anim, html.mf-theme-anim *, html.mf-theme-anim *::before, html.mf-theme-anim *::after {
  transition: background-color .28s ease, color .28s ease, border-color .28s ease, fill .28s ease, stroke .28s ease, box-shadow .28s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  html.mf-theme-anim, html.mf-theme-anim *, html.mf-theme-anim *::before, html.mf-theme-anim *::after { transition: none !important; }
}

/* ============================================================
   MENU DE LA CARTE PROFIL (petite carte déroulante — pas une modale)
   ============================================================ */
.mf-pm-card { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.mf-pm-card:focus-visible { outline: 2px solid #2979FF; outline-offset: 2px; }
.mf-pm-card:hover { border-color: var(--border-hover, rgba(255, 255, 255, .18)); }
.mf-pm-chevron {
  position: absolute; right: .55rem; bottom: .5rem; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #888; pointer-events: none; transition: transform .2s ease;
}
.mf-pm-chevron svg { width: 14px; height: 14px; display: block; }
.mf-pm-card.mf-pm-open .mf-pm-chevron { transform: rotate(180deg); }

.mf-pm {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 95;
  padding: 6px; text-align: left; cursor: default;
  background: #101512; border: 1px solid rgba(202, 222, 211, .28); border-radius: 6px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .55);
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.985); transform-origin: top center;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.mf-pm--up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; transform: translateY(4px) scale(.985); }
.mf-pm-card.mf-pm-open > .mf-pm { opacity: 1; visibility: visible; transform: none; }

.mf-pm-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; margin: 0; border: 0; border-radius: 4px;
  background: transparent; color: #cbd8d0; font-size: 13px; font-weight: 500; line-height: 1.2; font-family: inherit;
  text-align: left; text-decoration: none; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mf-pm-item:hover, .mf-pm-item:focus-visible { background: rgba(173, 211, 190, .1); color: #ffffff; outline: none; }
.mf-pm-item svg.mf-pm-ic { width: 16px; height: 16px; flex-shrink: 0; color: #8fa397; }
.mf-pm-item:hover svg.mf-pm-ic { color: #cbd8d0; }
.mf-pm-item .mf-pm-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-pm-sep { height: 1px; margin: 4px 2px; background: rgba(202, 222, 211, .14); }

/* interrupteur clair / sombre */
.mf-pm-switch {
  position: relative; flex-shrink: 0; width: 34px; height: 20px; border-radius: 999px;
  background: #3a4640; transition: background .2s ease;
}
.mf-pm-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .2s ease;
}
html[data-theme="light"] .mf-pm-switch { background: #2b6a4c; }
html[data-theme="light"] .mf-pm-switch::after { transform: translateX(14px); }
.mf-pm-theme .ic-sun { display: block; }
.mf-pm-theme .ic-moon { display: none; }
html[data-theme="light"] .mf-pm-theme .ic-sun { display: none; }
html[data-theme="light"] .mf-pm-theme .ic-moon { display: block; }

/* version claire du menu */
html[data-theme="light"] .mf-pm { background: #ffffff; border-color: rgba(15, 32, 22, .16); box-shadow: 0 14px 32px rgba(15, 32, 22, .18); }
html[data-theme="light"] .mf-pm-item { color: #2d3d33; }
html[data-theme="light"] .mf-pm-item:hover, html[data-theme="light"] .mf-pm-item:focus-visible { background: rgba(15, 32, 22, .06); color: #0f1a14; }
html[data-theme="light"] .mf-pm-item svg.mf-pm-ic { color: #66766c; }
html[data-theme="light"] .mf-pm-item:hover svg.mf-pm-ic { color: #0f1a14; }
html[data-theme="light"] .mf-pm-sep { background: rgba(15, 32, 22, .1); }
html[data-theme="light"] .mf-pm-chevron { color: #66766c; }
html[data-theme="light"] .mf-pm-card:hover { border-color: rgba(15, 32, 22, .26); }

/* sur mobile la carte doit passer au-dessus de la liste de navigation */
.mf-pm-card.mf-pm-open { z-index: 80; }

/* mini carte (pages sans carte profil native : admin, documentation) */
.mf-mini-card{display:flex;align-items:center;gap:10px;padding:10px 40px 10px 12px;border:1px solid rgba(202,222,211,.28);border-radius:6px;background:rgba(255,255,255,.03)}
.mf-mini-av{width:32px;height:32px;border-radius:50%;background:#2a2f2c;color:#cbd8d0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;flex-shrink:0}
.mf-mini-tx{font-size:13px;font-weight:600;color:#e6ece8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html[data-theme="light"] .mf-mini-card{border-color:rgba(15,32,22,.16);background:rgba(15,32,22,.025)}
html[data-theme="light"] .mf-mini-av{background:#dce2dc;color:#48584e}
html[data-theme="light"] .mf-mini-tx{color:#0f1a14}
