/* Seat Hall Builder — scoped dark UI (BEM-ish with shb- prefix) */

.shb-root {
  --shb-bg: #121212;
  --shb-panel: #1e1e1e;
  --shb-border: rgba(255, 255, 255, 0.14);
  --shb-text: #f5f5f5;
  --shb-muted: #b5b5b5;
  --shb-primary: #ffffff;
  --shb-teal: #008080;
  --shb-purple: #800080;
  --shb-gold: #d4af37;
  color: var(--shb-text);
  background: var(--shb-bg);
  border-radius: 18px;
  /* Modals are position:fixed children — overflow:hidden can clip them in some browsers. */
  overflow: visible;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
}

/* Light theme support (site switches html[data-theme="light"]) */
html[data-theme="light"] .shb-root {
  --shb-bg: #f6f7f9;
  --shb-panel: #ffffff;
  --shb-border: rgba(0, 0, 0, 0.12);
  --shb-text: #111111;
  --shb-muted: rgba(17, 17, 17, 0.72);
  --shb-primary: #111111;
  background: var(--shb-bg);
  color: var(--shb-text);
}

/* Seat tooltips are appended to document.body (not inside .shb-root) — own tokens + light panel */
html[data-theme="light"] .shb-tooltip {
  --shb-tooltip-fg: #111111;
  --shb-tooltip-muted: rgba(17, 17, 17, 0.72);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.14);
}

.shb-shell {
  display: flex;
  flex-direction: column;
  min-height: 72vh;
}

.shb-header {
  padding: 18px 18px 8px;
  text-align: center;
}

.shb-header__datetime,
.shb-timebar {
  display: none !important;
}

.shb-pricebar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px 0 0;
}

.shb-pricechip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--shb-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--shb-text);
  font-size: 13px;
  cursor: pointer;
}

.shb-pricechip__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #999;
  display: inline-block;
}

.shb-pricechip--active {
  background: #eaeaea;
  color: #111;
  border-color: transparent;
}

.shb-pricechip--active .shb-pricechip__dot {
  outline: 2px solid rgba(0, 0, 0, 0.18);
}

