/* ============================================================
   Public reservation wizard
   Mobile-first, brand-aligned with guest.css
   ============================================================ */

.res-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(96px + var(--safe-bottom));
  background: var(--c-bg);
}

/* ---------- Header ---------- */
.res-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding-top: var(--safe-top);
  box-shadow: var(--shadow-sm);
}
.res-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  max-width: 720px;
  margin: 0 auto;
}
.res-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--c-text);
  min-width: 0;
}
.res-brand:hover { text-decoration: none; }
.res-logo {
  height: 34px;
  width: auto;
  flex: 0 0 auto;
}
.res-brand-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.res-brand-name {
  font-weight: 500;
  color: var(--c-primary);
  line-height: 1.15;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.res-brand-tag {
  font-size: 0.72rem;
  color: var(--c-muted);
  font-weight: 300;
  white-space: nowrap;
}
.res-back-link { white-space: nowrap; }

@media (max-width: 380px) {
  .res-back-link .res-back-text { display: none; }
}

/* ---------- Step progress ---------- */
.res-steps {
  display: flex;
  gap: 0.25rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.35rem 0.85rem 0.65rem;
  max-width: 720px;
  margin: 0 auto;
  list-style: none;
  position: relative;
}
.res-steps::before {
  content: "";
  position: absolute;
  left: calc(0.85rem + 14px);
  right: calc(0.85rem + 14px);
  top: calc(0.35rem + 13px);
  height: 2px;
  background: var(--c-border);
  z-index: 0;
}
.res-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--c-muted);
  line-height: 1.1;
}
.res-step__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  color: var(--c-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
}
.res-step.is-done .res-step__dot {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}
.res-step.is-current .res-step__dot {
  background: var(--c-surface);
  border-color: var(--c-primary);
  color: var(--c-primary);
  box-shadow: 0 0 0 4px var(--c-primary-soft);
}
.res-step.is-done,
.res-step.is-current {
  color: var(--c-text);
  font-weight: 500;
}
@media (max-width: 420px) {
  .res-step__label { display: none; }
}

/* ---------- Main area ---------- */
.res-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}
.res-step-pane { animation: paneIn 200ms ease; }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.res-step-pane > h1 { font-size: 1.4rem; }
.res-step-pane > p.muted { margin-bottom: 1rem; }

/* ---------- Stepper (number) ---------- */
.res-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.res-stepper__input {
  width: 5.5rem;
  text-align: center;
  font-weight: 500;
  font-size: 1.1rem;
}
/* hide native number arrows for cleaner UI on desktop */
.res-stepper__input::-webkit-outer-spin-button,
.res-stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.res-stepper__input { -moz-appearance: textfield; }

/* ---------- Step 2: area tabs ---------- */
.res-area-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
@media (min-width: 520px) {
  .res-area-tabs { grid-template-columns: repeat(2, 1fr); }
}
.res-area-tab {
  appearance: none;
  border: 2px solid var(--c-border);
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--c-text);
  min-height: var(--tap);
  transition: border-color 120ms ease, background 120ms ease, transform 80ms ease;
  -webkit-tap-highlight-color: transparent;
}
.res-area-tab:hover { background: var(--c-primary-soft); }
.res-area-tab:active { transform: scale(0.99); }
.res-area-tab.is-active {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
}
.res-area-tab__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--c-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex: 0 0 auto;
}
.res-area-tab__name {
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--c-primary);
}
.res-area-tab__sub {
  font-size: 0.82rem;
  color: var(--c-muted);
  display: block;
  font-weight: 300;
}

/* ---------- Step 3: SVG picker ---------- */
.res-picker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.25rem 0 0.85rem;
}
.res-picker {
  position: relative;
  width: 100%;
  background: #f0eee5;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  /* default 4:3 aspect; JS overrides via inline style if plan has dimensions */
  aspect-ratio: 4 / 3;
}
.res-picker__svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.res-picker__bg {
  /* Background image rendered as <image> inside SVG so coords stay aligned */
  pointer-events: none;
}
.res-picker__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: var(--c-muted);
  font-size: 0.9rem;
}

