/* ═══════════════════════════════════════════════════════════════════════
   FUNSQUAD DASHBOARD — DESIGN TOKENS
   Thème clair + sombre. Accent paramétrable (--accent) ; toutes les
   nuances d'accent dérivent via color-mix(). Géré par core/theme.js.
═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Accent par défaut (surchargé dynamiquement par theme.js) */
  --accent: #5865f2;

  /* Nuances d'accent dérivées */
  --accent-dim:    color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-soft:   color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 38%, transparent);
  --accent-glow:   color-mix(in srgb, var(--accent) 28%, transparent);
  --accent-text:   color-mix(in srgb, var(--accent) 78%, white);
  --on-accent:     #ffffff;

  /* Statuts (constants) */
  --green:  #23a55a;  --green-dim:  color-mix(in srgb, var(--green) 16%, transparent);
  --red:    #f23f43;  --red-dim:    color-mix(in srgb, var(--red) 16%, transparent);
  --yellow: #f0b232;  --yellow-dim: color-mix(in srgb, var(--yellow) 16%, transparent);
  --purple: #a855f7;  --purple-dim: color-mix(in srgb, var(--purple) 16%, transparent);
  --blue:   #3b82f6;  --blue-dim:   color-mix(in srgb, var(--blue) 16%, transparent);

  /* Géométrie */
  --radius-xl: 18px; --radius-lg: 14px; --radius: 10px; --radius-sm: 7px; --radius-xs: 5px;

  /* Layout */
  --sidebar-w: 264px;
  --header-h:  58px;
  --topbar-h:  60px;
  --preview-w: 400px;
  --maxw:      1180px;

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t:    .16s;
  --t-lg: .3s;

  /* Typo */
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;

  /* Échelle d'espacement (cohérence des marges/paddings) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 22px; --space-6: 30px; --space-8: 44px;

  /* Échelle typographique */
  --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 14px; --fs-md: 15px;
  --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 30px;

  /* Anneau de focus accessible (clavier) */
  --ring: 0 0 0 3px var(--accent-soft);
}

/* ── THÈME SOMBRE (défaut) — flat near-black façon MEE6 ─────────────────── */
:root, :root[data-theme="dark"] {
  --bg:         #0e0f13;
  --surface:    #1a1b20;
  --surface-2:  #202126;
  --surface-3:  #26272d;
  --surface-hover: #2a2b32;
  --elevated:   #202126;
  --inset:      #141519;
  --header-bg:  #141519;

  --border:   rgba(255,255,255,.06);
  --border-2: rgba(255,255,255,.09);
  --border-3: rgba(255,255,255,.14);

  --text:       #f3f4f6;
  --text-2:     #c5c9d1;
  --text-muted: #8b909c;
  --text-faint: #565b66;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow:    0 8px 30px rgba(0,0,0,.55);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.65);

  --scrim: rgba(0,0,0,.72);
  color-scheme: dark;
}

/* ── THÈME CLAIR ───────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg:         #eef1f6;
  --surface:    #ffffff;
  --surface-2:  #f6f8fb;
  --surface-3:  #eef1f6;
  --surface-hover: #e9edf3;
  --elevated:   #ffffff;
  --inset:      #f1f3f7;
  --header-bg:  #ffffff;

  --border:   rgba(15,23,42,.09);
  --border-2: rgba(15,23,42,.14);
  --border-3: rgba(15,23,42,.20);

  --text:       #0f1726;
  --text-2:     #3a4456;
  --text-muted: #6b7689;
  --text-faint: #9aa4b5;

  --shadow-sm: 0 1px 3px rgba(15,23,42,.08);
  --shadow:    0 8px 30px rgba(15,23,42,.12);
  --shadow-lg: 0 20px 60px rgba(15,23,42,.18);

  --scrim: rgba(15,23,42,.45);
  color-scheme: light;
}

/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-lg) var(--ease), color var(--t-lg) var(--ease);
}
a { color: inherit; }
button { font-family: inherit; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-3); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Sélection */
::selection { background: var(--accent-soft); color: var(--text); }
