/**
 * Booking experience layer — home hall cards + the guided booking flow.
 * Layers on top of public-booking.css tokens. No framework beyond Bootstrap
 * utilities; all interactive components here are vanilla CSS + JS.
 */

:root {
  --be-ok: #15803d;
  --be-ok-soft: #dcfce7;
  --be-busy: #b91c1c;
  --be-busy-soft: #fee2e2;
  --be-hold: #a16207;
  --be-hold-soft: #fef3c7;
  --be-ring: 0 0 0 3px rgba(20, 83, 45, 0.28);
  --be-step: 2.25rem;
}

/* ---------- Universal focus visibility (accessibility baseline) ---------- */
.be-scope a:focus-visible,
.be-scope button:focus-visible,
.be-scope input:focus-visible,
.be-scope select:focus-visible,
.be-scope textarea:focus-visible,
.be-scope [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--be-ring);
  border-radius: 8px;
}

/* ---------- Hall cards (home) ---------- */
.be-hall-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .be-hall-grid { grid-template-columns: repeat(2, 1fr); } }

.be-hall {
  background: var(--pb-surface);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--pb-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.be-hall:hover { transform: translateY(-3px); box-shadow: var(--pb-shadow-lg); }

.be-hall-media { position: relative; aspect-ratio: 16 / 10; background: #e7e5e4; }
.be-hall-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.be-hall-price {
  position: absolute; right: .75rem; bottom: .75rem;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-weight: 700; font-size: 1.05rem;
  color: var(--pb-primary);
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.be-hall-price small { font-weight: 500; font-size: .72rem; color: var(--pb-muted); display: block; line-height: 1; margin-top: 1px; }

.be-hall-body { padding: 1.25rem 1.25rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.be-hall-body h3 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .4rem; }
.be-hall-desc { color: var(--pb-muted); font-size: .95rem; line-height: 1.6; margin-bottom: .9rem; white-space: pre-line; }

.be-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; }
.be-tag {
  font-size: .78rem; font-weight: 600;
  background: var(--pb-accent-soft); color: #92400e;
  border-radius: 999px; padding: .3rem .7rem;
}

.be-cta {
  margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--pb-primary); color: #fff;
  font-weight: 650; font-size: 1rem;
  padding: .8rem 1rem; border-radius: 10px;
  text-decoration: none; border: 0;
  transition: background .15s ease;
}
.be-cta:hover, .be-cta:focus { background: var(--pb-primary-hover); color: #fff; }

/* ---------- Booking flow shell ---------- */
.be-flow { display: grid; gap: 1.75rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 992px) { .be-flow { grid-template-columns: minmax(0,1.6fr) minmax(300px,.9fr); gap: 2.25rem; } }

.be-card {
  background: var(--pb-surface);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius);
  box-shadow: var(--pb-shadow);
  padding: 1.5rem;
}
@media (min-width: 768px) { .be-card { padding: 1.9rem; } }

.be-step-head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.35rem; }
.be-step-num {
  flex: 0 0 var(--be-step); width: var(--be-step); height: var(--be-step);
  border-radius: 50%;
  background: var(--pb-primary); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: .98rem;
}
.be-step-head h2 { font-size: 1.22rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.be-step-head p { margin: .15rem 0 0; font-size: .88rem; color: var(--pb-muted); }

/* ---------- Availability calendar ---------- */
.be-cal-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; gap: .5rem; }
.be-cal-month { font-weight: 700; font-size: 1.05rem; }
.be-cal-nav { display: flex; gap: .35rem; }
.be-cal-nav button {
  width: 2.3rem; height: 2.3rem; border-radius: 8px;
  border: 1px solid var(--pb-border); background: #fff; color: var(--pb-text);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.be-cal-nav button:hover:not(:disabled) { background: var(--pb-bg); border-color: var(--pb-primary); }
.be-cal-nav button:disabled { opacity: .35; cursor: not-allowed; }

.be-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.be-cal-dow {
  text-align: center; font-size: .72rem; font-weight: 700;
  color: var(--pb-muted); text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: .35rem;
}
.be-day {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--be-ok-soft);
  color: #14532d;
  font-weight: 600; font-size: .92rem;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
  padding: 0;
}
.be-day:hover:not(:disabled) { transform: scale(1.06); box-shadow: 0 3px 10px rgba(0,0,0,.14); }
.be-day.is-empty { background: transparent; cursor: default; pointer-events: none; }
.be-day:disabled { cursor: not-allowed; transform: none; }
.be-day.is-past { background: transparent; color: #d6d3d1; }
.be-day.is-booked { background: var(--be-busy-soft); color: #7f1d1d; text-decoration: line-through; }
.be-day.is-blocked { background: var(--be-hold-soft); color: #78350f; text-decoration: line-through; }
.be-day.is-selected {
  background: var(--pb-primary); color: #fff;
  box-shadow: 0 4px 14px rgba(20,83,45,.4);
  transform: scale(1.04);
}
.be-day.is-today::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}

.be-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; font-size: .82rem; color: var(--pb-muted); }
.be-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.be-swatch { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }

.be-cal-status {
  margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px;
  background: var(--pb-bg); font-size: .92rem;
  border: 1px dashed var(--pb-border);
}
.be-cal-status.is-chosen { background: var(--be-ok-soft); border: 1px solid #86efac; color: #14532d; font-weight: 600; }

/* ---------- Form ---------- */
.be-fieldset { border: 0; padding: 0; margin: 0 0 1.6rem; }
.be-fieldset legend {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--pb-muted); margin-bottom: .9rem; padding: 0; float: none; width: auto;
}
.be-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .be-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.be-field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .35rem; }
.be-field .be-opt { font-weight: 500; color: var(--pb-muted); font-size: .8rem; }
.be-field input, .be-field select, .be-field textarea {
  width: 100%; padding: .72rem .9rem;
  border: 1px solid #d6d3d1; border-radius: 9px;
  font-size: 1rem; font-family: inherit; color: var(--pb-text);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.be-field input:focus, .be-field select:focus, .be-field textarea:focus {
  outline: none; border-color: var(--pb-primary); box-shadow: var(--be-ring);
}
.be-field input[aria-invalid="true"] { border-color: var(--be-busy); background: #fff6f6; }
.be-hint { font-size: .78rem; color: var(--pb-muted); margin-top: .3rem; }
.be-err { font-size: .8rem; color: var(--be-busy); margin-top: .3rem; font-weight: 600; display: none; }
.be-err.is-on { display: block; }

.be-check { display: flex; gap: .7rem; align-items: flex-start; font-size: .92rem; }
.be-check input { width: 1.15rem; height: 1.15rem; margin-top: .15rem; flex: 0 0 auto; accent-color: var(--pb-primary); }

/* ---------- Summary ---------- */
.be-summary { position: sticky; top: 92px; }
.be-sum-media { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #e7e5e4; margin-bottom: 1rem; }
.be-sum-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.be-sum-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--pb-border); font-size: .93rem; }
.be-sum-row:last-of-type { border-bottom: 0; }
.be-sum-row dt { color: var(--pb-muted); margin: 0; }
.be-sum-row dd { margin: 0; font-weight: 650; text-align: right; }
.be-sum-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: .9rem; padding-top: .9rem; border-top: 2px solid var(--pb-text); }
.be-sum-total .be-amt { font-size: 1.6rem; font-weight: 800; color: var(--pb-primary); letter-spacing: -.02em; }

