/* ============================================================================
   Agendamiento White-Label — hoja de estilos compartida
   Panel (Accelerate Room, oscuro) + Página pública (white-label, tema cliente)
   Tokens y estados de interacción. El layout fino va inline en el JS, igual
   que en el diseño original.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Panel Accelerate Room */
  --bg-0: #0A0A0B;
  --surface-1: #131316;
  --surface-2: #0F0F12;
  --surface-3: #17171B;
  --surface-4: #1A1A1E;
  --surface-5: #1E1E22;
  --fg-0: #F4F4F5;
  --fg-1: #C9C9CE;
  --fg-2: #8E8E96;
  --fg-3: #5C5C64;
  --accent: #E5231B;
  --accent-hover: #C91E17;
  --success: #3E8E63;
  --warning: #C9A03C;

  /* Página pública — defaults NEUTROS (los pisa el tema del cliente, inyectado
     por el Route Handler /agendar/<slug>). Nunca la marca de otro cliente. */
  --pn: #1F2937;   /* primario  */
  --pa: #6B7280;   /* acento    */
  --pbg: #FFFFFF;  /* fondo     */
  --pt: #111827;   /* texto     */
  --pgray: #6B7280;
  --pgray-2: #9CA3AF;

  /* Tokens de contraste DERIVADOS por luminancia (los calcula reservar.js en
     applyTheme a partir de la marca; aquí van defaults neutros por si el JS aún
     no corrió). Regla del proyecto: el texto/ícono se deriva del fondo real,
     nunca es blanco/negro fijo. Ver reservar.js. */
  --surface: #FFFFFF;      /* superficie de la tarjeta */
  --surface-sub: #F5F5F6;  /* superficie sutil (cajas internas) */
  --ink: #14181F;          /* tinta principal legible sobre --surface */
  --ink-soft: rgba(20,24,31,.66);   /* texto secundario */
  --ink-mute: rgba(20,24,31,.42);   /* texto terciario / deshabilitado */
  --line: rgba(20,24,31,.12);       /* bordes/divisores */
  --line-strong: rgba(20,24,31,.26);/* bordes marcados */
  --pn-ink: #FFFFFF;       /* tinta legible SOBRE un relleno --pn */
  --pa-ink: #FFFFFF;       /* tinta legible SOBRE un relleno --pa */
  --accent-ink: #6B7280;   /* acento legible como texto/línea sobre --surface */
  --avail: #1F2937;        /* tinte de "día disponible" */
  --danger: #C0392B;       /* rojo de error legible */
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; }
input, textarea, select, button { font-family: inherit; }

