/* ==========================================================================
   DEEP SPACE GLASS — Design System Override
   Inspirado en macOS Architecture & Apple Human Interface Principles
   Solo modifica colores, tipografía, bordes, sombras y efectos glassmorphic.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --dsg-bg: #0b0f17;
  --dsg-sidebar: rgba(13, 18, 29, 0.95);
  --dsg-header: rgba(11, 15, 23, 0.85);
  --dsg-glass: rgba(18, 24, 38, 0.70);
  --dsg-glass-hover: rgba(24, 32, 50, 0.82);
  --dsg-modal: rgba(24, 32, 50, 0.90);
  --dsg-input: rgba(11, 15, 23, 0.60);
  --dsg-primary: #4f5be8;
  --dsg-primary-hover: #5d68f2;
  --dsg-primary-active: #434ec9;
  --dsg-primary-glow: rgba(79, 91, 232, 0.35);
  --dsg-emerald: #10b981;
  --dsg-coral: #ff6358;
  --dsg-destructive: #ff3b30;
  --dsg-border: rgba(255, 255, 255, 0.08);
  --dsg-border-subtle: rgba(255, 255, 255, 0.06);
  --dsg-border-elevated: rgba(255, 255, 255, 0.14);
}

/* 1. Tipografía y Base Global */
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', ui-sans-serif, system-ui, sans-serif !important;
  background-color: var(--dsg-bg) !important;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fondo Deep Space con brillo atmosférico sutil */
main,
main.bg-\[\#0b0f19\],
body.bg-\[\#0b0f19\] {
  background-color: var(--dsg-bg) !important;
  background-image:
    radial-gradient(ellipse 75% 45% at 50% -5%, rgba(79, 91, 232, 0.11), transparent 65%),
    radial-gradient(ellipse 50% 35% at 85% 95%, rgba(16, 185, 129, 0.04), transparent 60%) !important;
}

/* Fondo Login Deep Space */
.bg-animated-gradient {
  background: radial-gradient(circle at 50% 25%, rgba(79, 91, 232, 0.22), transparent 55%),
              linear-gradient(-45deg, #0b0f17, #121826, #181c36, #0b0f17) !important;
  background-size: 200% 200% !important;
}

/* Tracking proporcional y figuras tabulares */
h1, h2, h3,
.metric-display,
#incidencias-hero-score {
  letter-spacing: -0.02em;
}

table,
.font-mono,
#reloj-tiempo-real,
#incidencias-hero-score,
[class*="tabular-nums"] {
  font-variant-numeric: tabular-nums;
}

[class*="text-[10px]"],
[class*="text-[11px]"],
.text-xs {
  letter-spacing: 0.015em;
}

/* 2. Sidebar Navigation Surface */
aside#sidebar {
  background: var(--dsg-sidebar) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
}

aside#sidebar > div:first-child,
aside#sidebar > div:last-child {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

aside#sidebar nav a,
aside#sidebar nav button {
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Item Activo del Sidebar con indicador óptico izquierdo */
aside#sidebar nav a[class*="bg-brand"],
aside#sidebar nav a[class*="bg-indigo-600/20"],
aside#sidebar nav a[class*="bg-indigo-500/15"] {
  position: relative;
  background: rgba(79, 91, 232, 0.14) !important;
  color: #ffffff !important;
  border: 1px solid rgba(79, 91, 232, 0.28) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.10), 0 4px 14px rgba(79, 91, 232, 0.14);
}

aside#sidebar nav a[class*="bg-brand"]::before,
aside#sidebar nav a[class*="bg-indigo-600/20"]::before,
aside#sidebar nav a[class*="bg-indigo-500/15"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--dsg-primary);
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(79, 91, 232, 0.85);
}

aside#sidebar nav a[class*="bg-brand"] svg,
aside#sidebar nav a[class*="bg-indigo-600/20"] svg,
aside#sidebar nav a[class*="bg-indigo-500/15"] svg {
  color: var(--dsg-primary) !important;
}

