/* Flusso di prenotazione: pagina index.html e componente <prenota-tavolo>. Richiede base.css.
   Il layout risponde alla larghezza del contenitore (container query), non dello schermo:
   così il componente diventa "mobile" anche dentro una colonna stretta di un sito desktop. */

.booking-root {
  container: booking / inline-size;
}

/* ==========================================================================
   Vista cliente
   ========================================================================== */

.booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.form-card {
  display: grid;
  gap: 28px;
  padding: 24px;
}

.step {
  display: grid;
  gap: 16px;
}

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

.step legend {
  float: left; /* toglie la legend dal bordo del fieldset */
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: calc(1.15 * var(--rem));
  font-weight: 600;
}

.step-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font);
  font-size: calc(0.8 * var(--rem));
  font-weight: 700;
}

.summary {
  position: sticky;
  top: var(--sticky-top, 88px);
  display: grid;
  gap: 18px;
  padding: 22px;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.summary-list dt {
  color: var(--muted);
  font-size: calc(0.88 * var(--rem));
}

.summary-list dd {
  font-weight: 600;
  text-align: right;
}

.done-wrap {
  display: grid;
  place-items: center;
}

.done {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(100%, 480px);
  padding: 36px 28px;
  text-align: center;
}

.done .summary-list {
  width: 100%;
  text-align: left;
}

.done-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: calc(1.6 * var(--rem));
  font-weight: 700;
}

.code {
  padding: 10px 20px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: calc(1.5 * var(--rem));
  font-weight: 700;
  letter-spacing: 0.15em;
}

@container booking (max-width: 900px) {
  .booking-layout {
    grid-template-columns: 1fr;
  }

  .summary {
    position: static;
  }
}

/* Mobile: tutto centrato */
@container booking (max-width: 600px) {
  .form-card {
    padding: 18px 16px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .page-head,
  .field,
  .summary > h2,
  .fine-print {
    text-align: center;
  }

  .page-head {
    justify-items: center;
  }

  .step legend {
    justify-content: center;
  }

  .stepper {
    width: fit-content;
    margin-inline: auto;
  }

  /* Centrate se ci stanno, scorrevoli se sono tante (i margini auto evitano di tagliare la prima) */
  .date-strip > :first-child {
    margin-inline-start: auto;
  }

  .date-strip > :last-child {
    margin-inline-end: auto;
  }

  /* Tre orari per riga, l'ultima riga centrata */
  .time-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .time-grid > .choice {
    flex: 0 0 calc((100% - 16px) / 3);
  }

  .time-grid > .empty {
    flex-basis: 100%;
  }
}
