/* Colores, tamaños y sombras (modo claro y oscuro): todo lo demás usa estas variables */

/* ================================================================ tokens */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #171a26;
  --text-2: #4a5068;
  --muted: #646a82;   /* contraste AA (4,5:1) sobre todos los fondos claros */
  --accent: #5b5bd6;
  /* Derivados del color de acento: siguen al color elegido en Configuración */
  --accent-hover: color-mix(in srgb, var(--accent) 85%, var(--text));
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --accent-text: #ffffff;
  --danger: #c9302c;
  --danger-text: var(--danger);
  --danger-soft: #fdecec;
  --success: #137040;
  --warning: #d97706;
  --sidebar-bg: #14151f;
  --sidebar-text: #a3a7bd;
  --sidebar-text-strong: #ffffff;
  --sidebar-hover: #1f2130;
  --sidebar-active: #2a2c44;
  --sidebar-border: #232536;
  --shadow-sm: 0 1px 2px rgba(16, 20, 40, .06);
  --shadow: 0 1px 3px rgba(16, 20, 40, .06), 0 6px 20px rgba(16, 20, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 20, 40, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  --sidebar-rail: 72px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1017;
    --surface: #171823;
    --surface-2: #1c1e2b;
    --surface-3: #242635;
    --border: #2a2d3e;
    --border-strong: #3a3e54;
    --text: #eceef6;
    --text-2: #b6bacd;
    --muted: #8a8fa8;
    --accent: #7b7bf0;
    --danger-soft: #3a1d22;
    --danger: #e5484d;
    --danger-text: #ff8085;
    --accent-text: #0b0b10; /* sobre el morado claro del modo oscuro, el texto oscuro se lee mejor */
    --success: #2fb36b;
    --sidebar-bg: #0b0c12;
    --sidebar-hover: #171823;
    --sidebar-active: #22243a;
    --sidebar-border: #1b1c28;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1017;
  --surface: #171823;
  --surface-2: #1c1e2b;
  --surface-3: #242635;
  --border: #2a2d3e;
  --border-strong: #3a3e54;
  --text: #eceef6;
  --text-2: #b6bacd;
  --muted: #8a8fa8;
  --accent: #7b7bf0;
  --danger-soft: #3a1d22;
  --danger: #e5484d;
  --danger-text: #ff8085;
  --accent-text: #0b0b10;
  --success: #2fb36b;
  --sidebar-bg: #0b0c12;
  --sidebar-hover: #171823;
  --sidebar-active: #22243a;
  --sidebar-border: #1b1c28;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* Texto con el color de acento: un poco más oscuro (o claro en modo oscuro) para que se lea bien */
:root { --accent-ink: color-mix(in srgb, var(--accent) 62%, #000); }
:root[data-theme="dark"] { --accent-ink: color-mix(in srgb, var(--accent) 78%, #fff); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --accent-ink: color-mix(in srgb, var(--accent) 78%, #fff); } }
