/* ============================================================
   base.css — Sistema visual compartido (reserva pública + panel)

   Los valores por defecto de los tokens coinciden con THEME en config.js.
   Al cargar, el JS pisa estas variables con lo que venga de /api/config,
   así un cliente nuevo se re-pinta cambiando config.js y nada más.
   Mobile-first: todo se diseña para 360px de ancho y se ensancha después.
   ============================================================ */

:root {
  --bg: #0f0f10;
  --surface: #1a1a1d;
  --surface-2: #232327;
  --border: #2c2c31;
  --text: #f2f2f0;
  --muted: #9a9a96;
  --accent: #c8a24a;
  --accent-text: #101010;
  --accent-soft: rgba(200, 162, 74, 0.14);
  --ok: #3fa66a;
  --err: #d05a4e;
  --warn: #d9a441;
  --radius: 14px;
  --radius-sm: 9px;
  --font-heading: 'Bebas Neue', 'Oswald', Impact, 'Arial Narrow', sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --tap: 48px;                 /* alto mínimo de cualquier cosa que se toca */
  --page-max: 560px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ── Tipografía ─────────────────────────────────────────── */
h1, h2, h3 { margin: 0; font-family: var(--font-heading); font-weight: 400; letter-spacing: 0.02em; line-height: 1; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.3rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.strong { font-weight: 600; }
.upper { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Layout ─────────────────────────────────────────────── */
.page { max-width: var(--page-max); margin: 0 auto; padding: 16px 16px 96px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* ── Marca (logo tipográfico) ───────────────────────────── */
.brand { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.brand-name { font-family: var(--font-heading); font-size: 2.6rem; letter-spacing: 0.06em; color: var(--text); }
.brand-name .dot { color: var(--accent); }
.brand-sub { font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.brand-compact .brand-name { font-size: 1.6rem; }
.brand-compact .brand-sub { font-size: 0.58rem; letter-spacing: 0.18em; margin-top: 2px; }

/* ── Tarjetas ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-tap { cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.08s; -webkit-tap-highlight-color: transparent; }
.card-tap:active { transform: scale(0.99); }
.card-tap:hover { border-color: #3a3a40; }
.card-tap.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.card-flat { background: transparent; border: 1px dashed var(--border); }

/* ── Botones ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.08s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { text-decoration: none; border-color: #3a3a40; }
.btn:active { transform: scale(0.985); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: #d4ad55; border-color: #d4ad55; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(208, 90, 78, 0.5); color: #e57d72; }
.btn-danger:hover { background: rgba(208, 90, 78, 0.1); border-color: var(--err); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 0.875rem; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-icon { width: var(--tap); padding: 0; }

/* Barra fija abajo con el botón principal (pulgar) */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.sticky-bar-inner { max-width: var(--page-max); margin: 0 auto; }

/* ── Chips (horarios, filtros) ──────────────────────────── */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.chip {
  min-height: var(--tap); padding: 0 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: #3a3a40; }
.chip:active { transform: scale(0.97); }
.chip.is-selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }

/* ── Tira de días (scroll horizontal) ───────────────────── */
.day-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.day-strip::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 64px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 76px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s;
}
.day-wd { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.day-num { font-family: var(--font-heading); font-size: 1.6rem; line-height: 1; }
.day-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-top: 2px; }
.day.is-closed { opacity: 0.35; cursor: not-allowed; }
.day.is-closed .day-dot { background: transparent; }
.day.is-full .day-dot { background: var(--muted); }
.day.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.day.is-selected .day-num { color: var(--accent); }

/* ── Formularios ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.875rem; color: var(--muted); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--err); }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.field .error { font-size: 0.8rem; color: #e57d72; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Interruptor (toggle) para el panel */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 26px; background: var(--border); transition: background 0.15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ── Avisos ─────────────────────────────────────────────── */
.banner { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-size: 0.925rem; }
.banner-info { border-color: rgba(200, 162, 74, 0.45); background: var(--accent-soft); }
.banner-warn { border-color: rgba(217, 164, 65, 0.5); background: rgba(217, 164, 65, 0.1); }
.banner-err { border-color: rgba(208, 90, 78, 0.5); background: rgba(208, 90, 78, 0.1); }
.banner-ok { border-color: rgba(63, 166, 106, 0.5); background: rgba(63, 166, 106, 0.1); }

/* Toast (mensaje flotante) */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px);
  max-width: min(92vw, 420px); padding: 12px 16px; border-radius: var(--radius-sm);
  background: #26262b; border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 0.925rem; z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-err { border-color: rgba(208, 90, 78, 0.6); }
.toast-ok { border-color: rgba(63, 166, 106, 0.6); }

/* ── Pasos (progreso de la reserva) ─────────────────────── */
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 3px; border-radius: 3px; background: var(--border); }
.steps span.is-done { background: var(--accent); }

/* ── Estados de carga ───────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); min-height: 48px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Listas / separadores ───────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
.pill-ok { color: #6fcf97; border-color: rgba(63, 166, 106, 0.4); }
.pill-err { color: #e57d72; border-color: rgba(208, 90, 78, 0.4); }
.pill-warn { color: #e6b95a; border-color: rgba(217, 164, 65, 0.4); }
.pill-muted { color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ── Movimiento ─────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Escritorio ─────────────────────────────────────────── */
@media (min-width: 720px) {
  .page { padding-top: 32px; }
  h1 { font-size: 2.8rem; }
}