body {
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.panel { background: var(--bg-0); color: var(--fg-0); }
body.public { background: var(--pbg); color: var(--pt); }

.serif { font-family: 'Instrument Serif', Georgia, serif; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.tabular { font-variant-numeric: tabular-nums; }

/* Animaciones del diseño */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.shimmer {
  background: linear-gradient(90deg, #1A1A1E 25%, #242429 50%, #1A1A1E 75%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}
.pulse-dot { animation: pulseDot 1.6s ease-in-out infinite; }

/* ============================================================================
   PANEL — Accelerate Room
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 228px; flex: none; box-sizing: border-box;
  border-right: 1px solid rgba(255,255,255,.07);
  padding: 18px 14px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 1px;
  font: 500 13.5px 'Geist', sans-serif; color: var(--fg-2);
  cursor: pointer; transition: background .12s, color .12s; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.07); }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; flex: none; }
.nav-item.active .nav-dot { background: var(--accent); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 66px; flex: none; box-sizing: border-box;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; padding: 0 28px; gap: 14px;
}

.card {
  background: var(--surface-1); border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
}

/* Botones panel */
.btn {
  font: 600 13px 'Geist', sans-serif; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; transition: background .12s, color .12s, border-color .12s;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; padding: 10px 18px; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--fg-0); border-color: rgba(255,255,255,.16); padding: 10px 18px; }
.btn-secondary:hover { background: rgba(255,255,255,.05); }
.btn-ghost { background: transparent; color: var(--fg-2); padding: 9px 16px; }
.btn-ghost:hover { color: var(--fg-0); background: rgba(255,255,255,.05); }

/* Inputs panel */
.inp {
  box-sizing: border-box; background: var(--bg-0);
  border: 1px solid rgba(255,255,255,.12); border-radius: 9px;
  padding: 11px 13px; font: 400 13px 'Geist', sans-serif; color: var(--fg-0);
  outline: none; transition: border-color .12s, box-shadow .12s; width: 100%;
}
.inp:focus { border-color: rgba(229,35,27,.6); box-shadow: 0 0 0 3px rgba(229,35,27,.14); }
.inp.mono { font-family: ui-monospace, Menlo, monospace; }
.sel-wrap { position: relative; }
.sel-wrap .caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-2); pointer-events: none; }
.sel {
  width: 100%; box-sizing: border-box; appearance: none;
  background: var(--bg-0); border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px; padding: 11px 34px 11px 13px;
  font: 500 13px 'Geist', sans-serif; color: var(--fg-0); outline: none; cursor: pointer;
}

/* fila de tabla hover */
.trow { transition: background .12s; }
.trow:hover { background: rgba(255,255,255,.02); }

/* chips de filtro / segmentos */
.chip, .seg, .estchip { cursor: pointer; transition: all .12s; user-select: none; }

/* toggle switch */
.sw { width: 36px; height: 21px; border-radius: 11px; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.sw .knob { position: absolute; top: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }

/* tarjeta de evento (semana) */
.evt { transition: border-color .12s; }
.evt:hover { border-color: rgba(255,255,255,.28); }

/* regla de distribución */
.rule { transition: all .12s; }

/* enlaces sutiles */
.link-soft { cursor: pointer; transition: color .12s; }
.link-soft:hover { color: var(--fg-0); }
.link-accent { cursor: pointer; transition: color .12s; }
.link-accent:hover { color: var(--accent); }

/* ============================================================================
   PÁGINA PÚBLICA — white-label
   ========================================================================== */
.pub-page { background: var(--pbg); min-height: 100vh; box-sizing: border-box; }

.pub-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 8px 40px rgba(20,39,67,.09); overflow: hidden;
}

/* Día del calendario */
.day {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; box-sizing: border-box; transition: background .12s, transform .08s;
  font-family: 'Geist', sans-serif;
}
.day.avail { cursor: pointer; }
.day.avail:hover { background: color-mix(in srgb, var(--avail) 20%, transparent) !important; }
.day.sel { color: var(--pn-ink); }

/* Chip de hora */
.slot {
  text-align: center; border-radius: 10px; box-sizing: border-box;
  font-family: 'Geist', sans-serif; transition: all .12s;
}
.slot.free { cursor: pointer; }
.slot.free:hover { border-color: var(--accent-ink) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ink) 18%, transparent); }

/* Inputs públicos */
.pub-inp {
  width: 100%; box-sizing: border-box; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px;
  font: 400 14px 'Geist', sans-serif; color: var(--ink); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.pub-inp::placeholder { color: var(--ink-mute); }
.pub-inp:focus { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ink) 22%, transparent); }
textarea.pub-inp { resize: none; }

/* Botón público (tema del cliente) */
.pub-btn {
  background: var(--pn); color: var(--pn-ink); font: 600 14px 'Geist', sans-serif;
  padding: 12px 26px; border-radius: 10px; cursor: pointer; border: none;
  transition: opacity .12s, filter .12s;
}
.pub-btn:hover { filter: brightness(1.08); }
.pub-btn.block { width: 100%; padding: 15px; border-radius: 12px; font-size: 15px; }

.pub-btn-outline {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  font: 600 13px 'Geist', sans-serif; padding: 11px 18px; border-radius: 10px; cursor: pointer;
  transition: background .12s;
}
.pub-btn-outline:hover { background: var(--surface-sub); }

.link-pub { color: var(--accent-ink); cursor: pointer; }

