/*
 * Booking-page layout templates (Phase 1 of the switchable booking designs).
 * Shared building blocks + one section per layout: classic / two-pane / calendar
 * / inline. All colors, spacing and radii come from the design tokens so
 * branding and dark mode carry through. The slot pills themselves live in
 * base.css (.slot-option); this file only arranges them per template.
 */

/* ---- shared header + chrome ------------------------------------------- */
.bk-header { display: flex; gap: var(--space-3); align-items: flex-start; }
.bk-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary); color: var(--color-text-inverse);
  font-weight: var(--font-weight-bold); font-size: var(--font-size-md);
}
.bk-avatar.bk-avatar-lg { width: 60px; height: 60px; font-size: var(--font-size-lg); }
.bk-biz { font-size: var(--font-size-sm); font-weight: var(--font-weight-bold);
  letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); }
.bk-title { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold);
  margin: var(--space-1) 0 0; line-height: 1.15; }
.bk-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  color: var(--color-text-muted); font-size: var(--font-size-sm); margin-top: var(--space-2); }
.bk-meta span { display: inline-flex; align-items: center; gap: var(--space-1); }
.bk-desc { color: var(--color-text-muted); margin: var(--space-3) 0 0; }

/* The "Pick a time" label + timezone picker row. */
.bk-tzbar { display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
/* Same trap as .tz-control: the label and select are flex items whose min-width defaults to
   auto, so a long zone name (America/Argentina/Buenos_Aires) pushed the page sideways. */
.bk-tzbar > * { min-width: 0; }
.bk-tzbar select { max-width: 100%; min-width: 0; }
.bk-tzbar .bk-tzlabel { margin: 0; }
.bk-tzbar select { padding: var(--space-1) var(--space-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text);
  font-size: var(--font-size-sm); }

/* Background styles (per session type): plain (default), a soft tint, or a
   brand-accented top bar. Applied to the layout card. */
.bk-bg-tint { background: var(--color-surface-alt); }
.bk-bg-brand { border-top: 5px solid var(--color-primary); }

/* Optional cover/banner image at the top of the card. */
.bk-cover { width: 100%; max-height: 220px; object-fit: cover; display: block;
  border-radius: var(--radius-md); margin-bottom: var(--space-4); }
.bk-twopane .bk-cover { grid-column: 1 / -1; max-height: 200px; border-radius: 0; margin-bottom: 0; }

/* ---- 1. Classic ------------------------------------------------------- */
.bk-classic { max-width: 720px; }

/* ---- 2. Two-pane (Calendly-style) ------------------------------------- */
.bk-twopane { max-width: 860px; display: grid; grid-template-columns: 310px 1fr; padding: 0; overflow: hidden; }
.bk-twopane .bk-left { padding: var(--space-6); border-right: 1px solid var(--color-border); background: var(--color-surface); }
.bk-twopane .bk-right { padding: var(--space-6); }
.bk-twopane .bk-header { flex-direction: column; }
.bk-twopane .bk-meta { flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.bk-points { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-2); }
.bk-points li { font-size: var(--font-size-sm); color: var(--color-text-muted); display: flex; gap: var(--space-2); }
.bk-points .bk-tick { color: var(--color-success); font-weight: var(--font-weight-bold); flex: none; }
@media (max-width: 640px) {
  .bk-twopane { grid-template-columns: 1fr; }
  .bk-twopane .bk-left { border-right: 0; border-bottom: 1px solid var(--color-border); }
}

/* ---- 3. Calendar grid ------------------------------------------------- */
.bk-calendar { max-width: 820px; }
.bk-cal { display: grid; grid-template-columns: 1fr 230px; gap: var(--space-5); align-items: start; }
.bk-cal-side { border-left: 1px solid var(--color-border); padding-left: var(--space-5); }
.bk-cal-side .bk-selday { font-weight: var(--font-weight-bold); font-size: var(--font-size-sm); margin: 0 0 var(--space-3); }
.bk-month + .bk-month { margin-top: var(--space-5); }
.bk-month-name { font-weight: var(--font-weight-bold); font-size: var(--font-size-md); margin: 0 0 var(--space-3); }
.bk-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: var(--space-1); }
.bk-dow span { text-align: center; font-size: 11px; font-weight: var(--font-weight-bold);
  color: var(--color-text-muted); text-transform: uppercase; }
