/**
 * Design Tokens - Sistema de Diseño Unificado Redes.de
 * Este archivo centraliza TODAS las variables CSS de la aplicación.
 *
 * IMPORTANTE: Este es el único archivo donde se definen variables de diseño.
 * Todos los demás archivos CSS deben usar estas variables.
 *
 * @version 2.0.0
 * @date 2025-01-03
 */

/* ============================================
   TOKENS BASE (Independientes del tema)
   ============================================ */

:root {
    /* ----------------------------------------
       ESPACIADO
       Escala consistente para margins/paddings
       ---------------------------------------- */
    --space-1: 0.25rem;    /* 4px */
    --space-2: 0.5rem;     /* 8px */
    --space-3: 0.75rem;    /* 12px */
    --space-4: 1rem;       /* 16px */
    --space-5: 1.25rem;    /* 20px */
    --space-6: 1.5rem;     /* 24px */
    --space-8: 2rem;       /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */

    /* ----------------------------------------
       TIPOGRAFÍA
       ---------------------------------------- */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;

    --font-size-xs: 0.75rem;     /* 12px */
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.125rem;    /* 18px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-4xl: 2.25rem;    /* 36px */
    --font-size-5xl: 3rem;       /* 48px */

    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;

    /* ----------------------------------------
       BORDES Y RADIOS
       ---------------------------------------- */
    --radius-none: 0;
    --radius-sm: 0.25rem;     /* 4px */
    --radius-md: 0.375rem;    /* 6px */
    --radius-lg: 0.5rem;      /* 8px */
    --radius-xl: 0.75rem;     /* 12px */
    --radius-2xl: 1rem;       /* 16px */
    --radius-3xl: 1.5rem;     /* 24px */
    --radius-full: 9999px;

    --border-width-thin: 1px;
    --border-width-medium: 2px;
    --border-width-thick: 3px;

    /* ----------------------------------------
       SOMBRAS (Base - se ajustan por tema)
       ---------------------------------------- */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

    /* ----------------------------------------
       TRANSICIONES
       ---------------------------------------- */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-slower: 500ms ease;

    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* ----------------------------------------
       Z-INDEX
       ---------------------------------------- */
    --z-base: 0;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;

    /* ----------------------------------------
       BREAKPOINTS (para referencia en media queries)
       ---------------------------------------- */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;

    /* ----------------------------------------
       CONTENEDORES
       ---------------------------------------- */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1200px;
    --container-2xl: 1400px;
}

/* ============================================
   TEMA CLARO (Light) - Por defecto
   ============================================ */

