/* ==========================================================================
   BASE CSS — Tokens de diseño "Obsidian & Ámbar Reactor" (Dual-Mode) y utilidades
   Proyecto: AI-HUB (CHAT-GROKbot)
   Última actualización: 2026-11-03
   ========================================================================== */

/* --- TOKENS --- */
:root {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-ui: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --amber: #F59E0B;
  --amber-deep: #B45309;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --amber-glow: rgba(245, 158, 11, 0.45);
  --success: #10B981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warning: #F59E0B;
  --info: #3B82F6;
  --info-soft: rgba(59, 130, 246, 0.14);

  --obsidian: #080C14;
  --obsidian-2: #0D1320;
  --obsidian-3: #141D2E;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 160ms;
  --t: 260ms;

  /* Modo claro */
  --bg-canvas: #F3F5F8;
  --bg-card: #FFFFFF;
  --bg-elev: #F8FAFC;
  --bg-input: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px -6px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 60px -18px rgba(15, 23, 42, .35);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg-canvas: #080C14;
  --bg-card: #0F1623;
  --bg-elev: #141D2E;
  --bg-input: #0B111C;
  --ink: #F8FAFC;
  --ink-2: #CBD5E1;
  --muted: #94A3B8;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* --- TIPOGRAFÍA --- */
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.display { font-family: var(--font-display); letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.small { font-size: 12.5px; }

/* --- FORMULARIOS --- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.input:-webkit-autofill, .input:-webkit-autofill:hover, .input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
  caret-color: var(--ink);
  transition: background-color 9999s ease-in-out 0s;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--amber); }

/* --- BOTONES --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  font-weight: 600; font-size: 13px;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:hover { border-color: var(--amber); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, #FBBF24, var(--amber)); color: #1A1204; border-color: transparent; box-shadow: 0 6px 18px -6px var(--amber-glow); }
.btn-primary:hover { box-shadow: 0 10px 24px -8px var(--amber-glow); }
.btn-danger { color: var(--danger); border-color: rgba(239, 68, 68, .35); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-elev); border-color: var(--border); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12px; }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; }

/* --- CHIPS DE ESTADO --- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--bg-elev); color: var(--muted); border: 1px solid var(--border); }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--success); background: var(--success-soft); border-color: transparent; }
.chip-warn { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.chip-bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chip-info { color: var(--info); background: var(--info-soft); border-color: transparent; }

/* --- TOASTS --- */
.toast-stack { position: fixed; z-index: 9999; right: 18px; top: 18px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toastIn var(--t) var(--ease); border-left: 4px solid var(--info); }
.toast.ok { border-left-color: var(--success); }
.toast.bad { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--amber); }
.toast b { display: block; font-size: 13px; }
.toast span { font-size: 12.5px; color: var(--muted); }
.toast.out { animation: toastOut 220ms var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* --- SKELETON --- */
.skel { position: relative; overflow: hidden; background: var(--bg-elev); border-radius: var(--radius-sm); min-height: 14px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 900px) {
  .input, .select, .textarea { font-size: 16px; }
  .toast-stack { left: 12px; right: 12px; top: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