.shb-pill {
  border: 1px solid var(--shb-border);
  background: transparent;
  color: var(--shb-text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}

.shb-pill--active {
  background: #eaeaea;
  color: #111;
  border-color: transparent;
}

.shb-viewport {
  position: relative;
  flex: 1;
  min-height: 420px;
  touch-action: none;
  background: radial-gradient(1200px 600px at 50% 0%, #1a1a1a, #121212);
}

html[data-theme="light"] .shb-viewport {
  background: radial-gradient(1200px 600px at 50% 0%, #ffffff, #f1f3f6);
}

@media (max-width: 768px) {
  .shb-root {
    border-radius: 14px;
    overflow: visible;
  }

  .shb-shell {
    min-height: 0;
    height: auto;
  }

  .shb-header {
    padding: 12px 12px 6px;
    flex-shrink: 0;
  }

  .shb-header__datetime {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .shb-pricebar,
  .shb-timebar {
    gap: 8px;
  }

  .shb-viewport {
    flex: 0 1 auto;
    min-height: 280px;
    max-height: min(50svh, 440px);
  }

  .shb-legend {
    flex-shrink: 0;
    position: static;
    top: auto;
  }

  /* Minimap takes space on mobile; hide like Afisha. */
  .shb-minimap {
    display: none;
  }

  .shb-map-controls {
    inset: auto 12px 12px auto;
    z-index: 2;
  }

  .shb-zoom__btn {
    width: 42px;
    height: 42px;
  }

  /* CTA always visible below the map */
  .shb-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex-shrink: 0;
    background: var(--shb-panel);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.35);
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  html[data-theme="light"] .shb-footer {
    background: #ffffff;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.12);
  }
}

.shb-map {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 400px;
}

/* Stage contour + label (SVG uses currentColor) */
.shb-layer--stage {
  color: rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] .shb-layer--stage {
  color: rgba(17, 17, 17, 0.9);
}

.shb-seat {
  cursor: pointer;
}

.shb-seat circle {
  transition: r 120ms ease, stroke-width 120ms ease, stroke 120ms ease, fill 120ms ease;
}

/* Hit circle receives clicks; visual donut/core are non-interactive. */
.shb-seat .shb-seat__hit {
  pointer-events: all;
  fill: transparent;
  stroke: none;
}

/* Donut seats: JS owns fill/stroke per zone — do not override with solid status fills. */
.shb-seat .shb-seat__donut {
  fill: transparent !important;
  pointer-events: none;
}

.shb-seat .shb-seat__core {
  pointer-events: none;
}

.shb-seat[data-status="reserved"] .shb-seat__donut,
.shb-seat[data-status="paid"] .shb-seat__donut,
.shb-seat[data-status="unavailable"] .shb-seat__donut,
.shb-seat[data-status="blocked"] .shb-seat__donut {
  opacity: 0.55;
}

.shb-seat[data-status="reserved"] .shb-seat__core,
.shb-seat[data-status="paid"] .shb-seat__core,
.shb-seat[data-status="unavailable"] .shb-seat__core,
.shb-seat[data-status="blocked"] .shb-seat__core {
  opacity: 0.45;
}

.shb-map-controls {
  position: absolute;
  inset: 12px 12px auto auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto; /* buttons must be clickable */
}

.shb-zoom {
  display: flex;
  gap: 10px;
  pointer-events: auto;
  justify-content: flex-start;
  flex-direction: row-reverse;
}

.shb-zoom__btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(18, 18, 18, 0.75);
  color: var(--shb-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.shb-zoom__btn:active {
  transform: translateY(1px);
}

.shb-minimap {
  width: 152px;
  height: 104px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 18, 0.55);
  overflow: hidden;
  pointer-events: none;
}

.shb-minimap__svg {
  width: 100%;
  height: 100%;
  display: block;
}

.shb-tooltip {
  --shb-tooltip-fg: #f5f5f5;
  --shb-tooltip-muted: #b5b5b5;
  position: fixed;
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color: var(--shb-tooltip-fg);
  max-width: 240px;
}

.shb-tooltip__line {
  font-size: 13px;
  color: var(--shb-tooltip-muted);
  margin: 2px 0;
}

.shb-tooltip__line strong {
  color: var(--shb-tooltip-fg);
}

.shb-legend {
  padding: 10px 16px 6px;
}

.shb-legend__row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
}

.shb-legend__item {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--shb-muted);
  font-size: 13px;
}

.shb-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.shb-legend__dot--selected {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.shb-legend__dot--reserved {
  background: #999999;
}

.shb-footer {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(30, 30, 30, 0.2), rgba(30, 30, 30, 0.65));
}

html[data-theme="light"] .shb-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.92));
}

html[data-theme="light"] .shb-zoom__btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.12);
  color: #111;
}

