/* =========================================================
   Sistema de diseño — Citas Médicas
   Paleta: verde clínico cálido + acento ámbar
   Tipografía: Fraunces (titulares) + Inter (interfaz)
   ========================================================= */

:root {
  --bg: #F1F4F2;
  --surface: #FFFFFF;
  --ink: #17231F;
  --ink-soft: #4B5D57;
  --teal: #1F5F5B;
  --teal-deep: #12403D;
  --amber: #E2A63B;
  --amber-deep: #B9852A;
  --coral: #C1554A;
  --coral-bg: #FBEAE8;
  --sage: #4F8266;
  --sage-bg: #E8F1EA;
  --line: #DCE3DF;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 35, 31, 0.06), 0 8px 24px rgba(23, 35, 31, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 64px;
}

.topbar {
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.topbar__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar__mark svg { width: 18px; height: 18px; }

.topbar__name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--teal-deep);
}

.card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 40px;
}

@media (max-width: 480px) {
  .card { padding: 28px 22px; }
}

.screen { display: none; }
.screen.is-active { display: block; }

/* ---------- Bienvenida ---------- */

.hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--sage-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}
.hero-icon svg { width: 28px; height: 28px; color: var(--teal); }

h1.display {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 14px;
}

.lede {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 32px;
}

.hint-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hint-list li {
  display: flex;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  align-items: flex-start;
}
.hint-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  margin-top: 7px;
  flex-shrink: 0;
}

.disclaimer {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 28px;
}

/* ---------- Botones ---------- */

.btn {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-primary:disabled {
  background: var(--line);
  color: var(--ink-soft);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--teal-deep);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--teal); }

.btn-block { width: 100%; }

/* ---------- Progreso (línea tipo "pulso") ---------- */

.progress {
  margin-bottom: 28px;
}
.progress__label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.progress__track {
  position: relative;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.progress__fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--sage), var(--teal));
  border-radius: 4px;
  transition: width 0.35s ease;
}

/* ---------- Preguntas ---------- */

.question__text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 24px;
  color: var(--ink);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: left;
}
.option:hover { border-color: var(--teal); }
.option.is-selected {
  border-color: var(--teal);
  background: var(--sage-bg);
}
.option__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
  position: relative;
}
.option.is-selected .option__dot { border-color: var(--teal); }
.option.is-selected .option__dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--teal);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Resultado ---------- */

.result-eyebrow {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.result-specialty {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--teal-deep);
  margin: 0 0 12px;
}

.result-desc {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.urgent-banner {
  display: none;
  gap: 10px;
  background: var(--coral-bg);
  border: 1px solid var(--coral);
  color: #7A2E27;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 24px;
  align-items: flex-start;
}
.urgent-banner.is-visible { display: flex; }
.urgent-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--coral); }

.override {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 4px;
}
.override__toggle {
  background: none;
  border: none;
  color: var(--teal-deep);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.override__panel {
  display: none;
  margin-top: 16px;
}
.override__panel.is-visible { display: block; }

select.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  margin-bottom: 16px;
}

.actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loading, .error-box {
  text-align: center;
  padding: 40px 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.error-box { color: var(--coral); }

/* ---------- Calendario (MVP 2) ---------- */

.card-wide { max-width: 760px; }

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

#calendar {
  --fc-border-color: var(--line);
  --fc-today-bg-color: var(--sage-bg);
  --fc-button-bg-color: var(--surface);
  --fc-button-border-color: var(--line);
  --fc-button-text-color: var(--ink);
  --fc-button-hover-bg-color: var(--bg);
  --fc-button-active-bg-color: var(--teal);
  --fc-button-active-border-color: var(--teal);
  --fc-neutral-bg-color: var(--bg);
  font-family: var(--font-body);
  margin-bottom: 32px;
}

#calendar .fc-toolbar-title {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
}
#calendar .fc-button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  box-shadow: none !important;
  text-transform: capitalize;
}
#calendar .fc-daygrid-day-frame { padding-bottom: 6px; }
#calendar .fc-daygrid-day-number {
  font-size: 13px;
  padding: 6px 8px 0;
}

#calendar .fc-daygrid-day.has-slots { cursor: pointer; }
#calendar .fc-daygrid-day.has-slots:hover .fc-daygrid-day-frame { background: var(--sage-bg); }
#calendar .fc-daygrid-day.full-day .fc-daygrid-day-number { color: var(--ink-soft); }
#calendar .fc-daygrid-day.is-day-selected .fc-daygrid-day-frame {
  background: #DCEFE4;
  box-shadow: inset 0 0 0 2px var(--teal);
}

.dia-badge {
  display: block;
  width: fit-content;
  margin: 3px auto 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--sage-bg);
  color: var(--sage);
}
.full-day .dia-badge {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 500;
}

.turnos-panel {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.turnos-placeholder, .turnos-cargando {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

.turnos-titulo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--ink);
}

/* ---------- Filtro Mañana / Tarde ---------- */

.segmented {
  display: inline-flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}
.segmented button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented button.is-active {
  background: var(--surface);
  color: var(--teal-deep);
  box-shadow: var(--shadow);
}

/* ---------- Turnos agrupados por médico, en chips ---------- */

.turnos-lista {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.medico-grupo__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.medico-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.medico-grupo__nombre {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.medico-grupo__conteo {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: auto;
}

.chips-hora {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-hora {
  font-family: var(--font-body);
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.chip-hora:hover { border-color: var(--teal); }
.chip-hora:active { transform: scale(0.96); }

.chip-hora.is-selected {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.chip-hora--lleno {
  cursor: not-allowed;
  background: var(--bg);
  color: var(--ink-soft);
  text-decoration: line-through;
  opacity: 0.7;
}

/* ---------- Panel flotante de selección ---------- */

.resumen-flotante {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 120%);
  width: calc(100% - 40px);
  max-width: 640px;
  background: var(--teal-deep);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 12px 32px rgba(18, 64, 61, 0.35);
  transition: transform 0.25s ease;
  z-index: 20;
}
.resumen-flotante.is-visible { transform: translate(-50%, 0); }

.resumen-flotante__label { font-weight: 600; margin: 0; font-size: 15px; }
.resumen-flotante__detalle { margin: 2px 0 0; font-size: 13px; color: #CFE3DF; }

.resumen-flotante .btn-primary { background: var(--amber); color: var(--ink); flex-shrink: 0; }
.resumen-flotante .btn-primary:hover { background: var(--amber-deep); }