/* 3. Header Navigation Bar */
header {
  background: var(--dsg-header) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

/* 4. Tier 1: Glassmorphic Cards & Panels */
.bg-slate-900,
.bg-slate-900\/95,
.bg-slate-900\/90,
.bg-slate-900\/80,
.bg-slate-900\/70,
.bg-slate-900\/60,
.bg-slate-900\/50,
.bg-slate-900\/40,
.bg-\[\#111827\],
.bg-\[\#0f172a\] {
  background-color: var(--dsg-glass) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: var(--dsg-border) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.10), 0 4px 20px -2px rgba(0, 0, 0, 0.45);
}

/* Sub-paneles oscuros internos (Tier 0/1 recessed) */
.bg-slate-950\/90,
.bg-slate-950\/80,
.bg-slate-950\/70,
.bg-slate-950\/60,
.bg-slate-950\/50,
.bg-slate-950\/40 {
  background-color: rgba(11, 15, 23, 0.65) !important;
  border-color: var(--dsg-border-subtle) !important;
}

/* 5. Tier 2: Interactive & Hovered Tiles */
.colab-visual-card:hover,
[onclick].bg-slate-900\/80:hover,
a.bg-slate-900\/80:hover,
.group.bg-slate-900\/80:hover {
  background-color: var(--dsg-glass-hover) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.14), 0 12px 32px -4px rgba(0, 0, 0, 0.60) !important;
}

/* 6. Tier 3: Elevated Modals & Overlays */
[id*="modal"] > div[class*="bg-slate-900"],
[id*="Modal"] > div[class*="bg-slate-900"],
[id*="modal"] > div > div[class*="bg-slate-900"],
[id*="Modal"] > div > div[class*="bg-slate-900"],
.fixed.inset-0 [class*="bg-slate-900"],
.fixed.inset-0 [class*="bg-slate-950"][class*="rounded-"] {
  background-color: var(--dsg-modal) !important;
  backdrop-filter: blur(32px) !important;
  -webkit-backdrop-filter: blur(32px) !important;
  border-color: var(--dsg-border-elevated) !important;
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.75), inset 0 1px 0 0 rgba(255, 255, 255, 0.12) !important;
}

.fixed.inset-0[class*="bg-slate-950"],
.fixed.inset-0[class*="bg-black"] {
  background-color: rgba(5, 8, 15, 0.72) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

/* 7. Primary & Secondary Buttons */
button.bg-brand,
a.bg-brand,
button.bg-indigo-600,
a.bg-indigo-600 {
  background-color: var(--dsg-primary) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px var(--dsg-primary-glow) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

button.bg-brand:hover,
a.bg-brand:hover,
button.bg-indigo-600:hover,
a.bg-indigo-600:hover {
  background-color: var(--dsg-primary-hover) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30), 0 6px 20px rgba(79, 91, 232, 0.50) !important;
}

button.bg-brand:active,
a.bg-brand:active,
button.bg-indigo-600:active,
a.bg-indigo-600:active {
  background-color: var(--dsg-primary-active) !important;
}

button.bg-slate-800,
a.bg-slate-800,
button.bg-slate-800\/80 {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  transition: all 0.2s ease;
}

button.bg-slate-800:hover,
a.bg-slate-800:hover,
button.bg-slate-800\/80:hover {
  background-color: rgba(255, 255, 255, 0.10) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

/* 8. Inputs, Selects & Textareas */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select,
textarea {
  background-color: var(--dsg-input) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #475569 !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  border-color: var(--dsg-primary) !important;
  box-shadow: 0 0 0 3px rgba(79, 91, 232, 0.25) !important;
  outline: none !important;
}

/* 9. Segmented Controls & Pill Selectors */
#incidencias-collab-pills {
  background: rgba(11, 15, 23, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* 10. Tablas */
table thead,
table thead tr {
  background-color: rgba(11, 15, 23, 0.55) !important;
  color: #94a3b8 !important;
}

table tbody tr {
  border-color: var(--dsg-border-subtle) !important;
  transition: background-color 0.15s ease;
}

table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* 11. Refinamiento global de bordes */
.border-slate-800,
.border-slate-800\/80,
.border-slate-800\/60,
.border-slate-700,
.border-slate-700\/50 {
  border-color: var(--dsg-border) !important;
}

.divide-slate-800 > :not([hidden]) ~ :not([hidden]),
.divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--dsg-border-subtle) !important;
}

/* 12. Scrollbar estilo macOS */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 91, 232, 0.55);
}
