/* ==========================================================================
   The Salty Beak Beach Bar — guest reservation flow
   Layers on top of style.css and reuses .modal / .modal-panel / .btn / .icon-btn
   so the flow inherits the brand. Everything new is namespaced .rsv-* to stay
   clear of the shared guest styles and the staff POS sheets.
   Built mobile-first: 44px minimum targets, 16px name input so iOS does not
   zoom on focus, dvh instead of vh, and no horizontal page overflow at 375px.
   ========================================================================== */

.rsv-modal .rsv-panel {
  max-width: 520px;
  max-height: 88dvh;
  padding: 28px 24px 24px;
  overscroll-behavior: contain;
}

/* Freeze the page behind the sheet so iOS scrolls the panel, not the body. */
body.rsv-locked { overflow: hidden; }

.rsv-close { z-index: 2; }

.rsv-modal h3 { margin: 0 0 6px; padding-right: 40px; }
.rsv-sub { font-size: 0.92rem; color: var(--text-soft); margin: 0 0 18px; }
.rsv-field { margin-bottom: 22px; }
.rsv-field:last-child { margin-bottom: 0; }

.rsv-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  margin: 0 0 8px;
  color: var(--text);
}
.rsv-cap {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 8px 0 0;
}

/* ---------- Party size ---------- */
.rsv-party {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.rsv-party-btn {
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.rsv-party-btn:hover { border-color: var(--accent); }
.rsv-party-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  transform: translateY(-1px);
}

/* ---------- Date strip ---------- */
.rsv-dates {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;   /* momentum on iOS */
  overscroll-behavior-x: contain;      /* keep the swipe off the page */
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding: 2px 2px 10px;
  margin: 0 -2px;
}
.rsv-dates::-webkit-scrollbar { height: 4px; }
.rsv-dates::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
.rsv-date {
  flex: 0 0 auto;
  scroll-snap-align: center;
  width: 62px;
  min-height: 74px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rsv-date:hover { border-color: var(--accent); }
.rsv-date.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.rsv-date-dow {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
  white-space: nowrap;
}
.rsv-date-num {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.1;
}
.rsv-date-mon { font-size: 0.68rem; opacity: 0.8; }

/* ---------- Time slots ---------- */
.rsv-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.rsv-slot {
  min-height: 46px;
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.rsv-slot.is-open:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  transform: translateY(-2px);
}
.rsv-slot.is-full {
  border-color: var(--border);
  color: var(--text-soft);
  opacity: 0.55;
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.rsv-slot.is-mine {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  color: var(--text);
  cursor: default;
}
.rsv-slot-tag {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  opacity: 0.85;
}
.rsv-empty {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-soft);
  margin: 10px 0 0;
}

/* ---------- Your reservations (modal list + visit-page panel) ---------- */
.rsv-mine[hidden] { display: none !important; }
.rsv-mine {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.rsv-mine-head {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 10px;
  color: var(--text);
}
.rsv-mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rsv-mine-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.rsv-mine-info { flex: 1; min-width: 0; }
.rsv-mine-when {
  font-weight: 700;
  font-size: 0.92rem;
  margin: 0;
  color: var(--text);
}
.rsv-mine-meta {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.rsv-code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.rsv-cancel {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rsv-cancel:hover {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff9f3;
}
.rsv-mine-note {
  font-size: 0.76rem;
  color: var(--text-soft);
  margin: 10px 0 0;
}

/* Visit-page panel gets a little more room than the in-modal copy. */
#reserveUpcoming { margin: 20px 0 0; max-width: 520px; }

/* ---------- Name step ---------- */
.rsv-back {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-soft);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  padding: 8px 8px 8px 0;
  min-height: 44px;
  margin-bottom: 4px;
}
.rsv-back:hover { color: var(--accent); }
.rsv-pick {
  font-family: var(--font-heading);
  color: var(--accent);
  font-size: 1rem;
  margin: 0 0 18px;
}
.rsv-input {
  width: 100%;
  padding: 13px 14px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* 16px exactly: any smaller and iOS zooms the page on focus */
}
.rsv-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 163, 172, 0.2);
}
.rsv-err {
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 8px 0 0;
}

/* ---------- Honesty note ---------- */
.rsv-demo {
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 16px;
  text-align: left;
}
.rsv-demo-loud { border-width: 2px; }

/* ---------- Confirmation ---------- */
.rsv-done { text-align: center; }
.rsv-done h3 { padding-right: 0; margin-bottom: 14px; }
.rsv-summary {
  margin: 0 0 16px;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  text-align: left;
}
.rsv-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.rsv-summary dt {
  font-size: 0.8rem;
  color: var(--text-soft);
  font-weight: 700;
}
.rsv-summary dd {
  margin: 0;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}
.rsv-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 1.05rem;
}
.rsv-mascot-line {
  font-style: italic;
  font-size: 0.88rem;
  color: var(--text-soft);
  margin: 0 0 16px;
}
.rsv-again { margin-top: 10px; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .rsv-modal { padding: 0; align-items: flex-end; }
  .rsv-modal .rsv-panel {
    max-height: 92dvh;
    padding: 24px 18px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    /* Clear the iPhone home indicator. */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .rsv-party { gap: 6px; }
  .rsv-slots { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
  .rsv-cancel { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .rsv-dates { scroll-behavior: auto; }
}
