/*
 * ZETHTALLER — tokens de diseño.
 * Única fuente de colores, tipografía, espacios, radios y sombras.
 * Ninguna plantilla ni componente debe escribir códigos de color: usa var(--…).
 *
 * Tema: <html data-theme="light|dark">; sin atributo sigue al sistema
 * (prefers-color-scheme). Lo fija ui/js/theme-boot.js antes de pintar.
 */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Escala de color base (no usar directamente en componentes). */
    --graphite-950: #0b0f14;
    --graphite-900: #11161d;
    --graphite-850: #161c24;
    --graphite-800: #1c232d;
    --graphite-700: #2a3340;
    --graphite-600: #3a4553;
    --graphite-500: #5b6676;
    --graphite-400: #8792a2;
    --graphite-300: #b4bcc8;
    --graphite-200: #d5dae2;
    --graphite-150: #e3e7ed;
    --graphite-100: #eef1f5;
    --graphite-50: #f6f8fa;
    --blue-700: #1b4fa8;
    --blue-600: #2160c4;
    --blue-500: #2f74e0;
    --blue-400: #5b95ec;
    --blue-300: #8cb5f3;
    --green-600: #15803d;
    --green-500: #1f9d55;
    --green-400: #3cbf73;
    --amber-600: #b45309;
    --amber-500: #d97706;
    --amber-400: #f2a93b;
    --red-600: #c22a2a;
    --red-500: #dc3c3c;
    --red-400: #ef6b6b;

    /* Tipografía */
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --leading: 1.5;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Espacios (múltiplos de 4 px) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;

    /* Radios */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 999px;

    /* Dimensiones de layout */
    --sidebar-width: 248px;
    --sidebar-width-collapsed: 68px;
    --topbar-height: 56px;
    --control-height: 36px;
    --control-height-sm: 30px;

    /* Movimiento */
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --duration: 140ms;

    /* Capas */
    --z-sidebar: 30;
    --z-topbar: 40;
    --z-dropdown: 60;
    --z-modal: 80;
    --z-toast: 90;

    /* ---------- Tema claro (por defecto) ---------- */
    --color-bg: var(--graphite-50);
    --color-surface: #ffffff;
    --color-surface-2: var(--graphite-100);
    --color-surface-hover: var(--graphite-100);
    --color-surface-glass: rgba(255, 255, 255, 0.82);
    --color-border: var(--graphite-150);
    --color-border-strong: var(--graphite-200);
    --color-text: var(--graphite-900);
    --color-text-muted: var(--graphite-500);
    --color-text-subtle: var(--graphite-400);
    --color-text-inverse: #ffffff;

    --color-primary: var(--blue-600);
    --color-primary-hover: var(--blue-700);
    --color-primary-soft: #e8f0fd;
    --color-primary-text: var(--blue-700);
    --color-on-primary: #ffffff;

    --color-success: var(--green-600);
    --color-success-soft: #e7f6ec;
    --color-warning: var(--amber-600);
    --color-warning-soft: #fdf3e2;
    --color-danger: var(--red-600);
    --color-danger-hover: #a32222;
    --color-danger-soft: #fdecec;
    --color-info: var(--blue-600);
    --color-info-soft: #e8f0fd;

    --color-sidebar-bg: var(--graphite-900);
    --color-sidebar-text: var(--graphite-300);
    --color-sidebar-text-strong: #ffffff;
    --color-sidebar-hover: rgba(255, 255, 255, 0.06);
    --color-sidebar-active: rgba(91, 149, 236, 0.18);
    --color-sidebar-active-text: #ffffff;
    --color-sidebar-section: var(--graphite-500);

    --color-focus: var(--blue-500);
    --focus-ring: 0 0 0 3px rgba(47, 116, 224, 0.35);
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.25);
    --overlay: rgba(11, 15, 20, 0.45);

    color-scheme: light;
}

/* ---------- Tema oscuro ---------- */
:root[data-theme="dark"] {
    --color-bg: var(--graphite-950);
    --color-surface: var(--graphite-900);
    --color-surface-2: var(--graphite-850);
    --color-surface-hover: var(--graphite-800);
    --color-surface-glass: rgba(17, 22, 29, 0.82);
    --color-border: var(--graphite-800);
    --color-border-strong: var(--graphite-700);
    --color-text: #e8ecf1;
    --color-text-muted: var(--graphite-400);
    --color-text-subtle: var(--graphite-500);
    --color-text-inverse: var(--graphite-950);

    --color-primary: var(--blue-500);
    --color-primary-hover: var(--blue-400);
    --color-primary-soft: rgba(47, 116, 224, 0.16);
    --color-primary-text: var(--blue-300);
    --color-on-primary: #ffffff;

    --color-success: var(--green-400);
    --color-success-soft: rgba(60, 191, 115, 0.14);
    --color-warning: var(--amber-400);
    --color-warning-soft: rgba(242, 169, 59, 0.14);
    --color-danger: var(--red-400);
    --color-danger-hover: #f38a8a;
    --color-danger-soft: rgba(239, 107, 107, 0.14);
    --color-info: var(--blue-400);
    --color-info-soft: rgba(47, 116, 224, 0.16);

    --color-sidebar-bg: #0e1218;
    --color-sidebar-hover: rgba(255, 255, 255, 0.05);
    --color-sidebar-active: rgba(91, 149, 236, 0.2);

    --focus-ring: 0 0 0 3px rgba(91, 149, 236, 0.45);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 10px 28px -8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
    --overlay: rgba(0, 0, 0, 0.6);

    color-scheme: dark;
}

/* Sin preferencia guardada: sigue al sistema. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: var(--graphite-950);
        --color-surface: var(--graphite-900);
        --color-surface-2: var(--graphite-850);
        --color-surface-hover: var(--graphite-800);
        --color-surface-glass: rgba(17, 22, 29, 0.82);
        --color-border: var(--graphite-800);
        --color-border-strong: var(--graphite-700);
        --color-text: #e8ecf1;
        --color-text-muted: var(--graphite-400);
        --color-text-subtle: var(--graphite-500);
        --color-text-inverse: var(--graphite-950);
        --color-primary: var(--blue-500);
        --color-primary-hover: var(--blue-400);
        --color-primary-soft: rgba(47, 116, 224, 0.16);
        --color-primary-text: var(--blue-300);
        --color-success: var(--green-400);
        --color-success-soft: rgba(60, 191, 115, 0.14);
        --color-warning: var(--amber-400);
        --color-warning-soft: rgba(242, 169, 59, 0.14);
        --color-danger: var(--red-400);
        --color-danger-hover: #f38a8a;
        --color-danger-soft: rgba(239, 107, 107, 0.14);
        --color-info: var(--blue-400);
        --color-info-soft: rgba(47, 116, 224, 0.16);
        --color-sidebar-bg: #0e1218;
        --color-sidebar-hover: rgba(255, 255, 255, 0.05);
        --color-sidebar-active: rgba(91, 149, 236, 0.2);
        --focus-ring: 0 0 0 3px rgba(91, 149, 236, 0.45);
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
        --shadow-md: 0 10px 28px -8px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
        --overlay: rgba(0, 0, 0, 0.6);
        color-scheme: dark;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --duration: 0ms;
    }
}
