/* Organiser room builder (seats-room-builder.js). Builds on styles.css, system.css and market.css. */

.rb { display: grid; gap: 12px; min-width: 0; color: var(--ink); }
.rb [hidden] { display: none !important; }
.rb-body { display: grid; gap: 12px; min-width: 0; }
.rb h4 { margin: 0 0 6px; color: var(--navy); font-size: 16px; }
.rb .button, .rb button.button { min-height: 44px; }
.rb button:disabled { opacity: .55; cursor: not-allowed; }
.rb :focus-visible { outline: 3px solid var(--blue, #1d6fd6); outline-offset: 2px; }
.rb-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.rb-toolbar { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.rb-toolbar .button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.rb-hint { margin: 0; }
.rb-alert { margin: 0; color: #b3261e; font-size: 14.5px; font-weight: 700; }
.rb-warn { margin: 0; padding: 10px 14px; border-radius: 8px; background: #fff4cf; color: #6b4300; font-weight: 700; }
.rb-locked { margin: 0; padding: 10px 14px; border-left: 4px solid var(--gold); border-radius: 6px; background: #fff7dc; color: #4a3500; font-weight: 700; }
.rb-preview-note { margin: 0; padding: 10px 14px; border-left: 4px solid var(--navy); border-radius: 6px; background: #e9f0fa; color: var(--navy); font-weight: 700; }
.rb-guide { display: grid; gap: 5px; min-width: 0; padding: 12px 14px; border: 1px solid #e5d9ad; border-left: 4px solid var(--gold, #d7a800); border-radius: 10px; background: #fffaf0; }
.rb-guide strong { color: var(--navy); font-size: 15px; }
.rb-guide p { margin: 0; color: #34495f; font-size: 14px; line-height: 1.5; }
.rb-guide .rb-guide-locked { color: #4a3500; }

/* layout: plan first, controls beside it on wide screens and stacked on phones */
.rb-main { display: grid; gap: 14px; min-width: 0; }
.rb-plan, .rb-side { display: grid; gap: 12px; min-width: 0; align-content: start; }
@media (min-width: 1000px) {
  .rb-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .rb-plan { position: sticky; top: 12px; }
}

/* the plan scrolls inside its own frame; the page never scrolls sideways */
.rb-frame { max-width: 100%; overflow: auto; border: 1px solid #b9c9dc; border-radius: 8px; background: #e3eaf3; }
.rb-svg { display: block; width: 100%; min-width: 0; height: auto; max-height: 80vh; user-select: none; -webkit-user-select: none; }
.rb-svg.is-dragging { cursor: grabbing; }
.rb-table, .rb-item { cursor: grab; outline: none; }
.rb-table.is-sel, .rb-item.is-sel { touch-action: none; }          /* only the picked object blocks page scroll, so the page still scrolls elsewhere */
.rb-svg.is-preview .rb-table, .rb-svg.is-preview .rb-item { cursor: default; }
.rb-table:focus-visible, .rb-item:focus-visible { outline: none; }
.rb-tt { pointer-events: none; }
.rb-item text { pointer-events: none; }

/* selection: a 2px navy outline with small white square handles; tables also get a rotate handle on a thin stalk */
.rb-halo { fill: none; stroke: var(--navy-deep, #031a37); stroke-width: 2px; opacity: 0; pointer-events: none; }
.rb-table.is-sel .rb-halo, .rb-item.is-sel .rb-halo { opacity: 1; }
.rb-table:focus-visible .rb-halo, .rb-item:focus-visible .rb-halo { opacity: 1; stroke-dasharray: 4 3; }
.rb-corner { fill: #fff; stroke: #06274f; stroke-width: 1.5px; }
.rb-stalk { stroke: #06274f; stroke-width: 1px; }
.rb-rot-handle { fill: #fff; stroke: #06274f; stroke-width: 1.5px; cursor: grab; touch-action: none; }
.rb-rot-handle:hover { fill: #e9eef6; }

/* dragging: a subtle shadow, and the snap dots appear */
.rb-table.is-lift .dka-body { filter: url(#dka-tshl); }
.rb-dots { opacity: 0; }
.rb-svg.is-dragging .rb-dots { opacity: 1; }

.rb-bad { fill: none; stroke-width: 1; }
.rb-over { stroke: #b3261e; stroke-dasharray: 3 2; stroke-width: 1.4; }
.rb-out { stroke: #9a4a00; stroke-width: 1.8; }
.rb-handle { fill: #fff; stroke: #06274f; stroke-width: 1.5px; touch-action: none; }
.rb-handle-nwse { cursor: nwse-resize; }
.rb-handle-nesw { cursor: nesw-resize; }

/* The message floats over the top of the plan, so it never pushes the canvas down while someone is dragging. */
.rb-plan { position: relative; }
.rb-toast { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 6; margin: 0; padding: 10px 14px; border-left: 4px solid #9a4a00; border-radius: 6px; background: #fff4cf; color: #5c3400; font-size: 14.5px; font-weight: 700; box-shadow: 0 6px 18px rgb(6 39 79 / 18%); pointer-events: none; }
.rb-item.is-rejected .dka-foot { stroke: #b3261e; stroke-width: 1.6; stroke-dasharray: 3 2; }
.rb-savewhy { color: #8f1d17; font-size: 14px; font-weight: 750; }
.rb-savenote { padding: 6px 10px; border-radius: 8px; background: #e3f4ea; color: #14532d; font-size: 14.5px; font-weight: 750; }
.rb input::placeholder { color: #5b6b7d; opacity: 1; }
.rb-savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rb-dirty { color: #3f5269; font-size: 14px; font-weight: 750; }
.rb-dirty.is-dirty { color: #8a2d00; }
.rb-dirty.is-dirty::before { content: "● "; }

/* side panels */
.rb-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.rb-stat { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
.rb-stat dt { margin: 0; color: #3f5269; font-size: 12.5px; font-weight: 700; }
.rb-stat dd { margin: 2px 0 0; color: var(--navy); font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.rb-settings, .rb-tiers, .rb-roomfields, .rb-palette, .rb-grid-form { display: grid; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; align-content: start; }
.rb-grid-form { border-left: 4px solid var(--gold, #d7a800); }
.rb-quick-start { gap: 10px; }
.rb-quick-start summary { font-size: 15px; }
.rb-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; min-width: 0; }
.rb-field { min-width: 0; }
.rb-field label { color: var(--navy); font-size: 14px; font-weight: 700; }
.rb input, .rb select { width: 100%; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid #b9c9dc; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
.rb input:disabled, .rb select:disabled { background: var(--paper, #f4f7fb); color: #3f5269; }
.rb input[aria-invalid="true"] { border-color: #b3261e; }
.rb-actions, .rb-palette-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
.rb-stepper .button { padding: 0; min-width: 44px; font-size: 20px; line-height: 1; }
.rb-stepper input { text-align: center; }

.rb-tier { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 5px solid var(--navy); border-radius: 10px; }
.rb-tier legend { padding: 0 6px; color: var(--navy); font-size: 14px; font-weight: 750; }
.rb-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-sw { width: 44px; height: 44px; padding: 0; border: 2px solid; border-radius: 50%; font-size: 18px; font-weight: 900; line-height: 1; cursor: pointer; }
.rb-sw.is-on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--navy); }
.rb-tier-seats { margin: 0; color: #3f5269; font-size: 14px; font-weight: 650; }
.rb-area { margin: 0; color: var(--navy); font-size: 14.5px; font-weight: 750; }
.rb-details summary { min-height: 44px; display: flex; align-items: center; color: var(--navy); font-weight: 750; cursor: pointer; }
.rb-details { display: grid; gap: 8px; }

@media (max-width: 420px) { .rb-two { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  .rb *, .rb *::before, .rb *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- simpler builder: two views, one table card, folded extras (modelled on a floor-plan builder the owner liked) ---- */
.rb-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 8px; }
.rb-switch { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid #c9d3e0; border-radius: 12px; background: #f4f7fb; }
.rb-seg { min-height: 40px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: var(--navy, #06274f); font-weight: 700; cursor: pointer; }
.rb-seg[aria-pressed="true"] { background: var(--navy, #06274f); color: #fff; }
.rb-seg:focus-visible { outline: 3px solid var(--gold, #d4a017); outline-offset: 2px; }
.rb-more { flex: 1 1 100%; }
.rb-more > summary { cursor: pointer; color: var(--navy, #06274f); font-weight: 700; font-size: 14px; padding: 4px 0; }
.rb-more .rb-toolbar { margin-top: 6px; }
.rb-more.is-off { opacity: .5; pointer-events: none; }
.rb-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.rb-guide-none { color: #4a3500; }
.rb-fold { border: 1px solid #d3deeb; border-radius: 12px; background: #fff; padding: 0 14px; }
.rb-fold > summary { cursor: pointer; padding: 12px 0; font-weight: 800; color: var(--navy, #06274f); }
.rb-fold[open] > summary { border-bottom: 1px solid #e5ecf4; margin-bottom: 10px; }
.rb-fold > .rb-tiers > h4, .rb-fold > .rb-grid-form > h4 { display: none; }
.rb-fold > .rb-tiers, .rb-fold > .rb-grid-form, .rb-fold-body { padding-bottom: 12px; display: grid; gap: 12px; }
.rb-chips { display: grid; gap: 8px; }
.rb-chip { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid #c9d3e0; border-radius: 12px; background: #fff; color: var(--navy, #06274f); font: inherit; text-align: left; cursor: pointer; }
.rb-chip small { margin-left: auto; color: #4a5a6d; font-size: 13px; font-weight: 700; }
.rb-chip .rb-chip-name { font-weight: 700; }
.rb-chip.is-on { border-color: var(--navy, #06274f); box-shadow: 0 0 0 2px rgb(6 39 79 / .15); background: #f4f8fd; }
.rb-chip:disabled { opacity: .6; cursor: not-allowed; }
.rb-chip:focus-visible { outline: 3px solid var(--gold, #d4a017); outline-offset: 2px; }
.rb-dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid; }
.rb-lab { color: var(--navy, #06274f); font-size: 14px; font-weight: 700; }
.rb-capacity { display: flex; justify-content: space-between; margin: 4px 0 0; padding-top: 10px; border-top: 1px solid #e5ecf4; color: #4a5a6d; }
.rb-wide { width: 100%; justify-content: center; }
.rb-shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rb-shape { display: grid; justify-items: center; gap: 4px; min-height: 64px; padding: 8px 6px; border: 1px solid #c9d3e0; border-radius: 12px; background: #fff; color: var(--navy, #06274f); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.rb-shape.is-on { border-color: var(--navy, #06274f); box-shadow: 0 0 0 2px rgb(6 39 79 / .15); background: #f4f8fd; }
.rb-shape:disabled { opacity: .6; cursor: not-allowed; }
.rb-shape:focus-visible { outline: 3px solid var(--gold, #d4a017); outline-offset: 2px; }

.rb-stepsfold > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 700; color: var(--navy, #06274f); }
.rb-more > summary { min-height: 44px; display: flex; align-items: center; }
