/* ═══════════════════════════════════════════════════════════════════════════
   ETHOS MEDIA — DESIGN SYSTEM
   Official Brand Kit V1.0 · Mayo 2026
   ═══════════════════════════════════════════════════════════════════════════

   Uso rápido:
     Botones:   <button class="btn btn-primary">Guardar</button>
                <button class="btn btn-ghost btn-sm">Cancelar</button>
     Inputs:    <input class="input" type="text" placeholder="..." />
     Labels:    <label class="label">Nombre</label>
     Cards:     <div class="card">...</div>
     Badges:    <span class="badge badge-success">Activo</span>

   Variables disponibles (usa var(--nombre)):
     --bg, --bg-elevated, --bg-hover
     --border, --border-strong
     --text, --text-muted, --text-dim
     --primary, --primary-hover, --primary-alpha
     --success, --warning, --danger, --info
     --radius-sm, --radius, --radius-lg, --radius-xl
     --space-1 ... --space-12
     --shadow-sm, --shadow, --shadow-lg
     --font-sans, --font-mono
     --text-xs ... --text-3xl
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@600;700&family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&family=Noto+Serif+Display:wght@400&display=swap');

:root {
  /* ── Colors · Backgrounds ── */
  --bg:           #0a0a0a;  /* Black Base */
  --bg-elevated:  #111111;  /* Black Elevated */
  --bg-hover:     #161616;  /* Black Hover */
  --bg-sunken:    #050505;  /* Black Sunken */

  /* ── Colors · Borders ── */
  --border:        #1a1a1a; /* bordes sutiles */
  --border-strong: #2a2a2a; /* inputs, separadores visibles */
  --border-focus:  #151129; /* Indigo Deep */

  /* ── Colors · Text ── */
  --text:       #e8e6e0;   /* texto principal */
  --text-muted: #888888;   /* secundario */
  --text-dim:   #555555;   /* labels, hints */
  --text-faint: #333333;   /* placeholders */

  /* ── Colors · Brand ── */
  --primary:        #8f7cff;
  --primary-hover:  #a599ff;
  --primary-active: #745fed;
  --primary-alpha:  rgba(143, 124, 255, 0.16);
  --primary-glow:   rgba(143, 124, 255, 0.38);
  --accent-soft:    #d8d3ff;

  /* ── Colors · Semantic ── */
  --success:        #22c55e;
  --success-alpha:  rgba(34, 197, 94, 0.1);
  --warning:        #f59e0b;
  --warning-alpha:  rgba(245, 158, 11, 0.1);
  --danger:         #ef4444;
  --danger-hover:   #dc2626;
  --danger-alpha:   rgba(239, 68, 68, 0.1);
  --info:           #3b82f6;
  --info-alpha:     rgba(59, 130, 246, 0.1);

  /* ── Typography · Families ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Noto Serif Display', 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --font-wordmark: 'Archivo', 'Inter', sans-serif;

  /* ── Typography · Sizes (6-step scale) ── */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13px;
  --text-md:   14px;
  --text-lg:   16px;
  --text-xl:   20px;
  --text-2xl:  28px;
  --text-3xl:  36px;

  /* ── Typography · Weights ── */
  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* ── Typography · Line heights ── */
  --leading-tight:   1.2;
  --leading-normal:  1.5;
  --leading-relaxed: 1.7;

  /* ── Spacing (4-based scale) ── */
  --space-0:  0;
  --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;

  /* ── Radius ── */
  --radius-sm: 6px;   /* inputs, small buttons */
  --radius:    8px;   /* buttons, cards */
  --radius-lg: 12px;  /* modales, paneles */
  --radius-xl: 16px;  /* hero cards */
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 0 3px var(--primary-glow);

  /* ── Transitions ── */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition:      180ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Z-index scale ── */
  --z-dropdown: 100;
  --z-modal:    1000;
  --z-toast:    2000;
  --z-tooltip:  3000;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

/* Mono for numbers & code */
.mono, code, pre, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 600ms linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Variants */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--primary-alpha);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--primary-alpha);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger-alpha);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.18); border-color: var(--danger); }

.btn-success {
  background: var(--success-alpha);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
}
.btn-success:hover:not(:disabled) { background: rgba(34, 197, 94, 0.18); border-color: var(--success); }

/* Sizes */
.btn-sm { font-size: var(--text-sm); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.btn-lg { font-size: var(--text-md); padding: var(--space-4) var(--space-6); }
.btn-icon { padding: var(--space-2); width: 32px; height: 32px; }

/* ═══════════════════════════════════════════════════════════════════════════
   INPUTS · SELECTS · TEXTAREAS
   ═══════════════════════════════════════════════════════════════════════════ */

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-3);
  line-height: 1.4;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-faint); }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input.error,
.textarea.error,
.select.error { border-color: var(--danger); }
.input.error:focus { box-shadow: 0 0 0 3px var(--danger-alpha); }

.textarea { resize: vertical; min-height: 72px; line-height: var(--leading-normal); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23888'><path d='M5 8l5 5 5-5H5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: var(--space-8);
}

/* Label + field group */
.field { margin-bottom: var(--space-4); }
.label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}
.hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-top: var(--space-1);
}
.error-msg {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--space-1);
}

/* Checkbox & radio */
.checkbox, .radio {
  accent-color: var(--primary);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.card-hover { transition: all var(--transition-fast); cursor: pointer; }
.card-hover:hover { border-color: var(--border-strong); background: var(--bg-hover); }

.card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin: 0 0 var(--space-1) 0;
}
.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-primary { background: var(--primary-alpha); color: var(--primary); border-color: rgba(99, 102, 241, 0.25); }
.badge-success { background: var(--success-alpha); color: var(--success); border-color: rgba(34, 197, 94, 0.25); }
.badge-warning { background: var(--warning-alpha); color: var(--warning); border-color: rgba(245, 158, 11, 0.25); }
.badge-danger  { background: var(--danger-alpha);  color: var(--danger);  border-color: rgba(239, 68, 68, 0.25); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal-overlay.open { display: flex; animation: modal-fade 150ms ease-out; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-slide 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-slide { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
}

.modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all var(--transition);
  max-width: 360px;
}
.toast.show { opacity: 1; transform: none; pointer-events: all; }
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  background: var(--bg-sunken);
  color: var(--text-dim);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tbody tr:hover td { background: var(--bg-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md   { font-size: var(--text-md); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }

.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Scrollbar sutil */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Focus ring — per-component, no global outline (evita efecto doble-caja en buttons pequeños) */
