/* ═══════════════════════════════════════════════════════════════
   EUONTECH · Design System — "Glass"
   Inspirado en Apple HIG + Linear + Vercel
   Versión 1.0 · 2026
   ═══════════════════════════════════════════════════════════════ */

/* ─── Tipografía ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── Tokens ─── */
:root {
  /* Neutrales — escala de grises con un toque frío */
  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --gray-950: #0c0c0e;

  /* Superficie — modo oscuro */
  --bg:          #09090b;
  --bg-subtle:   #111113;
  --surface:     #18181b;
  --surface-2:   #1f1f23;
  --surface-3:   #27272a;
  --border:      rgba(255,255,255,.06);
  --border-hover:rgba(255,255,255,.12);
  --border-focus:rgba(255,255,255,.20);

  /* Acento — blanco puro + un acento sutil */
  --accent:      #ffffff;
  --accent-muted:#a1a1aa;
  --accent-dim:  #71717a;
  --accent-blue: #3b82f6;
  --accent-green:#22c55e;
  --accent-red:  #ef4444;
  --accent-amber:#f59e0b;

  /* Texto */
  --text:        #fafafa;
  --text-2:      #a1a1aa;
  --text-3:      #71717a;
  --text-4:      #3f3f46;

  /* Glass */
  --glass-bg:    rgba(255,255,255,.03);
  --glass-border:rgba(255,255,255,.06);
  --glass-blur:  20px;

  /* Tipo */
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Espaciado */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radio */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.5);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.6);
  --shadow-glow:0 0 40px rgba(255,255,255,.04);

  /* Transiciones */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --duration: 200ms;

  /* Color primario dinámico (marca.js lo sobreescribe) */
  --color-primario: #ffffff;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  overscroll-behavior: none;
  min-height: 100vh;
}

/* ─── Tipografía ─── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.text-display { font-size: clamp(32px, 6vw, 56px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.text-title   { font-size: clamp(20px, 3.5vw, 28px); font-weight: 700; letter-spacing: -0.02em; }
.text-heading  { font-size: clamp(16px, 2.5vw, 20px); font-weight: 600; }
.text-body    { font-size: 15px; color: var(--text-2); line-height: 1.6; }
.text-caption { font-size: 13px; color: var(--text-3); }
.text-micro   { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.text-mono    { font-family: var(--font-mono); }

/* ─── Superficies Glass ─── */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: var(--space-lg);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.card-glass:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
}

/* ─── Botones ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font);
  font-size: 14px; font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  -webkit-user-select: none; user-select: none;
  min-height: 44px;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.btn-danger {
  background: rgba(239,68,68,.1);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.3); }

.btn-sm { padding: 6px 14px; font-size: 13px; min-height: 36px; }
.btn-lg { padding: 14px 28px; font-size: 16px; min-height: 52px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { width: 44px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 36px; min-height: 36px; }

.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* ─── Inputs ─── */
.input, .select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration) var(--ease);
  min-height: 44px;
}
.input::placeholder { color: var(--text-4); }
.input:focus, .select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}

.field-group { margin-bottom: var(--space-md); }
.field-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-3);
  margin-bottom: 6px;
}

/* ─── Badge/Tag ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-green { background: rgba(34,197,94,.1); color: var(--accent-green); border-color: rgba(34,197,94,.2); }
.badge-red   { background: rgba(239,68,68,.1); color: var(--accent-red); border-color: rgba(239,68,68,.2); }
.badge-amber { background: rgba(245,158,11,.1); color: var(--accent-amber); border-color: rgba(245,158,11,.2); }
.badge-blue  { background: rgba(59,130,246,.1); color: var(--accent-blue); border-color: rgba(59,130,246,.2); }

/* ─── Stat Card ─── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-lg);
}
.stat-card .stat-value {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Separadores ─── */
.divider { border: none; border-top: 1px solid var(--border); margin: var(--space-lg) 0; }

/* ─── Nav / Header ─── */
.navbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: rgba(9,9,11,.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
}
.navbar-brand img { height: 32px; border-radius: var(--radius-sm); }
.navbar-brand span { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }

/* ─── Layout helpers ─── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--space-lg); }
.container-sm { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 var(--space-lg); }
.container-lg { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-md); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pb-2xl { padding-bottom: var(--space-2xl); }

.text-center { text-align: center; }
.text-right { text-align: right; }

.w-full { width: 100%; }
.hidden { display: none; }

/* ─── Modal ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: var(--space-md);
}
.modal-overlay.open { display: flex; }

.modal-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  padding: var(--space-xl);
  animation: modalIn .25s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal-sheet {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  animation: sheetIn .3s var(--ease);
}
@keyframes sheetIn { from { transform: translateY(100%); } }
.modal-handle { width: 36px; height: 4px; background: var(--surface-3); border-radius: 2px; margin: 0 auto var(--space-lg); }

/* ─── Toast ─── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 24px; font-size: 14px; font-weight: 500;
  z-index: 200; box-shadow: var(--shadow-lg);
  animation: toastIn .3s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

.toast-success { border-color: rgba(34,197,94,.3); }
.toast-error   { border-color: rgba(239,68,68,.3); }

/* ─── Section header ─── */
.section-header {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}
.section-header h2 {
  font-size: 13px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* ─── Tablas ─── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 16px; text-align: left; background: var(--surface); border-bottom: 1px solid var(--border); }
.table td { font-size: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface); }

/* ─── Empty state ─── */
.empty-state { text-align: center; padding: var(--space-3xl) var(--space-lg); }
.empty-state .icon { font-size: 48px; margin-bottom: var(--space-md); opacity: 0.3; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: var(--space-xs); }
.empty-state p { color: var(--text-3); font-size: 14px; }

/* ─── Scrollbar minimalista ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }

/* ─── Selection ─── */
::selection { background: rgba(255,255,255,.15); }

/* ─── Focus ring accesible ─── */
:focus-visible { outline: 2px solid rgba(255,255,255,.3); outline-offset: 2px; }

/* ─── Animación de entrada ─── */
.fade-in { animation: fadeIn .4s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* ─── Responsive safe area ─── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ─── Impresión ─── */
@media print {
  body > *:not(#zona-impresion) { display: none !important; }
  #zona-impresion { display: block !important; width: 100%; }
  @page { margin: 0; }
}
