/* ============================================================================
   LUBRICANTES INTERNACIONALES — Design System (variables de tema claro/oscuro)
   El atributo data-theme en <html> controla qué bloque de variables aplica.

   Rediseño UI/UX (etapa 1): se AMPLÍA el sistema de tokens sin renombrar los
   ya existentes (--primary-color, --surface-color, --text-color, etc.) para
   no romper ninguna vista ya construida — los nombres nuevos (--bg-main,
   --text-primary, --accent...) son la capa premium encima de los mismos
   valores base.
   ============================================================================ */

:root {
    /* ---- Marca — industrial / automotriz ---- */
    --primary-color: #d97706;       /* ámbar (aceite) */
    --primary-color-hover: #b45309;
    --primary-color-soft: #fef3c7;
    --secondary-color: #0f1b2e;     /* azul acero profundo */

    /* ---- Superficies (nombres originales, se mantienen) ---- */
    --background-color: #f1f4f8;
    --surface-color: #ffffff;
    --surface-color-alt: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #8a94a6;
    --border-color: #e7eaf0;

    --success-color: #16a34a;
    --warning-color: #f59e0b;
    --danger-color: #dc2626;
    --info-color: #2563eb;

    --sidebar-bg: #0d1424;
    --sidebar-surface: #141d31;
    --sidebar-text: #94a1b8;
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: #1b2438;
    --sidebar-border: rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    /* ---- Capa de tokens premium (etapa 1 del rediseño) ---- */
    --bg-main: var(--background-color);
    --bg-surface: var(--surface-color);
    --bg-elevated: #ffffff;
    --bg-subtle: var(--surface-color-alt);

    --text-primary: var(--text-color);
    --text-secondary: #4b5768;
    --text-tertiary: var(--text-muted);

    --accent: var(--primary-color);
    --accent-hover: var(--primary-color-hover);
    --accent-soft: var(--primary-color-soft);

    --blue: #2563eb;
    --blue-soft: #dbeafe;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --purple: #7c3aed;
    --purple-soft: #ede9fe;
    --orange: #ea580c;
    --orange-soft: #ffedd5;
    --red: #dc2626;
    --red-soft: #fee2e2;
    --teal: #0891b2;
    --teal-soft: #cffafe;

    --success-soft: var(--green-soft);
    --warning-soft: var(--accent-soft);
    --danger-soft: var(--red-soft);
    --info-soft: var(--blue-soft);

    --chart-grid: var(--border-color);
    --chart-axis: var(--text-tertiary);

    --focus-ring: 0 0 0 3px rgba(217, 119, 6, 0.25);
}

/* Oscuro por preferencia de sistema (cuando no hay elección explícita) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background-color: #090d15;
        --surface-color: #121a29;
        --surface-color-alt: #0e1420;
        --text-color: #e7ebf3;
        --text-muted: #6d7890;
        --border-color: #232c3f;

        --sidebar-bg: #05070d;
        --sidebar-surface: #0d1420;
        --sidebar-active-bg: #17203350;
        --sidebar-border: rgba(255, 255, 255, 0.05);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);

        --bg-elevated: #17203a;
        --bg-subtle: var(--surface-color-alt);
        --text-secondary: #aab4c8;
        --text-tertiary: var(--text-muted);

        --primary-color-soft: #3a2a14;
        --blue-soft: #17233f;
        --green-soft: #122a1d;
        --purple-soft: #241c3d;
        --orange-soft: #331e0f;
        --red-soft: #33191c;
        --teal-soft: #0e2b33;
    }

    /* Los componentes de Bootstrap sin clases propias (dropdowns como la
       campana de notificaciones o el menú de usuario, modales por defecto,
       etc.) se oscurecen activando el [data-bs-theme="dark"] nativo de
       Bootstrap 5.3 — theme.js le pone ese atributo al <html> junto con
       data-theme. No redeclaramos --bs-dropdown-* aquí: Bootstrap las
       redefine él mismo dentro de .dropdown-menu (var(--bs-body-bg), etc.),
       así que una redeclaración en :root nunca llegaría a aplicarse. */
}

/* Oscuro forzado por el switch del usuario */
:root[data-theme="dark"] {
    --background-color: #090d15;
    --surface-color: #121a29;
    --surface-color-alt: #0e1420;
    --text-color: #e7ebf3;
    --text-muted: #6d7890;
    --border-color: #232c3f;

    --sidebar-bg: #05070d;
    --sidebar-surface: #0d1420;
    --sidebar-active-bg: #17203350;
    --sidebar-border: rgba(255, 255, 255, 0.05);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);

    --bg-elevated: #17203a;
    --bg-subtle: var(--surface-color-alt);
    --text-secondary: #aab4c8;
    --text-tertiary: var(--text-muted);

    --primary-color-soft: #3a2a14;
    --blue-soft: #17233f;
    --green-soft: #122a1d;
    --purple-soft: #241c3d;
    --orange-soft: #331e0f;
    --red-soft: #33191c;
    --teal-soft: #0e2b33;
}
