/* Booking Board management UI (dashboard + editor)
 * Plan: docs/plans/BOOKING-BOARD-DEFINITIVE-BUILD-PLAN-2026-06-20.md §4 Stage 5
 * Loaded after style.css so these rules win; scoped to .bb-* / .bb-modal. */

/* Overlay container. booking-board-dashboard.js mounts
 * <div class="modal-overlay bb-overlay"> straight onto <body>, but the project
 * has no base `.modal-overlay` rule (other modals are inline in index.html and
 * style their own wrappers), so without this the overlay rendered as an
 * unpositioned, invisible static block at the foot of the page — tapping
 * "Booking board" did nothing. Give it the standard full-viewport scrim +
 * centred dialog. */
.bb-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 3000);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: bbOverlayIn 0.18s ease-out;
}

@keyframes bbOverlayIn { from { opacity: 0; } to { opacity: 1; } }

/* On phones the dialog should use the full width and not get clipped by the
 * viewport — cap its height and let the body scroll inside. */
@media (max-width: 640px) {
  .bb-overlay { padding: 12px; align-items: flex-start; }
  .bb-overlay .bb-modal { max-height: calc(100dvh - 24px); }
}

.bb-modal { max-width: 640px; width: 100%; }

/* Rounded BOTTOM (2026-07-20, user: "the bottom of the booking board is
   currently square"). The panel inherits a full border-radius from the base
   .modal-content, but the pinned .modal-footer action bar at the bottom carries
   its own --surface-secondary background + top border and, as the last flex
   child filling the panel's bottom edge, its square corners showed through
   (the parent's overflow-clip rounds the panel box, but the footer's opaque
   fill reads as a square shelf inside it). Round the footer's bottom corners to
   match the panel so the whole board ends in a clean radius. Belt-and-braces:
   also pin the panel radius explicitly so a future base-token change can't
   re-square it. */
.bb-modal { border-radius: var(--radius-2xl, 20px); overflow: hidden; }
.bb-modal .modal-footer,
.bb-modal .bb-editor-footer,
/* WHATEVER ENDS THE PANEL (2026-08-14, user: "Booking board initially loads
   with a jagged rather than rounded bottom"). The rule rounded only the FOOTER
   - but show() mounts header + body with NO footer, so during "Loading..." the
   last child is .modal-body, an opaque square-cornered surface painting over
   the rounded panel. */
.bb-modal > :last-child {
  border-bottom-left-radius: var(--radius-2xl, 20px);
  border-bottom-right-radius: var(--radius-2xl, 20px);
}

/* The base `.modal-content` rule (style.css) caps the dialog at max-height:90vh
 * with overflow:hidden and lays its children out as a flex column. The booking
 * board now adopts the app-canonical shell — `.modal-header` (pinned) /
 * `.modal-body` (the large scrollable white area: padding, flex:1, overflow-y:
 * auto) / `.modal-footer` (pinned action bar). `.bb-body` keeps its class only as
 * a scoping hook for the booking-board-specific field styles below; it inherits
 * all its scroll/padding/white surface from `.modal-body`. Scoped so every other
 * modal that shares `.modal-content` is untouched. */