html[data-theme="light"] .shb-minimap {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .shb-legend__dot--selected {
  background: #111111;
  border-color: rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] .shb-btn--primary {
  background: #111111;
  color: #ffffff;
}

html[data-theme="light"] .shb-input,
html[data-theme="light"] .shb-select {
  background: #f0f0f0;
  border-color: rgba(0, 0, 0, 0.12);
  color: #111;
}

html[data-theme="light"] .shb-cart__item {
  border-color: rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .shb-cart__price {
  border-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .shb-modal__dialog {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
}

html[data-theme="light"] .shb-payment__event {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] .shb-payment__timer {
  border-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .shb-spinner {
  border-color: rgba(0, 0, 0, 0.12);
  border-top-color: #333;
}

.shb-footer__summary {
  color: var(--shb-muted);
  font-size: 14px;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
}

.shb-footer .shb-btn--primary {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  white-space: nowrap;
}

.shb-btn {
  border-radius: 999px;
  padding: 12px 22px;
  border: 1px solid var(--shb-border);
  background: transparent;
  color: var(--shb-text);
  cursor: pointer;
}

.shb-btn--primary {
  background: var(--shb-primary);
  color: #111;
  border-color: transparent;
  font-weight: 600;
}

.shb-btn--continue {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  width: auto;
  min-width: 0;
  min-height: 52px;
  padding: 12px 28px;
  text-align: left;
}

.shb-btn__summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  opacity: 0.92;
}

.shb-btn__summary[hidden] {
  display: none;
}

.shb-btn__summary strong {
  font-weight: 700;
}

.shb-btn__label {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
}

.shb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Modals */
.shb-modal[hidden] {
  display: none;
}

.shb-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.shb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.shb-modal__dialog {
  position: relative;
  width: min(920px, calc(100% - 32px));
  margin: 40px auto;
  background: var(--shb-panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  max-height: min(90dvh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shb-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.shb-modal__head--split {
  align-items: center;
}

.shb-modal__title {
  margin: 0;
  font-size: 18px;
}

.shb-modal__kicker {
  color: var(--shb-muted);
  font-size: 13px;
}

.shb-modal__body {
  padding: 8px 0 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.shb-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--shb-panel);
  padding-top: 8px;
}

.shb-icon-btn {
  border: none;
  background: transparent;
  color: var(--shb-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.shb-cart {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shb-cart__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.shb-cart__title {
  font-weight: 600;
}

.shb-cart__sub {
  color: var(--shb-muted);
  font-size: 13px;
}

.shb-cart__price {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.shb-field {
  margin: 10px 0;
}

.shb-field__label {
  display: block;
  font-size: 12px;
  color: var(--shb-muted);
  margin: 0 0 6px;
}

.shb-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #2a2a2a;
  color: var(--shb-text);
  padding: 12px 14px;
  outline: none;
}

.shb-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shb-check,
.shb-radio {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--shb-muted);
  font-size: 14px;
  margin: 8px 0;
}

.shb-payment__event {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 12px;
}

.shb-payment__methods {
  display: flex;
  gap: 14px;
  margin: 10px 0 12px;
  flex-wrap: wrap;
}

.shb-payment__lead {
  margin: 0 0 12px;
  color: var(--shb-muted);
  font-size: 14px;
  line-height: 1.45;
}

.shb-payment__hint {
  margin: 8px 0 0;
  color: var(--shb-muted);
  font-size: 13px;
}

.shb-gateway-list {
  display: grid;
  gap: 10px;
}

.shb-gateway-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.shb-gateway-option:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.shb-gateway-option:has(input:checked) {
  border-color: rgba(0, 199, 187, 0.55);
  background: rgba(0, 199, 187, 0.08);
}

.shb-gateway-option input {
  margin-top: 3px;
}

.shb-gateway-option__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.shb-gateway-option__title {
  color: var(--shb-text);
  font-size: 15px;
  font-weight: 700;
}

.shb-gateway-option__desc {
  color: var(--shb-muted);
  font-size: 13px;
  line-height: 1.35;
}

html[data-theme="light"] .shb-gateway-option {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] .shb-gateway-option:has(input:checked) {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.04);
}

.shb-select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #2a2a2a;
  color: var(--shb-text);
  padding: 12px 14px;
  outline: none;
}

.shb-payment__timer {
  font-variant-numeric: tabular-nums;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.shb-inline-status {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--shb-text);
  margin-bottom: 12px;
}

.shb-inline-status--ok {
  border-color: rgba(0, 199, 187, 0.35);
  background: rgba(0, 199, 187, 0.10);
}

.shb-inline-status--err {
  border-color: rgba(255, 80, 80, 0.35);
  background: rgba(80, 0, 0, 0.25);
}

.shb-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--shb-muted);
  margin: 8px 0 12px;
}

.shb-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: shbspin 0.9s linear infinite;
}

@keyframes shbspin {
  to {
    transform: rotate(360deg);
  }
}

.shb-tooltip {
  position: fixed;
  z-index: 100001;
  pointer-events: none;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--shb-tooltip-fg);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 80ms linear;
}

.shb-tooltip__line + .shb-tooltip__line {
  margin-top: 4px;
}

.shb-error {
  padding: 12px;
  border: 1px solid rgba(255, 80, 80, 0.35);
  background: rgba(80, 0, 0, 0.25);
  border-radius: 12px;
  margin: 12px;
}

.shb-empty {
  padding: 16px;
  color: var(--shb-muted);
}

@media (max-width: 720px) {
  .shb-shell {
    min-height: calc(100vh - 40px);
  }
  .shb-viewport {
    min-height: 52vh;
  }
  .shb-modal__dialog {
    margin: 12px auto;
    width: calc(100% - 16px);
    max-height: calc(100dvh - 24px);
  }
  .shb-field-row {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 420px) {
  .shb-viewport {
    min-height: 240px;
    max-height: min(46svh, 380px);
  }

  .shb-footer {
    position: sticky;
    bottom: 0;
    top: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 12px;
  }

  .shb-footer__summary {
    flex: 0 0 auto;
    font-size: 13px;
  }

  .shb-footer .shb-btn--primary,
  .shb-btn--continue {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    gap: 10px;
    padding: 12px 18px;
  }

  .shb-btn__summary {
    font-size: 13px;
  }

  .shb-btn__label {
    font-size: 15px;
  }
}
