/* ============================================
   BOOKING MODAL — in-page checkout flow
   Reuses the site palette (cream/moss/ember/ink).
============================================ */

.booking-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(42, 42, 38, 0.78);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Don't let the overlay swallow touch events meant for the scrollable modal. */
  touch-action: none;
}
.booking-modal-overlay[data-open='true'] { display: flex; }

.booking-modal {
  background: var(--white);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--font-sans);
  /* iOS Safari: enable momentum scrolling and avoid the bug where a
     fixed-position container needs focus before touch scrolling works. */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.booking-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 2;
}
.booking-modal-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 500;
}
.booking-modal-close {
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--mist);
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
  min-width: 44px;
  min-height: 44px;
}
.booking-modal-close:hover { color: var(--ink); background: var(--cream-deep); }

.booking-modal-body {
  padding: 1rem 1.5rem 1.25rem;
}

/* Section spacing — collapse aggressively to remove dead white space.
   Reset padding because style.css applies `section { padding: var(--section-y) }`
   globally, which would otherwise inflate each modal section by ~224px. */
.booking-modal-section {
  margin-bottom: 0.85rem;
  padding-top: 0;
  padding-bottom: 0;
}
.booking-modal-section:last-of-type { margin-bottom: 0.75rem; }
.booking-modal-section[hidden] { display: none !important; }
.booking-modal-section h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

/* Trust strip — between summary and contact form. Three quick reassurances
   to defuse anxiety before the guest types personal info. */
.booking-modal-trust {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--cream);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.35;
}
.bmt-row { display: flex; align-items: center; gap: 0.55rem; }
.bmt-ico { flex-shrink: 0; font-size: 0.95rem; line-height: 1; width: 1.1rem; text-align: center; }

/* Footnote under the submit button — Stripe + Apple Pay reassurance. */
.booking-modal-secure-note {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--mist);
  text-align: center;
  line-height: 1.4;
}

.booking-modal-summary {
  background: var(--cream);
  border-radius: var(--r-md);
  padding: 1rem;
  font-size: 0.95rem;
}
.booking-modal-summary .summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.booking-modal-summary .summary-row:last-child { margin-bottom: 0; }
.booking-modal-summary .summary-total {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
  font-size: 1.05rem;
}
.booking-modal-summary .summary-cabin {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}
.booking-modal-summary .summary-dates {
  color: var(--mist);
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.booking-modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.booking-modal-fields label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.booking-modal-fields label.full { grid-column: span 2; }
.booking-modal-fields input {
  margin-top: 0.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  background: var(--white);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.booking-modal-fields input:focus {
  outline: none;
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(79, 93, 63, 0.15);
}
.booking-modal-fields input[aria-invalid='true'] {
  border-color: var(--ember);
}

.booking-modal-field-error {
  color: var(--ember);
  font-size: 0.82rem;
  margin-top: 0.3rem;
  display: none;
}
.booking-modal-field-error[data-show='true'] { display: block; }

.booking-modal-policy {
  background: var(--cream);
  border-radius: var(--r-md);
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.5;
}
.booking-modal-policy a {
  color: var(--moss);
  text-decoration: underline;
}

/* Stripe Payment Element wrapper — only reserve space when actually visible
   (parent section's `hidden` attribute removes it from flow otherwise). */
[data-role='payment-section']:not([hidden]) #payment-element {
  min-height: 200px;
}

.booking-modal-error-banner {
  display: none;
  background: #fbeeea;
  border: 1px solid var(--ember);
  border-radius: var(--r-md);
  color: var(--ink);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.booking-modal-error-banner[data-show='true'] { display: block; }
.booking-modal-error-banner button {
  margin-top: 0.5rem;
  background: var(--ember);
  color: var(--white);
  border: 0;
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.booking-modal-notice {
  display: none;
  background: #fff8ec;
  border: 1px solid #d8b56b;
  border-radius: var(--r-md);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.booking-modal-notice[data-show='true'] { display: block; }

.booking-modal-submit {
  width: 100%;
  background: var(--ember);
  color: var(--white);
  border: 0;
  padding: 0.9rem 1.25rem;
  border-radius: var(--r-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  min-height: 48px;
}
.booking-modal-submit:hover:not(:disabled) {
  background: #b86a44;
}
.booking-modal-submit:disabled {
  background: var(--mist);
  cursor: not-allowed;
  opacity: 0.7;
}

.booking-modal-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: booking-modal-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}
@keyframes booking-modal-spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .booking-modal { max-height: 100vh; border-radius: 0; }
  .booking-modal-overlay { padding: 0; }
}