.bk-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.bk-day { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-sm); border-radius: 50%; border: 0; background: transparent;
  color: var(--color-text-muted); font-weight: var(--font-weight-medium); }
.bk-day.bk-avail { background: var(--color-surface-alt); color: var(--color-text);
  font-weight: var(--font-weight-bold); cursor: pointer; }
.bk-day.bk-avail:hover { outline: 2px solid var(--bk-accent, var(--color-primary)); }
.bk-day.bk-sel { background: var(--bk-accent, var(--color-primary)); color: var(--color-text-inverse); cursor: pointer; }
.bk-times { display: grid; gap: var(--space-2); }
.bk-time { border: 1.5px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text); font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm); padding: var(--space-2); text-align: center; cursor: pointer; }
.bk-time:hover { border-color: var(--bk-accent, var(--color-primary)); }
.bk-time.bk-sel { background: var(--bk-accent, var(--color-primary)); border-color: var(--bk-accent, var(--color-primary));
  color: var(--color-text-inverse); font-weight: var(--font-weight-bold); }
@media (max-width: 640px) {
  .bk-cal { grid-template-columns: 1fr; }
  .bk-cal-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--color-border); padding-top: var(--space-4); }
}

/* ---- Booking flyout (in-calendar slide-over drawer) ------------------- */
.bk-flyout-backdrop { position: fixed; inset: 0; background: rgba(11, 17, 32, .5); z-index: 1000; opacity: 0; visibility: hidden; transition: opacity .2s ease; }
.bk-flyout-backdrop.open { opacity: 1; visibility: visible; }
.bk-flyout {
  position: fixed; top: 0; right: 0; height: 100%; width: min(600px, 100%);
  background: var(--color-surface); box-shadow: -8px 0 30px rgba(11, 17, 32, .25);
  z-index: 1001; display: flex; flex-direction: column;
  /* ⚠️ Hidden once the slide-out finishes, so a closed panel is not a stack of invisible
     controls sitting in the page. The .bk-popup variant below has always done this; the
     flyout never got it (audit 2026-08-12).

     ⚠️ THE GUARANTEE IS `panel.inert` IN booking-flyout.js, NOT THIS. Visibility is delayed
     here so the panel can finish sliding away, and anything that waits for a transition is a
     timing question — measured in a real browser, this alone did not reliably take the close
     button out of the focus order. `inert` is a property, not a race. This rule is the visual
     half; that one is the accessible half. */
  transform: translateX(100%); visibility: hidden;
  transition: transform .2s ease, visibility 0s linear .2s;
}
/* ⚠️ visibility flips to visible with NO delay on open, so the panel is focusable the moment
   it starts sliding in — the delay above applies only on the way out. */
.bk-flyout.open { transform: translateX(0); visibility: visible; transition: transform .2s ease, visibility 0s; }
.bk-flyout-head { display: flex; justify-content: flex-end; padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border); flex: none; }
.bk-flyout iframe { flex: 1 1 auto; width: 100%; border: 0; background: var(--color-surface); }
@media (prefers-reduced-motion: reduce) {
  .bk-flyout, .bk-flyout-backdrop { transition: none; }
}

/* Popup variant: same panel, centered on the page as a modal instead of a
   side drawer. Chosen by the admin (Booking setup → Booking window). */
.bk-flyout.bk-popup {
  top: 50%; left: 50%; right: auto; bottom: auto;
  height: min(85vh, 780px); width: min(600px, 94vw);
  border-radius: var(--radius-lg); overflow: hidden;
  transform: translate(-50%, -50%) scale(.96); opacity: 0;
  visibility: hidden; transition: transform .2s ease, opacity .2s ease;
}
.bk-flyout.bk-popup.open { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; }

/* ---- 4. Inline widget ------------------------------------------------- */
.bk-inline { max-width: 680px; }
.bk-inline .bk-inline-row { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.bk-inline .bk-inline-info { flex: 1 1 180px; min-width: 160px; }
.bk-inline .bk-title { font-size: var(--font-size-lg); }
.bk-inline .bk-inline-slots { flex: 2 1 260px; }
.bk-inline .bk-inline-slots #booking-slots fieldset { margin-bottom: var(--space-2); }
