/**
 * ==============================================================================
 * SISTEMA GLOBAL DE TOKENS SEMÁNTICOS (KONTI & ECOSYSTEM)
 * Inspirado en la identidad corporativa oficial: Azul Rey -> Cyan -> Coral
 * 0% MORADO - Compatibilidad total Dual Dark / Light Mode
 * Tipografía Oficial del Sistema: Outfit (100% Offline / Local)
 * ==============================================================================
 */

@import url('./fonts.css');

:root {
  /* ==========================================================================
     1. TOKENS PRIMITIVOS DE MARCA KONTI
     ========================================================================== */
  /* Azul Rey (Base y Ancla de Marca - Conservado por Identidad) */
  --brand-blue-950: #0f172a;
  --brand-blue-900: #172554;
  --brand-blue-800: #1e3a8a;
  --brand-blue-700: #1d4ed8; /* Azul Rey Oficial / Base y Ancla */
  --brand-blue-600: #2563eb; /* Azul Rey Vibrante */
  --brand-blue-500: #3b82f6;
  
  /* Verde Esmeralda Brillante (La Chispa: Cobro, Éxito, Dinero Exacto) */
  --brand-emerald-800: #064e3b;
  --brand-emerald-700: #047857;
  --brand-emerald-600: #059669;
  --brand-emerald-500: #10b981; /* Verde Esmeralda Brillante */
  --brand-emerald-400: #34d399; /* Esmeralda Luz */

  /* Cobre / Ámbar Tecnológico (Transiciones, Espera, Fiados, Alertas) */
  --brand-amber-700: #b45309;
  --brand-amber-600: #d97706;
  --brand-amber-500: #f59e0b; /* Ámbar Tecnológico */
  --brand-amber-400: #fbbf24;
  --brand-copper-600: #ea580c; /* Cobre Vibrante */
  --brand-copper-500: #ff784f; /* Coral Sunset Isotipo */

  /* Azul Zafiro & Cyan */
  --brand-cyan-700: #0369a1;
  --brand-cyan-600: #0284c7; /* Azul Zafiro */
  --brand-cyan-500: #0ea5e9;
  --brand-cyan-400: #06b6d4; /* Turquesa Tecnológico */

  /* Azul Medianoche & Grafito Oscuro (Lienzo Cero-Fatiga) */
  --midnight-950: #060910;
  --midnight-900: #0a0d16; /* Fondo App Principal Dark */
  --midnight-800: #101422; /* Superficie Tarjetas / Sidebar */
  --midnight-700: #161c2d; /* Elevación Modales */
  --midnight-600: #1f273d; /* Hover interactivo */

  /* ==========================================================================
     2. GRADIENTES OFICIALES KONTI (0% MORADO - ENERGÍA LIMPIA)
     ========================================================================== */
  /* Primario: Azul Rey Elegante */
  --gradient-brand: linear-gradient(135deg, var(--brand-blue-700) 0%, var(--brand-blue-600) 45%, var(--brand-cyan-600) 100%);
  --gradient-brand-h: linear-gradient(90deg, var(--brand-blue-700) 0%, var(--brand-blue-600) 50%, var(--brand-cyan-600) 100%);
  --gradient-brand-hover: linear-gradient(135deg, var(--brand-blue-600) 0%, var(--brand-blue-500) 50%, #0284c7 100%);
  
  /* Chispa de Éxito y Cobro: Verde Esmeralda Brillante (Dinero exacto y agilidad) */
  --gradient-emerald: linear-gradient(135deg, #059669 0%, #10b981 55%, #34d399 100%);
  --gradient-emerald-hover: linear-gradient(135deg, #047857 0%, #059669 55%, #10b981 100%);

  /* Transición Cálida: Cobre y Ámbar Tecnológico (Ventas en espera, fiados) */
  --gradient-amber: linear-gradient(135deg, #d97706 0%, #f59e0b 55%, #fbbf24 100%);
  --gradient-amber-hover: linear-gradient(135deg, #b45309 0%, #d97706 55%, #f59e0b 100%);
  --gradient-copper: linear-gradient(135deg, #ea580c 0%, #f59e0b 60%, #fbbf24 100%);

  /* Gradiente Fusión Isotipo: Azul Rey a Coral / Cobre */
  --gradient-brand-sunset: linear-gradient(135deg, var(--brand-blue-700) 0%, var(--brand-cyan-600) 42%, var(--brand-copper-500) 100%);
  --gradient-accent: linear-gradient(135deg, var(--brand-copper-500) 0%, #f97316 55%, var(--brand-copper-600) 100%);

  /* Resplandor y Auras */
  --gradient-brand-subtle: linear-gradient(135deg, rgba(29, 78, 216, 0.12) 0%, rgba(16, 185, 129, 0.08) 50%, rgba(245, 158, 11, 0.1) 100%);
  --gradient-glow: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.22) 0%, rgba(16, 185, 129, 0.12) 45%, transparent 75%);

  /* ==========================================================================
     3. TIPOGRAFÍA Y ESCALAS (OUTFIT OFICIAL + ESCALA DE ACCESIBILIDAD)
     ========================================================================== */
  --font-sans: 'Outfit', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  /* Escala tipográfica accesible sin zoom */
  --font-scale: 1;

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

  /* ==========================================================================
     4. RADIOS DE BORDE
     ========================================================================== */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ==========================================================================
     5. ESTADOS SEMÁNTICOS
     ========================================================================== */
  --state-success: #10b981;
  --state-success-bg: rgba(16, 185, 129, 0.12);
  --state-warning: #f59e0b;
  --state-warning-bg: rgba(245, 158, 11, 0.12);
  --state-danger: #ef4444;
  --state-danger-bg: rgba(239, 68, 68, 0.12);
  --state-info: #06b6d4;
  --state-info-bg: rgba(6, 182, 212, 0.12);

  /* Bordes Izquierdos de Notificaciones Toast Semánticos */
  --toast-border-alert: var(--state-danger);    /* Rojo (#EF4444) para Alertas y Errores */
  --toast-border-info: var(--state-success);    /* Verde (#10B981) para Informativos y Éxito */
  --toast-border-offer: var(--brand-blue-600);  /* Azul (#2563EB) para Ofertas y Promociones */
  --toast-border-warning: var(--state-warning); /* Ámbar (#F59E0B) para Advertencias */

  /* ==========================================================================
     6. VALORES POR DEFECTO: MODO CLARO (Limpio, profesional, alta legibilidad)
     ========================================================================== */
  --bg-app: #f8fafc;                  /* Gris seda neutro */
  --bg-surface: #ffffff;              /* Blanco puro */
  --bg-surface-elevated: #ffffff;     /* Modales y dropdowns blancos */
  --bg-elevated: #ffffff;
  --bg-surface-hover: #f1f5f9;        /* Hover suave */
  --bg-subtle: #f1f5f9;
  --bg-muted: #e2e8f0;
  --bg-input: #ffffff;                /* Inputs blancos */

  --border: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: var(--brand-blue-700);

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-inverse: #ffffff;

  --accent: #1d4ed8;
  --accent-light: #2563eb;
  --accent-hover: #1e40af;
  --accent-tint: rgba(29, 78, 216, 0.08);
  --accent-cyan: #06b6d4;
  --accent-coral: #ff784f;

  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0284c7;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.09), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 60px rgba(15, 23, 42, 0.12), 0 8px 20px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 25px 60px -15px rgba(15, 23, 42, 0.2), 0 0 1px 1px rgba(15, 23, 42, 0.06);
  --shadow-accent: 0 4px 20px rgba(29, 78, 216, 0.28);
  --shadow-success: 0 4px 20px rgba(16, 185, 129, 0.25);
  --shadow-danger: 0 4px 20px rgba(239, 68, 68, 0.25);

  --backdrop-modal: rgba(15, 23, 42, 0.45);

  /* shadcn/ui Mappings (Light Mode) */
  --background: 210 40% 98%;
  --foreground: 222 47% 11%;
  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;
  --popover: 0 0% 100%;
  --popover-foreground: 222 47% 11%;
  --primary: 221 83% 53%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222 47% 11%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215 16% 47%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --ring: 221 83% 53%;
  --radius: 0.75rem;
}

/* ==========================================================================
   MODO CLARO REFORZADO (body:not(.dark-mode) / [data-theme="light"])
   ========================================================================== */
body:not(.dark-mode),
[data-theme="light"],
html:not(.dark) body {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-elevated: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-subtle: #f1f5f9;
  --bg-muted: #e2e8f0;
  --bg-input: #ffffff;

  --border: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: var(--brand-blue-700);

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-inverse: #ffffff;

  --accent: #1d4ed8;
  --accent-light: #2563eb;
  --accent-hover: #1e40af;
  --accent-tint: rgba(29, 78, 216, 0.08);

  --backdrop-modal: rgba(15, 23, 42, 0.45);
}

/* ==========================================================================
   MODO OSCURO: AZUL MEDIANOCHE & GRAFITO OSCURO (KONTI ZERO-FATIGUE)
   Activo cuando body.dark-mode, html.dark o [data-theme="dark"]
   ========================================================================== */
body.dark-mode,
html.dark,
[data-theme="dark"],
html.dark body,
body.dark-mode :root,
html.dark :root {
  /* Lienzos y Superficies - Azul Medianoche / Grafito Oscuro */
  --bg-app: #0a0d16;                  /* Fondo oscuro azul medianoche (cero fatiga) */
  --bg-surface: #101422;              /* Superficie grafito medianoche para tarjetas, tablas y sidebar */
  --bg-surface-elevated: #161c2d;     /* Modales, menús flotantes, tarjetas elevadas */
  --bg-elevated: #161c2d;
  --bg-surface-hover: #1f273d;        /* Estados interactivos */
  --bg-subtle: #192033;
  --bg-muted: #242d47;
  --bg-input: #0b101b;                /* Inputs de texto refinados */
  
  /* Bordes */
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.28);
  --border-focus: #3b82f6;

  /* Tipografía */
  --text-heading: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-inverse: #0f172a;

  /* Acento Principal: Azul Rey */
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-hover: #1d4ed8;
  --accent-tint: rgba(37, 99, 235, 0.12);

  /* Acentos de Energía Konti */
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-copper: #ea580c;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.65);
  --shadow-modal: 0 25px 60px -10px rgba(0, 0, 0, 0.88), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  --shadow-brand: 0 4px 24px -2px rgba(37, 99, 235, 0.35);
  --shadow-emerald: 0 4px 20px -2px rgba(16, 185, 129, 0.38);
  --shadow-amber: 0 4px 18px -2px rgba(245, 158, 11, 0.35);

  --backdrop-modal: rgba(6, 9, 16, 0.82);

  /* shadcn/ui Mappings (Dark Mode Cero-Fatiga) */
  --background: 225 38% 6%;
  --foreground: 210 40% 98%;
  --card: 227 36% 10%;
  --card-foreground: 210 40% 98%;
  --popover: 226 34% 13%;
  --popover-foreground: 210 40% 98%;
  --primary: 221 83% 53%;
  --primary-foreground: 210 40% 98%;
  --secondary: 226 33% 18%;
  --secondary-foreground: 210 40% 98%;
  --muted: 226 33% 15%;
  --muted-foreground: 215 20% 65%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 210 40% 98%;
  --ring: 221 83% 53%;
}

/* ==========================================================================
   4. MODIFICADORES DE ESCALA TIPOGRÁFICA GLOBAL (ACCESIBILIDAD SIN ZOOM)
   ========================================================================== */
html[data-font-scale="compact"] {
  font-size: 14.5px !important;
  --font-scale: 0.90625;
}

html[data-font-scale="normal"],
html:not([data-font-scale]) {
  font-size: 16px !important;
  --font-scale: 1;
}

html[data-font-scale="large"] {
  font-size: 18px !important;
  --font-scale: 1.125;
}

html[data-font-scale="xlarge"] {
  font-size: 20px !important;
  --font-scale: 1.25;
}