:root,
[data-theme="light"] {
    /* Colores de marca */
    --brand-primary: #6366f1;
    --brand-secondary: #7c3aed;
    --brand-primary-hover: #4f46e5;
    --brand-primary-light: #818cf8;
    --brand-primary-dark: #4338ca;
    --brand-primary-rgb: 99, 102, 241;

    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #f1f5f9;
    --bg-active: #e2e8f0;
    --bg-disabled: #f8fafc;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-muted: #f8fafc;
    --bg-accent: rgba(99, 102, 241, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-gradient-start: #ffffff;
    --bg-gradient-end: #f8fafc;

    /* Colores de texto */
    --text-primary: #1f2937;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --text-disabled: #94a3b8;
    --text-inverse: #ffffff;
    --text-link: #6366f1;
    --text-link-hover: #4f46e5;

    /* Colores de borde */
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --border-focus: #6366f1;
    --border-error: #ef4444;
    --border-subtle: #f1f5f9;
    --border-medium: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Colores semánticos */
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --success-border: #10b981;

    --warning-color: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --warning-border: #f59e0b;

    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: #ef4444;

    --info-color: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --info-border: #3b82f6;

    /* Componentes: Inputs */
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-border-hover: #9ca3af;
    --input-border-focus: #6366f1;
    --input-placeholder: #9ca3af;
    --input-focus-ring: rgba(99, 102, 241, 0.2);
    --input-disabled-bg: #f3f4f6;

    /* Componentes: Cards */
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: var(--shadow-sm);
    --card-hover-shadow: var(--shadow-md);

    /* Componentes: Modal */
    --modal-bg: #ffffff;
    --modal-backdrop: rgba(0, 0, 0, 0.5);
    --modal-blur: blur(8px);

    /* Componentes: Navbar/Header */
    --navbar-bg: #ffffff;
    --navbar-border: #e2e8f0;
    --navbar-shadow: var(--shadow-sm);

    /* Componentes: Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --sidebar-hover: #f8fafc;
    --sidebar-active: #f1f5f9;
    --sidebar-active-text: #6366f1;

    /* Componentes: Table */
    --table-border: #e2e8f0;
    --table-header-bg: #f8fafc;
    --table-hover: #f1f5f9;
    --table-striped: #f8fafc;

    /* Componentes: Botones */
    --btn-primary-bg: #6366f1;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #4f46e5;
    --btn-secondary-bg: #f1f5f9;
    --btn-secondary-text: #1f2937;
    --btn-secondary-hover: #e2e8f0;

    /* Status bar para móviles */
    color-scheme: light;
}

/* ============================================
   TEMA OSCURO (Dark) - Lavanda/Gris
   Diseño suave con acentos morados
   ============================================ */

[data-theme="dark"] {
    /* Colores de marca - Lavanda suave */
    --brand-primary: #a78bfa;
    --brand-secondary: #8b5cf6;
    --brand-primary-hover: #8b5cf6;
    --brand-primary-light: #c4b5fd;
    --brand-primary-dark: #7c3aed;
    --brand-primary-rgb: 167, 139, 250;

    /* Colores de fondo - Grises cálidos */
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2e2e2e;
    --bg-hover: #333333;
    --bg-active: #3d3d3d;
    --bg-disabled: #242424;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-muted: #2e2e2e;
    --bg-accent: rgba(167, 139, 250, 0.12);
    --bg-glass: rgba(36, 36, 36, 0.85);
    --bg-gradient-start: #1a1a1a;
    --bg-gradient-end: #242424;

    /* Colores de texto */
    --text-primary: #f5f5f5;
    --text-secondary: #d4d4d4;
    --text-tertiary: #a3a3a3;
    --text-muted: #737373;
    --text-disabled: #525252;
    --text-inverse: #1a1a1a;
    --text-link: #a78bfa;
    --text-link-hover: #c4b5fd;

    /* Colores de borde */
    --border-primary: #333333;
    --border-secondary: #404040;
    --border-focus: #a78bfa;
    --border-error: #f87171;
    --border-subtle: #2e2e2e;
    --border-medium: #404040;
    --border-strong: #525252;

    /* Colores semánticos */
    --success-color: #34d399;
    --success-bg: rgba(52, 211, 153, 0.15);
    --success-border: #34d399;

    --warning-color: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.15);
    --warning-border: #fbbf24;

    --error-color: #f87171;
    --error-bg: rgba(248, 113, 113, 0.15);
    --error-border: #f87171;

    --info-color: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.15);
    --info-border: #60a5fa;

    /* Componentes: Inputs */
    --input-bg: #242424;
    --input-border: #404040;
    --input-border-hover: #525252;
    --input-border-focus: #a78bfa;
    --input-placeholder: #525252;
    --input-focus-ring: rgba(167, 139, 250, 0.25);
    --input-disabled-bg: #1a1a1a;

    /* Componentes: Cards */
    --card-bg: #242424;
    --card-border: #333333;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --card-hover-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);

    /* Componentes: Modal */
    --modal-bg: #242424;
    --modal-backdrop: rgba(0, 0, 0, 0.75);
    --modal-blur: blur(8px);

    /* Componentes: Navbar/Header */
    --navbar-bg: #242424;
    --navbar-border: #333333;
    --navbar-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);

    /* Componentes: Sidebar */
    --sidebar-bg: #242424;
    --sidebar-border: #333333;
    --sidebar-hover: #2e2e2e;
    --sidebar-active: #333333;
    --sidebar-active-text: #a78bfa;

    /* Componentes: Table */
    --table-border: #333333;
    --table-header-bg: #242424;
    --table-hover: #2e2e2e;
    --table-striped: #242424;

    /* Componentes: Botones */
    --btn-primary-bg: #a78bfa;
    --btn-primary-text: #1a1a1a;
    --btn-primary-hover: #8b5cf6;
    --btn-secondary-bg: #333333;
    --btn-secondary-text: #f5f5f5;
    --btn-secondary-hover: #404040;

    /* Sombras mejoradas para tema oscuro */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.7);

    /* Status bar para móviles */
    color-scheme: dark;
}

