/**
 * Taxe Usafi - Situation Room (GovTech dark)
 * Variables globales + reset + base typographique.
 */

:root,
html[data-theme='dark'] {
  --bg-deep: #0c1713;
  --bg-panel: #12221b;
  --bg-card: #172a22;
  --bg-hover: #20382e;
  --border: #2b3b34;
  --border-light: #385047;
  --text-primary: #edf4f0;
  --text-sec: #bdd0c7;
  --text-muted: #8fa49a;
  --text-ghost: #61756b;
  --accent: #58c49b;
  --accent-dark: #173b2e;
  --blue: #2471a3;
  --blue-dark: #0d2035;
  --warn: #f39c12;
  --warn-dark: #3a2a0d;
  --danger: #e74c3c;
  --danger-dark: #3a0d0d;
  --link-hover: #2dd4bf;
  --chart-grid: rgba(26, 42, 69, 0.85);
  --chart-tick: #4a7a9b;
  --selection-bg: rgba(5, 169, 131, 0.35);
  --selection-color: var(--text-primary);
  --sidebar-bg: #173027;
  --sidebar-border: #355046;
  --sidebar-text: #c7d8d1;
  --sidebar-strong: #fffef9;
  --sidebar-muted: #91a9a0;
  --sidebar-hover: #203c31;
  --sidebar-active: rgba(88, 196, 155, 0.16);
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  /* Compat anciennes vues */
  --safi-primary: var(--text-primary);
  --safi-accent: var(--accent);
  --safi-muted: var(--text-muted);
  --safi-border: var(--border);
  --safi-card: var(--bg-card);
  --safi-surface: var(--bg-deep);
}

html[data-theme='light'] {
  --bg-deep: #f4f1e8;
  --bg-panel: #fffef9;
  --bg-card: #f8f5ed;
  --bg-hover: #ebe6da;
  --border: #d8d3c7;
  --border-light: #cbc5b8;
  --text-primary: #14211b;
  --text-sec: #526058;
  --text-muted: #717a74;
  --text-ghost: #9ba19d;
  --accent: #087a5b;
  --accent-dark: #dff3e9;
  --blue: #1d4ed8;
  --blue-dark: #dbeafe;
  --warn: #d97706;
  --warn-dark: #fef3c7;
  --danger: #dc2626;
  --danger-dark: #fee2e2;
  --link-hover: #047857;
  --chart-grid: rgba(100, 116, 139, 0.22);
  --chart-tick: #64748b;
  --selection-bg: rgba(5, 150, 105, 0.25);
  --selection-color: var(--text-primary);
  --sidebar-bg: #fffef9;
  --sidebar-border: #d8d3c7;
  --sidebar-text: #526058;
  --sidebar-strong: #14211b;
  --sidebar-muted: #717a74;
  --sidebar-hover: #f1ede3;
  --sidebar-active: rgba(8, 122, 91, 0.1);
  --safi-primary: var(--text-primary);
  --safi-accent: var(--accent);
  --safi-muted: var(--text-muted);
  --safi-border: var(--border);
  --safi-card: var(--bg-card);
  --safi-surface: var(--bg-deep);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 13px;
  scroll-behavior: smooth;
  background-color: var(--bg-deep);
  color-scheme: dark;
}

html[data-theme='light'] {
  color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body.sr-body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme='light'] body.sr-body {
  color-scheme: light;
}

/* Empêche le « flash » clair et les fonds navigateur par défaut */
body.sr-body,
body.sr-body .safi-layout {
  background-color: var(--bg-deep);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: none;
}

.safi-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-color);
}

/* Typo : titres de section */
.sr-section-title {
  margin: 0 0 0.75rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

@keyframes sr-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.15);
  }
}
