/* ==========================================================================
   LTickets — seat maps (SeatMapCore, assets/js/seatmap-core.js).
   Loaded by every page that draws a map: the buyer seat picker, the admin
   seat overview and the seat map builder. Builds on main.css tokens.
   Static by design: no transitions or animations — only cheap fill/stroke
   changes, so a 5 000-seat map stays smooth while it pans and zooms.

   The host sizes the <svg class="sm-svg"> (give its box a height, e.g.
   60vh); thumbnails (interactive:false) scale with their width.
   Seat colour = the category colour, set by the JS as the chair's fill and
   stroke attributes; the rules below override them per state.
   Variants: add `sm-svg--admin` (opts.className) for the admin overview —
   held seats amber, every seat clickable.
   ========================================================================== */

/* ------------------------------------------------------------- canvas --- */
.sm-svg {
    display: block;
    width: 100%;
    max-width: none;
    overflow: hidden;
    font-family: var(--font-body);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.sm-svg.is-interactive { height: 100%; touch-action: none; }
.sm-svg.is-interactive.sm-pan-none { touch-action: manipulation; }
.sm-svg:not(.is-interactive) { height: auto; }

.sm-svg.sm-pan-drag { cursor: grab; }
.sm-svg.is-space-pan,
.sm-svg.is-space-pan * { cursor: grab !important; }
.sm-svg.is-panning,
.sm-svg.is-panning * { cursor: grabbing !important; }

.sm-bg { pointer-events: none; }

/* Host drawings (outlines, rubber band) never block the map; handles do. */
.sm-overlay { pointer-events: none; }
.sm-overlay [data-handle],
.sm-overlay .sm-handle { pointer-events: visiblePainted; }

/* ------------------------------------------------------- rows & labels --- */
/* Invisible band along each row so a click between seats still hits it. */
.sm-row-band { fill: none; stroke: transparent; pointer-events: stroke; }

.sm-row-label {
    fill: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-anchor: middle;
}

.sm-seat-num {
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
}
.sm-svg.sm-num-off .sm-seat-num { display: none; }

/* ------------------------------------------------------------- tables --- */
.sm-table-body {
    fill: #2a1d19;
    stroke: rgba(246, 241, 234, 0.22);
    stroke-width: 1.2;
}
.sm-table-label {
    fill: var(--text);
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
}

/* ------------------------------------------------------------- shapes --- */
.sm-shape-body { stroke: rgba(246, 241, 234, 0.14); stroke-width: 1; }
.sm-shape--stage .sm-shape-body { stroke: rgba(246, 241, 234, 0.22); }
.sm-shape-hit { fill: transparent; pointer-events: all; }
.sm-shape-text {
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
}
.sm-shape--stage .sm-shape-text { letter-spacing: 0.18em; }
.sm-shape--text .sm-shape-text { font-weight: 600; letter-spacing: 0.02em; }
.sm-icon { pointer-events: none; }
.sm-icon path { stroke-linecap: round; stroke-linejoin: round; }

/* -------------------------------------------------------------- seats --- */
/* Chair glyph: fill + stroke attributes = category colour; no ring by default. */
.sm-chair { stroke-width: 0; pointer-events: all; }
.sm-mark {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.sm-mark--tick { stroke-width: 2.3; }
.sm-mark--cross { stroke: #a1958d; stroke-width: 1.7; }
.sm-mark--hatch { stroke-width: 1.2; opacity: 0.85; }
.sm-wc { pointer-events: none; }
.sm-wc path { stroke-linecap: round; stroke-linejoin: round; }

.sm-svg.is-interactive .sm-seat { cursor: pointer; }
.sm-svg.is-interactive .sm-seat.is-taken,
.sm-svg.is-interactive .sm-seat.is-held,
.sm-svg.is-interactive .sm-seat.is-blocked,
.sm-svg.is-interactive .sm-seat.is-unavailable { cursor: not-allowed; }
.sm-svg.is-interactive .sm-seat.is-selected,
.sm-svg.sm-pan-modifier .sm-seat,
.sm-svg--admin.is-interactive .sm-seat { cursor: pointer; }

/* Sold / held: dark grey with a small cross. */
.sm-seat.is-taken .sm-chair,
.sm-seat.is-held .sm-chair { fill: #3a3230; }
.sm-seat.is-taken .sm-seat-num,
.sm-seat.is-held .sm-seat-num,
.sm-seat.is-taken .sm-wc,
.sm-seat.is-held .sm-wc { display: none; }

/* Blocked: outline in the category colour, hatched. */
.sm-seat.is-blocked .sm-chair { fill: rgba(246, 241, 234, 0.04); stroke-width: 1.3; }
.sm-seat.is-blocked .sm-seat-num { fill: var(--text-muted); }
.sm-seat.is-blocked .sm-wc { display: none; }

/* Not for sale (no ticket type for its category, etc.). */
.sm-seat.is-unavailable { opacity: 0.35; }

/* Builder: seat already sold for an upcoming performance. */
.sm-seat.is-locked .sm-chair {
    stroke: var(--gold);
    stroke-width: 1.4;
    stroke-dasharray: 2.5 2;
}

/* Your choice: white seat, category-colour ring and tick. */
.sm-seat.is-selected { opacity: 1; }
.sm-seat.is-selected .sm-chair { fill: #ffffff; stroke-width: 2.4; stroke-dasharray: none; }
.sm-seat.is-selected .sm-seat-num,
.sm-seat.is-selected .sm-wc { display: none; }

/* Search hit / "this one": gold ring, wins over everything. */
.sm-seat.is-highlight .sm-chair { stroke: var(--gold); stroke-width: 2; stroke-dasharray: none; }

@media (hover: hover) {
    .sm-svg.is-interactive .sm-seat.is-free:not(.is-selected):hover .sm-chair { stroke: #ffffff; stroke-width: 1.6; }
}

/* Only when the host opts in (opts.focusable): seats are not tab stops by default. */
.sm-seat:focus { outline: none; }
.sm-seat:focus-visible .sm-chair { stroke: var(--accent-alt); stroke-width: 2.6; }

/* ------------------------------------------------------------ variants --- */
/* Admin overview: held (pending payment) seats in amber, sold stay dark. */
.sm-svg--admin .sm-seat.is-held .sm-chair { fill: #8a5d12; }
.sm-svg--admin .sm-seat.is-held .sm-mark--cross { stroke: #f7d58a; }
