/* ============================================================
 * DisruptIA Design Tokens v2.1 (ex IdeasDevOps)
 * Sistema de diseño completo con modo oscuro.
 * Importar antes que cualquier otra hoja de estilo.
 * ============================================================ */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
 * LIGHT THEME (default)
 * ============================================================ */
:root {
  /* ---- PALETA PRINCIPAL ---- */
  /* ---- MARCA DisruptIA (fuente: landing.css) ----
     Naranja = SOLO acción primaria + ítem activo. Azul etiqueta = badges/labels
     informativos. Marino = sidebar y tema oscuro. */
  --brand-navy:        #07111f;
  --brand-navy-2:      #0b1728;
  --brand-navy-3:      #12233c;   /* tarjetas sobre marino */
  --brand-blue:        #1d3f8f;
  --brand-blue-label:  #8aa4e6;
  --brand-orange:      #ff6a00;
  --brand-orange-hover:#ff7d24;
  --brand-orange-text: #bf4d00;   /* naranja legible como TEXTO sobre claro (AA >= 4.5:1) */
  --brand-on-orange:   #07111f;   /* texto sobre fondo naranja: 6.3:1 (blanco daría 2.9:1) */
  --brand-gradient:    linear-gradient(90deg, #1d3f8f, #ff6a00);
  --brand-sidebar-text:   #c7d2dd;  /* sobre #07111f: 12:1 */
  --brand-sidebar-muted:  #9dafc2;  /* sobre #07111f: 8:1 */
  --brand-surface:     #f6f7f9;     /* fondo de contenido (tema claro) */

  /* ---- PALETA PRINCIPAL (derivada de #ff6a00) ---- */
  --color-primary-50: #fff4ea;
  --color-primary-100: #ffe6d1;
  --color-primary-200: #ffcfa8;
  --color-primary-300: #ffab70;
  --color-primary-400: #ff8a33;
  --color-primary-500: #ff6a00;  /* naranja de acción DisruptIA */
  --color-primary-600: #e65f00;
  --color-primary-700: #bf4d00;
  --color-primary-800: #8f3a00;
  --color-primary-900: #6b2c00;

  --color-accent:     var(--brand-orange);
  --color-accent-hover: var(--brand-orange-hover);
  --color-accent-soft:  rgba(255, 106, 0, 0.10);
  --color-accent-subtle: rgba(255, 106, 0, 0.06);

  /* ---- NEUTRAL (Slate) ---- */
  --color-slate-50:  #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;

  /* ---- SEMÁNTICOS ---- */
  --color-success:       #10b981;
  --color-success-bg:    #d1fae5;
  --color-success-fg:    #065f46;
  --color-warning:       #f59e0b;
  --color-warning-bg:    #fef3c7;
  --color-warning-fg:    #92400e;
  --color-danger:        #ef4444;
  --color-danger-bg:     #fee2e2;
  --color-danger-fg:     #991b1b;
  --color-info:          #3b82f6;
  --color-info-bg:       #dbeafe;
  --color-info-fg:       #1e40af;

  /* ---- SUPERFICIES ---- */
  --bg:            #ffffff;
  --bg-alt:        #f6f7f9;
  --bg-card:       #ffffff;
  --bg-elevated:   #ffffff;
  --bg-gradient:   #f6f7f9;

  /* ---- TEXTO ---- */
  --text:           #0b1728;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* ---- BORDES ---- */
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;
  --border-strong: #cbd5e1;

  /* ---- TIPOGRAFÍA ---- */
  --font-sans:     'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-display:  'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  --font-mono:     ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --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 */

  --font-normal:    400;
  --font-medium:    500;
  --font-semibold:  600;
  --font-bold:      700;
  --font-extrabold: 800;

  --leading-none:   1;
  --leading-tight:  1.15;
  --leading-snug:   1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose:  2;

  --tracking-tight:   -0.025em;
  --tracking-normal:  0;
  --tracking-wide:    0.025em;
  --tracking-wider:   0.05em;

  /* ---- ESPACIADO (4px base) ---- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* ---- BORDER RADIUS ---- */
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;

  /* ---- SOMBRAS ---- */
  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.06);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* ---- TRANSICIONES ---- */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);

  /* ---- Z-INDEX ---- */
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   500;
  --z-sidebar:   600;
  --z-header:    700;
  --z-backdrop:  800;
  --z-modal:     900;
  --z-toast:     1000;
}

/* ============================================================
 * DARK THEME
 * ============================================================ */
[data-theme="dark"] {
  /* Superficies oscuras (marino DisruptIA) */
  --bg:            #0b1728;
  --bg-alt:        #0e1d33;
  --bg-card:       #12233c;
  --bg-elevated:   #162a47;
  --bg-gradient:   #0b1728;

  /* Texto oscuro */
  --text:           #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  /* Bordes oscuros */
  --border:        #1f3150;
  --border-light:  #172740;
  --border-strong: #2c4268;

  /* Sombras oscuras (más intensas) */
  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.6);

  /* Acentos semánticos oscuros */
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-success-fg: #6ee7b7;
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-warning-fg: #fbbf24;
  --color-danger-bg:  rgba(239, 68, 68, 0.15);
  --color-danger-fg:  #fca5a5;
  --color-info-bg:    rgba(59, 130, 246, 0.15);
  --color-info-fg:    #93c5fd;

  /* Acento primario en oscuro */
  --color-accent-soft: rgba(255, 106, 0, 0.16);
  --color-accent-subtle: rgba(255, 106, 0, 0.09);

  /* --color-primary-50 (durazno claro) no tiene override acá y
     queda fijo en su valor claro — se usa como --ui-bg-alt (hover/activo
     de window.UI en toda la app: botones ghost, tabs de Configuración,
     filas de tabla) y como fondo de chips. Sin este override, cualquier
     estado hover/activo se ve como un parche claro sin contraste sobre
     fondo oscuro. */
  --color-primary-50: rgba(255, 106, 0, 0.15);
}

/* ============================================================
 * LEGACY VARIABLES — compatibilidad con código existente
 * Mapeo de variables antiguas a las nuevas.
 * ============================================================ */
:root {
  --ui-bg: var(--bg-card);
  --ui-bg-alt: var(--color-primary-50);
  --ui-border: var(--border);
  --ui-border-strong: var(--border-strong);
  --ui-text: var(--text);
  --ui-muted: var(--text-secondary);
  --ui-accent: var(--color-accent);
  --ui-accent-fg: var(--brand-on-orange);
  --ui-danger: var(--color-danger);
  --ui-success: var(--color-success);
  --ui-warning: var(--color-warning);
  --ui-info: var(--color-info);
  --ui-radius: var(--radius-lg);
  --ui-radius-sm: var(--radius-md);
  --ui-shadow: var(--shadow-lg);
  --ui-shadow-lg: var(--shadow-xl);

  /* Legacy vars for styles.css landing page compat */
  --accent: var(--color-accent);
  --card: var(--bg-card);
  --muted: var(--text-muted);

  /* Legacy vars for crm.css / dashboard.css compat (2026-08 unificación) */
  --bg-secondary: var(--color-accent-subtle);
  --accent-soft: var(--color-accent-soft);
  --elevation-soft: var(--shadow-md);
  --elevation-strong: var(--shadow-lg);
}

/* ============================================================
 * UTILITY CLASSES
 * ============================================================ */

/* Transición suave al cambiar tema */
*, *::before, *::after {
  transition: background-color var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Gradiente de texto */
.gradient-text {
  background: linear-gradient(90deg, var(--text) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Focus ring accesible */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
