/* ============================================================
   GesHoy — base.css
   Tokens, reset y componentes compartidos (landing + auth + app)
   ============================================================ */

:root {
  /* Marca */
  --brand-sky: #38BDF8;
  --brand-indigo: #6366F1;
  --brand-gradient: linear-gradient(135deg, #38BDF8, #6366F1);

  /* Acción */
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-soft: #EEF2FF;
  --primary-soft-text: #4338CA;

  /* Neutrales */
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #475569;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-soft: #EEF2F7;
  --bg: #F8FAFC;
  --bg-2: #F1F5F9;
  --card: #FFFFFF;

  /* Navy (landing / sidebar) */
  --navy: #0B1220;
  --navy-2: #0F172A;
  --navy-3: #1E293B;
  --navy-line: #1E293B;
  --navy-text: #E2E8F0;
  --navy-muted: #94A3B8;

  /* Estados */
  --success: #059669;
  --success-soft: #ECFDF5;
  --warning: #B45309;
  --warning-soft: #FFFBEB;
  --danger: #E11D48;
  --danger-soft: #FFF1F2;
  --info: #0369A1;
  --info-soft: #F0F9FF;

  /* Series de gráficos (paleta validada) */
  --chart-1: #4F46E5;
  --chart-2: #0EA5E9;
  --chart-3: #10B981;
  --chart-4: #F59E0B;
  --chart-5: #F43F5E;

  /* Tipografía */
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* Forma */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .14);

  /* Z-scale */
  --z-nav: 30;
  --z-overlay: 40;
  --z-modal: 50;
  --z-toast: 60;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; letter-spacing: -.01em; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.logo .logo-mark { width: 34px; height: 34px; flex: none; }
.logo .logo-hoy { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: .95rem;
  transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s;
  cursor: pointer; white-space: nowrap; border: 1px solid transparent; min-height: 44px;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { border-color: var(--line); color: var(--ink-2); background: var(--card); }
.btn-ghost:hover { border-color: #CBD5E1; background: var(--bg); }
.btn-soft { background: var(--primary-soft); color: var(--primary-soft-text); }
.btn-soft:hover { background: #E0E7FF; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #BE123C; }
.btn-sm { padding: 7px 14px; font-size: .875rem; min-height: 36px; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .7; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .875rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.field .error-msg { display: none; font-size: .8rem; color: var(--danger); margin-top: 5px; font-weight: 500; }
.field.has-error .error-msg { display: block; }
.field.has-error .input { border-color: var(--danger); }

.input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); font-size: .95rem; color: var(--ink);
  transition: border-color .2s, box-shadow .2s; min-height: 44px;
}
.input::placeholder { color: #94A3B8; }
.input:hover { border-color: #CBD5E1; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
textarea.input { min-height: 90px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; cursor: pointer; }

.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 42px; }

.checkbox { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .9rem; color: var(--ink-2); }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; flex: none; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--bg-2); color: var(--ink-3); }
.badge-primary { background: var(--primary-soft); color: var(--primary-soft-text); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: var(--z-modal);
  display: none; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; animation: modalIn .22s ease; margin: auto 0;
}
.modal.modal-lg { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h3 { font-size: 1.15rem; }
.modal-close { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); transition: background-color .2s, color .2s; }
.modal-close:hover { background: var(--bg-2); color: var(--ink); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 24px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 44px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 12px;
  background: var(--navy-2); color: #F1F5F9; box-shadow: var(--shadow-lg); font-size: .9rem;
  animation: toastIn .25s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.toast.success svg { color: #34D399; }
.toast.error svg { color: #FB7185; }
.toast.info svg { color: #38BDF8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.leaving { opacity: 0; transition: opacity .25s; }

/* ---------- Utilidades ---------- */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