.be-note { display: flex; gap: .6rem; font-size: .84rem; color: var(--pb-muted); background: var(--pb-bg); padding: .8rem .9rem; border-radius: 9px; margin-top: 1rem; line-height: 1.5; }

.be-submit {
  width: 100%; margin-top: 1.2rem;
  background: var(--pb-primary); color: #fff; border: 0;
  font-size: 1.02rem; font-weight: 700;
  padding: .95rem 1rem; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.be-submit:hover:not(:disabled) { background: var(--pb-primary-hover); }
.be-submit:disabled { background: #a8a29e; cursor: not-allowed; }

/* ---------- Mobile sticky bar ---------- */
.be-mobar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--pb-border);
  padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.be-mobar .be-amt { font-size: 1.2rem; font-weight: 800; color: var(--pb-primary); }
.be-mobar small { display: block; font-size: .74rem; color: var(--pb-muted); }
.be-mobar button { flex: 0 0 auto; padding: .7rem 1.4rem; border-radius: 9px; border: 0; background: var(--pb-primary); color: #fff; font-weight: 700; cursor: pointer; }
@media (min-width: 992px) { .be-mobar { display: none; } }
@media (max-width: 991.98px) { body.be-has-mobar { padding-bottom: 5.5rem; } }

@media (prefers-reduced-motion: reduce) {
  .be-scope *, .be-scope *::before, .be-scope *::after { transition: none !important; animation: none !important; }
  .be-hall:hover, .be-day:hover:not(:disabled) { transform: none; }
}

/* ---------- Overflow safety ----------
   Grid and flex children default to min-width:auto, so a wide child (the
   7-column calendar) can refuse to shrink and push the page past the
   viewport. Allowing them to shrink is what keeps mobile from clipping. */
.be-flow, .be-flow > *, .be-hall-grid, .be-hall, .be-card, .be-grid, .be-field { min-width: 0; }
.be-flow > * > .be-card { max-width: 100%; }
.be-cal-grid { min-width: 0; width: 100%; }
.be-day { min-width: 0; }
.be-hall-desc, .be-sum-row dd, .be-field input { overflow-wrap: anywhere; }
.be-sum-row dd { max-width: 62%; }

@media (max-width: 400px) {
  .be-cal-grid { gap: .18rem; }
  .be-day { min-height: 36px; font-size: .85rem; border-radius: 7px; }
  .be-card { padding: 1.1rem; }
  .be-legend { gap: .6rem; font-size: .76rem; }
}
