/* =====================================================================
   Agendar cita (/citas/) y confirmación (/gracias/)
   ===================================================================== */

.booking-hero {
  padding-block: clamp(36px, 5vw, 64px) clamp(32px, 4vw, 52px);
}

.booking-section {
  padding-top: clamp(28px, 4vw, 48px);
}

.booking {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas:
    "stepper stepper"
    "panels summary";
  gap: 24px clamp(24px, 4vw, 48px);
  align-items: start;
}

/* ---------------------------------------------------------------------
   Pasos
   --------------------------------------------------------------------- */
.stepper {
  grid-area: stepper;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper li {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-faint);
}

.stepper-dot {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--beige-100);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.stepper-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stepper li[aria-current="step"] {
  border-color: var(--rose-300);
  background: var(--blush-50);
  color: var(--rose-700);
}

.stepper li[aria-current="step"] .stepper-dot {
  background: var(--rose-600);
  color: var(--white);
}

.stepper li.is-done {
  color: var(--sage-700);
}

.stepper li.is-done .stepper-dot {
  background: var(--sage-100);
  color: var(--sage-700);
}

@media (max-width: 760px) {
  .stepper li {
    flex: 0 0 auto;
    padding: 5px;
  }

  .stepper li .stepper-label {
    display: none;
  }

  .stepper li[aria-current="step"] {
    flex: 1;
    padding-right: 14px;
  }

  .stepper li[aria-current="step"] .stepper-label {
    display: inline;
  }
}

/* ---------------------------------------------------------------------
   Resumen de la selección
   --------------------------------------------------------------------- */
.booking-summary {
  grid-area: summary;
  position: sticky;
  top: calc(var(--header-height) + 20px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.summary-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

.summary-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.summary-row {
  display: grid;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}

.summary-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.summary-row dt {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.summary-row dd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}

.summary-empty {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-faint);
}

.summary-change {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--rose-700);
  font: 600 0.85rem var(--font-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.summary-help {
  margin: 18px 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.summary-urgent {
  margin: 12px 0 0;
  font-size: 0.84rem;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------------
   Paneles
   --------------------------------------------------------------------- */
.booking-panels {
  grid-area: panels;
  min-width: 0;
}

.booking-panel {
  position: relative;
  padding: clamp(22px, 3.5vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.booking-panel h2 {
  margin-bottom: 0.3em;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  outline: none;
}

.panel-intro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--ink-soft);
}

.panel-intro .icon {
  color: var(--sage-600);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.panel-actions .btn .icon {
  width: 1.05em;
  height: 1.05em;
}

.booking-panel .notice {
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .booking {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stepper"
      "summary"
      "panels";
  }

  .booking-summary {
    position: static;
    padding: 16px 18px;
  }

  .booking-summary.is-empty {
    display: none;
  }

  .summary-title {
    margin-bottom: 10px;
    font-size: 1.15rem;
  }

  .summary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
  }

  .summary-row {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .summary-help,
  .summary-urgent {
    display: none;
  }
}

/* ---------------------------------------------------------------------
   Opciones (servicios y especialistas)
   --------------------------------------------------------------------- */
.choice-groups {
  display: grid;
  gap: 28px;
}

.choice-group-title {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mauve-600);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 18px 18px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.choice-card:hover {
  border-color: var(--rose-300);
  background: var(--blush-50);
}

.choice-card[aria-pressed="true"] {
  border-color: var(--rose-600);
  background: var(--blush-50);
  box-shadow: 0 0 0 3px rgba(156, 72, 98, 0.12);
}

.choice-card.is-loading {
  cursor: progress;
  opacity: 0.6;
}

.choice-title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
}

.choice-text {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.choice-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--ink-faint);
}

.choice-meta .icon {
  width: 1em;
  height: 1em;
}

.doctor-choice {
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.choice-avatar {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--blush-100), var(--mauve-100));
}

.choice-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
}

.choice-avatar .monogram {
  font-size: 1.45rem;
  color: var(--rose-700);
}

.choice-avatar.is-missing img {
  display: none;
}

.choice-avatar.is-missing .monogram {
  display: grid;
}

.choice-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* ---------------------------------------------------------------------
   Calendario
   --------------------------------------------------------------------- */
.calendar {
  max-width: 470px;
}

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

.calendar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  text-transform: capitalize;
}

.calendar-nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}

.calendar-nav:hover:not(:disabled) {
  border-color: var(--rose-300);
  color: var(--rose-700);
}

.calendar-nav:disabled {
  cursor: default;
  opacity: 0.35;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  padding-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink-faint);
}

.calendar-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-faint);
  font: 500 0.98rem var(--font-body);
}

.calendar-day:disabled {
  cursor: default;
  opacity: 0.5;
}