/* ============================================================================
   FORMULARIO DEL LEAD (paso 3) — campos configurables (2.7)

   Todos los colores salen de los tokens que deriva applyTheme() por luminancia
   (--ink, --line, --surface, --accent-ink…). Ni un hex fijo: la regla §6 del
   CLAUDE.md exige que esto se lea con CUALQUIER paleta que elija el cliente,
   clara u oscura.
   ========================================================================== */
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 16px; }
.f-row { display: flex; flex-direction: column; min-width: 0; }
.f-row--full { grid-column: 1 / -1; }

.f-lab {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px;
  font: 600 12.5px 'Geist', sans-serif; color: var(--ink);
}
.f-req { color: var(--danger); font-weight: 700; }
.f-opt-tag {
  font: 400 10.5px 'Geist', sans-serif; color: var(--ink-mute);
  text-transform: lowercase; letter-spacing: .01em;
}

.pub-inp.f-inp--err { border-color: var(--danger); }
.pub-inp.f-inp--err:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }

.f-err {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font: 400 11.5px 'Geist', sans-serif; color: var(--danger);
}
.f-summary {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--danger); border-radius: 10px; padding: 11px 13px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  font: 500 12.5px 'Geist', sans-serif; color: var(--danger);
}

/* Teléfono: indicativo + número. El indicativo se elige (antes estaba fijo
   en +57, que era correcto solo para Colombia). */
.f-tel { display: flex; gap: 8px; }
.f-tel-cc { flex: none; width: 106px; }
.f-tel-cc select { cursor: pointer; }
.f-tel > .pub-inp { flex: 1; min-width: 0; }

/* Opciones (una o varias): filas grandes, cómodas de tocar en móvil. */
.f-opts { display: flex; flex-direction: column; gap: 8px; }
.f-opt {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 13px;
  background: var(--surface); color: var(--ink);
  font: 400 13.5px 'Geist', sans-serif; transition: border-color .12s, background .12s;
}
.f-opt:hover { border-color: var(--accent-ink); }
.f-opt.is-on { border-color: var(--accent-ink); background: color-mix(in srgb, var(--pa) 10%, var(--surface)); }

.f-radio {
  width: 17px; height: 17px; border-radius: 50%; flex: none; box-sizing: border-box;
  border: 1.5px solid var(--line-strong); background: var(--surface);
}
.f-radio.is-on { border: 5px solid var(--pn); }

.f-check {
  width: 17px; height: 17px; border-radius: 5px; flex: none; box-sizing: border-box;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.f-check.is-on { background: var(--pn); color: var(--pn-ink); border-color: var(--pn); }

.f-consent {
  display: flex; align-items: center; gap: 9px; margin-top: 16px; cursor: pointer;
  font: 400 12.5px 'Geist', sans-serif; color: var(--ink-soft);
}

/* ============================================================================
   TOAST
   ========================================================================== */
.toast-layer {
  position: fixed; right: 22px; bottom: 22px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-3); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  font: 500 12.5px 'Geist', sans-serif; color: var(--fg-0);
  animation: toastIn .22s ease both; max-width: 340px;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--success); }
.toast.public { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 12px 30px rgba(20,39,67,.18); }

/* ============================================================================
   RESPONSIVE
   ========================================================================== */
.only-mobile { display: none; }

@media (max-width: 900px) {
  /* Panel: la app es de escritorio; permitimos scroll horizontal en el área
     de trabajo para no romper las tablas/calendario. */
  .panel-scroll { overflow-x: auto; }
}

@media (max-width: 760px) {
  .pub-split { flex-direction: column !important; }
  .pub-aside { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--line); }
  .pub-outer { padding: 20px 14px !important; }
  .pub-inner { min-height: 0 !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .f-grid { grid-template-columns: 1fr !important; }
  .hide-sm { display: none !important; }
  .only-mobile { display: block; }
  .cal-grid { grid-template-columns: repeat(7, 1fr) !important; }
  .toast-layer { left: 14px; right: 14px; align-items: stretch; }
  .toast { max-width: none; }
}

/* Barra de scroll sutil en el panel */
.panel ::-webkit-scrollbar { width: 10px; height: 10px; }
.panel ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; border: 2px solid var(--bg-0); }
.panel ::-webkit-scrollbar-track { background: transparent; }