/* ============================================
   TEMA OSCURO MODERNO (Dark Modern) - Azul/Slate
   Diseño profesional con acentos azules
   ============================================ */

[data-theme="dark-modern"] {
    /* Colores de marca - Azul vibrante */
    --brand-primary: #0ea5e9;
    --brand-secondary: #38bdf8;
    --brand-primary-hover: #0284c7;
    --brand-primary-light: #38bdf8;
    --brand-primary-dark: #0369a1;
    --brand-primary-rgb: 14, 165, 233;

    /* Colores de fondo - Slate oscuro */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --bg-active: #64748b;
    --bg-disabled: #1e293b;
    --bg-overlay: rgba(15, 23, 42, 0.9);
    --bg-muted: #334155;
    --bg-accent: rgba(14, 165, 233, 0.12);
    --bg-glass: rgba(30, 41, 59, 0.85);
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;

    /* Colores de texto */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;
    --text-disabled: #475569;
    --text-inverse: #0f172a;
    --text-link: #0ea5e9;
    --text-link-hover: #38bdf8;

    /* Colores de borde */
    --border-primary: #334155;
    --border-secondary: #475569;
    --border-focus: #0ea5e9;
    --border-error: #fca5a5;
    --border-subtle: #334155;
    --border-medium: #475569;
    --border-strong: #64748b;

    /* Colores semánticos */
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --success-border: #10b981;

    --warning-color: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-border: #f59e0b;

    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.15);
    --error-border: #ef4444;

    --info-color: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);
    --info-border: #3b82f6;

    /* Componentes: Inputs */
    --input-bg: #1e293b;
    --input-border: #475569;
    --input-border-hover: #64748b;
    --input-border-focus: #0ea5e9;
    --input-placeholder: #64748b;
    --input-focus-ring: rgba(14, 165, 233, 0.25);
    --input-disabled-bg: #0f172a;

    /* Componentes: Cards */
    --card-bg: #1e293b;
    --card-border: #334155;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
    --card-hover-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);

    /* Componentes: Modal */
    --modal-bg: #1e293b;
    --modal-backdrop: rgba(15, 23, 42, 0.8);
    --modal-blur: blur(8px);

    /* Componentes: Navbar/Header */
    --navbar-bg: #1e293b;
    --navbar-border: #334155;
    --navbar-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);

    /* Componentes: Sidebar */
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    --sidebar-hover: #334155;
    --sidebar-active: rgba(14, 165, 233, 0.1);
    --sidebar-active-text: #0ea5e9;

    /* Componentes: Table */
    --table-border: #334155;
    --table-header-bg: #1e293b;
    --table-hover: #334155;
    --table-striped: #1e293b;

    /* Componentes: Botones */
    --btn-primary-bg: #0ea5e9;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #0284c7;
    --btn-secondary-bg: #334155;
    --btn-secondary-text: #f1f5f9;
    --btn-secondary-hover: #475569;

    /* Sombras mejoradas para tema oscuro moderno */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.8);

    /* Status bar para móviles */
    color-scheme: dark;
}

/* ============================================
   UTILIDADES DE COLOR
   Para uso con clases utilitarias
   ============================================ */

.text-brand { color: var(--brand-primary); }
.text-brand-light { color: var(--brand-primary-light); }
.text-brand-dark { color: var(--brand-primary-dark); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }
.text-info { color: var(--info-color); }
.text-muted { color: var(--text-muted); }

.bg-brand { background-color: var(--brand-primary); }
.bg-brand-light { background-color: var(--brand-primary-light); }
.bg-brand-dark { background-color: var(--brand-primary-dark); }
.bg-success { background-color: var(--success-bg); }
.bg-warning { background-color: var(--warning-bg); }
.bg-error { background-color: var(--error-bg); }
.bg-info { background-color: var(--info-bg); }