.bb-modal { display: flex; flex-direction: column; }
.bb-modal .modal-header { flex-shrink: 0; }
.bb-loading, .bb-error { padding: 24px 4px; color: var(--text-secondary, #6b7280); }
.bb-error { color: #b91c1c; }
/* ⭐2026-08-20 (owner: "New booking board area still has a lot of scrollable
   space"). The editor's inline form-error box ships as
   `<div class="bb-error hidden" id="bb-formerr">` — but `.hidden` is NOT
   defined in this stylesheet, so the "hidden" box rendered as an empty
   BLOCK. Measured live in the created-board editor: 548px tall — more than
   every real field in the form combined (the whole body scrolled 1451px for
   ~900px of content). It also keeps its 24px padding while empty. Hide it
   properly, and collapse ANY empty .bb-error so a cleared error leaves no
   ghost gap behind. */
.bb-error.hidden,
.bb-error[hidden] { display: none; }
.bb-error:empty { display: none; padding: 0; }

/* Empty / upsell state */
.bb-empty { padding: 8px 4px 4px; }
.bb-empty p { color: var(--text-secondary, #6b7280); margin: 0 0 16px; line-height: 1.55; }

/* Board row */
.bb-row {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border-color, #e5e7eb); flex-wrap: wrap;
}
.bb-row:last-of-type { border-bottom: 0; }
.bb-row-main { min-width: 0; flex: 1 1 260px; }
.bb-row-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bb-row-url { font-size: .85rem; margin: 3px 0; word-break: break-all; }
.bb-row-url a { color: var(--accent-color, #0f766e); }
.bb-row-meta { font-size: .82rem; color: var(--text-secondary, #6b7280); }
.bb-row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }

.bb-chip { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; }
.bb-chip--live { background: #d1fae5; color: #065f46; }
.bb-chip--disabled { background: #e5e7eb; color: #4b5563; }
.bb-chip--expired { background: #fee2e2; color: #991b1b; }
.bb-chip--incomplete { background: #fef3c7; color: #92400e; }

/* Empty-board (no declared availability) guidance banner */
.bb-setup-banner {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: .9rem; line-height: 1.5;
}
.bb-link-btn {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: #92400e; text-decoration: underline; cursor: pointer;
}

/* Small inline action chips used in the dense dashboard rows and the preview's
 * "Open preview" link. Intentionally compact (not full 44px `.btn` pills), but
 * aligned to app tokens so they read as the same small-button family. */
.bb-btn {
  font: inherit; font-size: .85rem; padding: 6px 12px; border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--slate-200, #e2e8f0); background: var(--surface-primary, #fff);
  color: var(--text-primary, #1f2933); cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.bb-btn:hover { border-color: var(--primary-400, #2dd4bf); color: var(--primary-700, #0f766e); }
.bb-btn--danger { color: #b91c1c; }
.bb-btn--danger:hover { border-color: #b91c1c; color: #b91c1c; }

/* Dashboard empty-state footer (holds the single "Create booking board" button).
 * The editor uses the app-canonical .modal-footer (pinned action bar) instead. */
.bb-footer { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

/* Editor */
.bb-editor { display: block; }
.bb-field { display: block; margin-bottom: 16px; }
.bb-field-label { display: block; font-size: .85rem; font-weight: 600;
  color: var(--text-secondary, #6b7280); margin-bottom: 6px; }
.bb-field input[type=text],
.bb-field select,
.bb-field textarea {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: var(--input-radius, 12px);
  border: 1px solid var(--slate-200, #e2e8f0);
  background: var(--surface-primary, #fff); color: var(--text-primary, #1f2933);
}
.bb-field textarea { resize: vertical; min-height: 64px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

.bb-slugrow { display: flex; align-items: stretch; border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: var(--input-radius, 12px); overflow: hidden; }
.bb-slugpre { display: flex; align-items: center; padding: 0 8px; font-size: .82rem;
  color: var(--text-secondary, #6b7280); background: var(--surface-secondary, #f3f4f6); white-space: nowrap; }
.bb-slugrow input { border: 0 !important; border-radius: 0 !important; flex: 1; }
.bb-slughint { font-size: .8rem; margin-top: 5px; min-height: 1em; }
.bb-slughint.bb-ok { color: #065f46; }
.bb-slughint.bb-warn { color: #b45309; }

/* Toggle groups ("Stays live for", "Visitors can") use the app-canonical
 * .option-pill capsules (visual styling lives in css/board-modals.css). This
 * only lays them out in a wrapping row, mirroring .create-board-options. The
 * pills are not flex:1 here — they should size to their label, not stretch. */
.bb-pillgroup { display: flex; flex-wrap: wrap; gap: 8px; }
.bb-pillgroup .option-pill { flex: 0 0 auto; }

.bb-embedhint { font-size: .8rem; margin-top: 6px; color: var(--text-secondary, #6b7280); }
.bb-embedhint--warn { color: #b45309; }

/* Theme editor — accent colour row */
.bb-accent-row { display: inline-flex; gap: 8px; align-items: center; }
.bb-accent-row input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--slate-200, #e2e8f0); border-radius: var(--input-radius, 12px); background: none; cursor: pointer; }
.bb-accent-hex { width: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.bb-accent-hex.bb-invalid { border-color: #b91c1c; }

/* Embed preview */
.bb-preview { margin-top: 4px; }
.bb-preview-frame { width: 100%; max-width: 560px; height: 420px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; background: #fff; }

/* Booking rules disclosure (collapsible secondary controls in the editor) */
.bb-rules { margin-bottom: 16px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; overflow: hidden; }
.bb-rules-summary {
  display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none;
  padding: 11px 13px; font-size: .9rem; font-weight: 600; color: var(--text-primary, #1f2933);
  background: var(--surface-secondary, #f3f4f6);
}
.bb-rules-summary::-webkit-details-marker { display: none; }
.bb-rules-summary i { color: var(--accent-color, #0f766e); }
.bb-rules-title { flex: 0 0 auto; }
.bb-rules-sub { flex: 1 1 auto; min-width: 0; font-weight: 400; font-size: .82rem;
  color: var(--text-secondary, #6b7280); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-rules[open] .bb-rules-sub { display: none; } /* the inputs below say it once open */
.bb-rules-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px;
  padding: 14px 13px 4px;
}
.bb-rule { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bb-rule-label { font-size: .8rem; font-weight: 600; color: var(--text-secondary, #6b7280); }
.bb-rule-num {
  width: 100%; font: inherit; padding: 8px 10px; border-radius: var(--input-radius, 12px);
  border: 1px solid var(--slate-200, #e2e8f0);
  background: var(--surface-primary, #fff); color: var(--text-primary, #1f2933);
}
.bb-rule-tiers { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 6px 13px 4px; font-size: .85rem; }
.bb-rule-tiers-label { font-weight: 600; color: var(--text-secondary, #6b7280); }
.bb-rule-tiers label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.bb-rules-help { padding: 4px 13px 13px; margin: 0; font-size: .78rem; line-height: 1.5; color: var(--text-secondary, #6b7280); }

@media (max-width: 540px) {
  .bb-row-actions { width: 100%; }
  .bb-rules-grid { grid-template-columns: 1fr; }
  .bb-rules-sub { display: none; } /* avoid summary line wrapping on narrow screens */
}