.calendar-day.is-available {
  border-color: var(--blush-200);
  background: var(--blush-50);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.calendar-day.is-available:hover {
  border-color: var(--rose-500);
  background: var(--blush-100);
}

.calendar-day.is-today {
  box-shadow: inset 0 -3px 0 var(--gold-400);
}

.calendar-day[aria-pressed="true"] {
  border-color: var(--rose-600);
  background: var(--rose-600);
  color: var(--white);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 1px solid var(--blush-200);
  border-radius: 4px;
  background: var(--blush-50);
  vertical-align: -2px;
}

.legend-swatch.today {
  border: 0;
  background: none;
  box-shadow: inset 0 -3px 0 var(--gold-400);
}

.calendar-empty {
  margin: 14px 0 0;
  font-size: 0.94rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------
   Horarios
   --------------------------------------------------------------------- */
.slot-group + .slot-group {
  margin-top: 22px;
}

.slot-group-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mauve-600);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.slot-chip {
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 0.98rem var(--font-body);
  cursor: pointer;
}

.slot-chip:hover {
  border-color: var(--rose-300);
  background: var(--blush-50);
}

.slot-chip[aria-pressed="true"] {
  border-color: var(--rose-600);
  background: var(--rose-600);
  color: var(--white);
}

/* ---------------------------------------------------------------------
   Estados de carga, vacío y error
   --------------------------------------------------------------------- */
.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--blush-50), var(--beige-100), var(--blush-50));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-card {
  height: 96px;
}

.skeleton-chip {
  height: 48px;
  border-radius: 999px;
}

.skeleton-day {
  aspect-ratio: 1;
  border-radius: 12px;
}

.empty-state {
  padding: 26px 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--beige-50);
  text-align: center;
  color: var(--ink-soft);
}

.empty-state p {
  max-width: 48ch;
  margin: 0 auto 14px;
}

.empty-state p:last-child {
  margin-bottom: 0;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------------------------------------------------------------------
   Formulario
   --------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-full {
  grid-column: 1 / -1;
}

.field > label,
.field > legend {
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.field > legend {
  margin-bottom: 6px;
}

.optional {
  font-weight: 400;
  color: var(--ink-faint);
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="date"],
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--rose-500);
  box-shadow: 0 0 0 4px rgba(156, 72, 98, 0.12);
}

.field [aria-invalid="true"] {
  border-color: #c2566b;
  background: #fffafa;
}

.field-hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-faint);
}

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

.char-count {
  flex: none;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.field-error {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: #a3334c;
}

.field-error:empty {
  display: none;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segmented label {
  position: relative;
  flex: 1;
  min-width: 130px;
}

.segmented input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-weight: 500;
}

.segmented input:checked + span {
  border-color: var(--rose-600);
  background: var(--blush-50);
  color: var(--rose-700);
  font-weight: 600;
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--rose-300);
  outline-offset: 2px;
}

.segmented[aria-invalid="true"] span {
  border-color: #c2566b;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
}

.checkbox input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--rose-600);
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-note {
  margin: 22px 0 0;
  font-size: 0.93rem;
  color: var(--ink-soft);
}

.booking-form .notice {
  margin: 20px 0 0;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-actions .btn {
    flex: 1;
  }
}

/* ---------------------------------------------------------------------
   Gracias
   --------------------------------------------------------------------- */
.thanks {
  background:
    radial-gradient(900px 420px at 90% 0%, rgba(241, 214, 211, 0.7), transparent 62%),
    radial-gradient(700px 380px at 0% 100%, rgba(231, 239, 234, 0.9), transparent 62%),
    var(--beige-50);
}

.thanks-card {
  max-width: 680px;
  margin-inline: auto;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.thanks-card h1 {
  margin-inline: auto;
  font-size: clamp(2rem, 4.4vw, 2.9rem);
}

.thanks-card .lead {
  margin-inline: auto;
}

.thanks-card .eyebrow {
  justify-content: center;
}

.thanks-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--sage-100);
  color: var(--sage-700);
}

.thanks-icon .icon {
  width: 34px;
  height: 34px;
  stroke-width: 2;
}

.thanks-summary {
  display: grid;
  gap: 12px;
  margin: 28px 0;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--blush-50);
  text-align: left;
}

.thanks-summary div {
  display: grid;
  gap: 2px;
}

.thanks-summary dt {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.thanks-summary dd {
  margin: 0;
  font-weight: 500;
  color: var(--ink);
}

.thanks-card .notice {
  margin-top: 24px;
  text-align: left;
}

.thanks-card .hero-actions {
  justify-content: center;
  margin-bottom: 0;
}

/* Tipo de consulta en el paso 1: la primera visita ocupa mas tiempo, asi que
   hay que preguntarlo antes de calcular los horarios disponibles. */
.visit-type-choice {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.visit-type-choice legend {
  margin-bottom: 10px;
  padding: 0;
  color: var(--ink);
  font-weight: 600;
}

.visit-type-choice .segmented {
  max-width: 420px;
}

.panel-hint {
  margin: 10px 0 0;
  color: var(--ink-faint);
  font-size: 0.9rem;
}
