/* ==========================================================================
   OLMED · Reserva pública de citas
   Reutiliza los tokens de styles.css. Wizard de 3 pasos + confirmación.
   ========================================================================== */

.booking-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(45, 212, 191, 0.18), transparent 70%),
    var(--bg);
}

.booking-page .app-bar {
  position: static;
  padding: 14px 20px;
  justify-content: space-between;
  background: transparent;
  border-bottom: 0;
}

.booking-page .brand img {
  height: 64px;
}

.booking-main {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 18px 48px;
}

.booking-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 22px;
}

.booking-head h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 6px 0 10px;
}

.booking-head h1 em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent);
}

.booking-head p {
  color: var(--muted);
}

.booking-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  padding: 26px;
}

/* Pasos ---------------------------------------------------------------- */
.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  counter-reset: step;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.step-bullet {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.step-bullet::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
}

.step-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.step.is-active .step-bullet,
.step.is-done .step-bullet {
  color: var(--accent);
}

.step.is-active .step-bar,
.step.is-done .step-bar {
  background: var(--accent);
}

/* Formularios ---------------------------------------------------------- */
.booking-step h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.booking-step > p.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.is-wide {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  min-height: 46px;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--teal-100);
  border-color: var(--accent);
}

.field small {
  color: var(--muted);
  font-size: 0.76rem;
}

/* Calendario ----------------------------------------------------------- */
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.calendar-head strong {
  text-transform: capitalize;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.calendar-grid .dow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 0;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.86rem;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.cal-day:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cal-day.is-free {
  background: var(--teal-50);
  border-color: var(--accent-line);
}

.cal-day.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.cal-day .dot {
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day.is-selected .dot {
  background: #fff;
}

.cal-day.is-empty {
  visibility: hidden;
}

/* Slots ---------------------------------------------------------------- */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.slot {
  padding: 11px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
}

.slot:hover {
  border-color: var(--accent);
}

.slot.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.slot:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.notice-box {
  border-radius: 14px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink);
  padding: 12px 14px;
  font-size: 0.86rem;
  margin: 14px 0;
}

.notice-box.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

/* Resumen -------------------------------------------------------------- */
.summary {
  display: grid;
  gap: 10px;
  margin: 6px 0 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}

.summary-row span:first-child {
  color: var(--muted);
}

.summary-row strong {
  text-align: right;
}

.booking-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 22px;
  flex-wrap: wrap;
}

.booking-actions .btn {
  min-height: 46px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: #b91c1c;
  color: #fff;
}

.success-panel {
  text-align: center;
  padding: 8px 4px;
}

.success-panel .badge-ok {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--teal-50);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}

.success-panel .badge-ok .icon {
  width: 34px;
  height: 34px;
  stroke-width: 2.4;
}

.code-chip {
  display: inline-block;
  margin: 10px 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.success-lines {
  max-width: 380px;
  margin: 14px auto 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.success-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.success-lines span {
  color: var(--muted);
}

.booking-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.loading-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 12px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Tema oscuro ---------------------------------------------------------- */
:root[data-theme="dark"] .booking-card,
:root[data-theme="dark"] .cal-day,
:root[data-theme="dark"] .slot {
  background: #0f2427;
}

:root[data-theme="dark"] .cal-day.is-free {
  background: #10302f;
}

:root[data-theme="dark"] .notice-box.is-error {
  background: #2b1414;
  border-color: #7f1d1d;
  color: #fecaca;
}

@media (max-width: 620px) {
  .booking-card {
    padding: 20px 16px;
    border-radius: 20px;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .step-bullet span.label {
    display: none;
  }

  .steps {
    gap: 6px;
  }

  .booking-actions .btn {
    flex: 1;
  }
}