/* SVG table styles */
.res-table {
  cursor: pointer;
  transition: fill 140ms ease, stroke 140ms ease, opacity 140ms ease;
  -webkit-tap-highlight-color: transparent;
}
.res-table__shape {
  fill: rgba(0, 78, 32, 0.18);
  stroke: var(--c-primary);
  stroke-width: 1.5;
  transition: fill 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
}
.res-table__label {
  fill: var(--c-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}
.res-table__seats {
  fill: var(--c-primary);
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 300;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  opacity: 0.78;
  user-select: none;
}
.res-table:hover .res-table__shape,
.res-table:focus-visible .res-table__shape {
  fill: rgba(0, 78, 32, 0.34);
  stroke-width: 2;
  outline: none;
}
.res-table.is-selected .res-table__shape {
  fill: var(--c-primary);
  stroke: var(--c-primary-dark);
  stroke-width: 2;
}
.res-table.is-selected .res-table__label,
.res-table.is-selected .res-table__seats {
  fill: #ffffff;
  opacity: 1;
}
.res-table.is-occupied {
  cursor: not-allowed;
}
.res-table.is-occupied .res-table__shape {
  fill: rgba(179, 38, 30, 0.16);
  stroke: var(--c-danger);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}
.res-table.is-occupied .res-table__label,
.res-table.is-occupied .res-table__seats {
  fill: var(--c-danger);
  opacity: 0.85;
}
.res-table.is-occupied .res-table__strike {
  stroke: var(--c-danger);
  stroke-width: 1.5;
  opacity: 0.75;
}
.res-table.is-too-small .res-table__shape { opacity: 0.55; }
.res-table.is-inactive { display: none; }

/* Legend */
.res-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: var(--c-muted);
  margin-top: 0.6rem;
  justify-content: center;
}
.res-legend__item { display: inline-flex; align-items: center; gap: 0.35rem; }
.res-legend__swatch {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--c-primary);
  background: rgba(0, 78, 32, 0.18);
  display: inline-block;
}
.res-legend__swatch.is-selected { background: var(--c-primary); }
.res-legend__swatch.is-occupied {
  background: rgba(179, 38, 30, 0.16);
  border-color: var(--c-danger);
  border-style: dashed;
}

/* Picker summary */
.res-picker-summary {
  margin-top: 0.85rem;
  padding: 0.8rem 1rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-weight: 500;
  text-align: center;
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
}
.res-picker-summary.is-ok { border-color: var(--c-primary); color: var(--c-primary); }
.res-picker-summary.is-warn { border-color: var(--c-warning); color: var(--c-warning); }

/* ---------- Step 4: form ---------- */
.res-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 520px) {
  .res-form-grid { grid-template-columns: 1fr 1fr; }
}
.res-form-grid > div { min-width: 0; }
.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 2px rgba(179, 38, 30, 0.15);
}

/* ---------- Step 5: summary ---------- */
.res-summary { padding: 1.1rem 1.15rem; }
.res-summary__row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.4rem 0.85rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--c-border);
}
.res-summary__row:last-of-type { border-bottom: 0; }
.res-summary__key { color: var(--c-muted); font-size: 0.85rem; }
.res-summary__val { font-weight: 500; color: var(--c-text); word-break: break-word; }

/* ---------- Sticky nav ---------- */
.res-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem calc(0.75rem + var(--safe-bottom));
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -4px 18px rgba(0,0,0,0.08);
}
.res-nav .btn { white-space: nowrap; }
.res-nav__step {
  text-align: center;
  font-size: 0.82rem;
}
.res-nav.is-hidden { display: none; }

/* ---------- Footer ---------- */
.res-footer {
  margin-top: auto;
  padding: 1rem 1rem calc(1rem + var(--safe-bottom));
  text-align: center;
  font-size: 0.8rem;
  color: var(--c-muted);
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}
.res-footer .note { margin-bottom: 0.4rem; }
.res-footer a { color: var(--c-primary); }

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, #f0f0ec 0%, #e8e8e2 50%, #f0f0ec 100%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes skeleton {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- Confirm screen helpers ---------- */
.confirm-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 1rem auto 0.5rem;
}
.confirm-order-id { font-size: 0.95rem; }
.confirm-card { margin: 1rem 0; }
.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* ---------- Larger screens ---------- */
@media (min-width: 600px) {
  .res-step-pane > h1 { font-size: 1.65rem; }
  .res-table__label { font-size: 12px; }
  .res-table__seats { font-size: 9.5px; }
}
