/* Stadium seat viewer — scoped inline styles.
   All selectors are prefixed with .stadium-viewer to avoid clobbering the host page. */

.stadium-viewer {
  display: flex;
  flex-direction: column;
  height: min(1180px, 92vh);
  min-height: 640px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(15, 22, 36, 0.08);
  background: #0f1218;
  color: #e6e8ee;
  font-family: -apple-system, "Apple SD Gothic Neo", sans-serif;
  position: relative;
}

.stadium-viewer * { box-sizing: border-box; }

.stadium-viewer .sv-hero { padding: 12px 20px; border-bottom: 1px solid #262a36; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.stadium-viewer .sv-hero .sub { font-size: 12px; color: #8b92a8; margin-top: 2px; }
.stadium-viewer .breadcrumb { font-size: 13px; color: #a4abbf; }
.stadium-viewer .breadcrumb a { color: #4dafff; text-decoration: none; cursor: pointer; }
.stadium-viewer .breadcrumb a:hover { text-decoration: underline; }
.stadium-viewer .breadcrumb .sep { color: #4a5162; margin: 0 6px; }
.stadium-viewer .breadcrumb .cur { color: #ffd66e; font-weight: 600; }
.stadium-viewer .toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stadium-viewer .toolbar input { background: #1a1d26; border: 1px solid #2a3040; color: #e6e8ee; padding: 6px 10px; border-radius: 6px; font-size: 13px; width: 200px; }
.stadium-viewer .toolbar button { background: #2a3040; color: #e6e8ee; border: 1px solid #363c50; padding: 6px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.stadium-viewer .toolbar button:hover { background: #343b50; }
.stadium-viewer .toolbar button.primary { background: #3d5cff; border-color: #4b6bff; }
.stadium-viewer .toolbar button.primary:hover { background: #4b6bff; }

.stadium-viewer .sv-main { flex: 1; display: flex; overflow: hidden; min-height: 0; }

.stadium-viewer #sv-viewerWrap { flex: 1; position: relative; overflow: hidden; background: #08090d; touch-action: none; cursor: grab; }
.stadium-viewer #sv-viewerWrap.panning { cursor: grabbing; }
.stadium-viewer #sv-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.stadium-viewer #sv-stage img { display: block; user-select: none; pointer-events: none; -webkit-user-drag: none; }
.stadium-viewer #sv-stage svg { position: absolute; top: 0; left: 0; }

.stadium-viewer #sv-stage svg polygon { fill: rgba(0,0,0,0); stroke: rgba(255,255,255,0); stroke-width: 1.2; vector-effect: non-scaling-stroke; transition: fill .12s, stroke .12s; cursor: pointer; pointer-events: all; }
.stadium-viewer #sv-stage svg polygon:hover, .stadium-viewer #sv-stage svg polygon.hover { fill: rgba(255, 214, 110, 0.55); stroke: #ffd66e; }
.stadium-viewer #sv-stage svg polygon.selected { fill: rgba(77, 175, 255, 0.5); stroke: #4dafff; }
.stadium-viewer #sv-stage svg polygon.disabled,
.stadium-viewer #sv-stage svg polygon.muted { fill: rgba(10, 10, 12, 0.42); stroke: rgba(90, 95, 110, 0.55); cursor: pointer; }
.stadium-viewer #sv-stage svg polygon.disabled:hover,
.stadium-viewer #sv-stage svg polygon.muted:hover { fill: rgba(255, 214, 110, 0.42); stroke: #ffd66e; }
.stadium-viewer #sv-stage svg text.zone-label { fill: rgba(255,255,255,0.9); font-weight: 700; text-anchor: middle; dominant-baseline: middle; pointer-events: none; paint-order: stroke; stroke: rgba(0,0,0,0.75); stroke-width: 0.35; }

.stadium-viewer #sv-stage svg rect.block { fill: rgba(77, 175, 255, 0.15); stroke: #4dafff; stroke-width: 1.4; vector-effect: non-scaling-stroke; cursor: pointer; pointer-events: all; transition: fill .12s; }
.stadium-viewer #sv-stage svg rect.block:hover, .stadium-viewer #sv-stage svg rect.block.hover { fill: rgba(255, 214, 110, 0.6); stroke: #ffd66e; }
.stadium-viewer #sv-stage svg rect.block.wheel { fill: rgba(163, 210, 255, 0.25); stroke: #a3d2ff; }

.stadium-viewer #sv-tooltip { position: absolute; background: rgba(20,22,28,0.95); border: 1px solid #363c50; padding: 8px 12px; border-radius: 8px; font-size: 13px; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 100; color: #e6e8ee; }
.stadium-viewer #sv-tooltip.visible { opacity: 1; }
.stadium-viewer #sv-tooltip .z { font-weight: 700; color: #ffd66e; }
.stadium-viewer #sv-tooltip .g { font-size: 11px; color: #8b92a8; margin-top: 2px; }
.stadium-viewer #sv-tooltip .hint { font-size: 11px; color: #6de3a4; margin-top: 4px; }
.stadium-viewer #sv-tooltip .badge { display: inline-block; background: #2a3040; padding: 1px 6px; border-radius: 3px; font-size: 10px; color: #a4abbf; margin-left: 6px; }

.stadium-viewer #sv-imgPreview { position: absolute; background: rgba(15,18,24,0.98); border: 1px solid #363c50; border-radius: 10px; padding: 10px; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .1s; box-shadow: 0 8px 30px rgba(0,0,0,0.5); color: #e6e8ee; }
.stadium-viewer #sv-imgPreview.visible { opacity: 1; }
.stadium-viewer #sv-imgPreview.pinned { border-color: #4dafff; box-shadow: 0 8px 30px rgba(77,175,255,0.35); pointer-events: auto; }
.stadium-viewer #sv-imgPreview .header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stadium-viewer #sv-imgPreview .label { font-size: 12px; color: #ffd66e; font-weight: 700; }
.stadium-viewer #sv-imgPreview .label .link { color: #8b92a8; font-weight: 400; margin-left: 6px; font-size: 11px; }
.stadium-viewer #sv-imgPreview .actions { display: none; gap: 6px; }
.stadium-viewer #sv-imgPreview.pinned .actions { display: flex; }
.stadium-viewer #sv-imgPreview .actions a, .stadium-viewer #sv-imgPreview .actions button { color: #a4abbf; background: #2a3040; border: 0; padding: 3px 8px; border-radius: 4px; font-size: 11px; text-decoration: none; cursor: pointer; }
.stadium-viewer #sv-imgPreview .actions a:hover, .stadium-viewer #sv-imgPreview .actions button:hover { background: #363c50; color: #e6e8ee; }
.stadium-viewer #sv-imgPreview .actions .close { background: transparent; color: #8b92a8; font-size: 16px; padding: 0 4px; line-height: 1; }
.stadium-viewer #sv-imgPreview .grid { display: grid; grid-template-columns: repeat(3, 220px); gap: 6px; max-height: 60vh; overflow-y: auto; }
.stadium-viewer #sv-imgPreview .grid .cell { width: 220px; height: 147px; background: #1a1d26; border-radius: 4px; overflow: hidden; position: relative; }
.stadium-viewer #sv-imgPreview.pinned .grid .cell { cursor: zoom-in; }
.stadium-viewer #sv-imgPreview.pinned .grid .cell:hover { outline: 2px solid #ffd66e; }
.stadium-viewer #sv-imgPreview .grid .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stadium-viewer #sv-imgPreview .none { font-size: 12px; color: #8b92a8; padding: 4px 0; }
.stadium-viewer #sv-imgPreview .pin-hint { font-size: 10px; color: #6de3a4; margin-top: 6px; }
.stadium-viewer #sv-imgPreview.pinned .pin-hint { display: none; }

/* Lightbox is fixed to the viewport so it escapes the viewer container. */
#sv-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: none; align-items: center; justify-content: center; z-index: 9500; }
#sv-lightbox.visible { display: flex; }
#sv-lightbox .lb-img-wrap { position: relative; max-width: 92vw; max-height: 92vh; display: flex; align-items: center; justify-content: center; }
#sv-lightbox img.lb-img { max-width: 92vw; max-height: 92vh; object-fit: contain; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
#sv-lightbox .lb-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; background: rgba(20,22,28,0.7); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%; color: white; font-size: 26px; cursor: pointer; display: flex; align-items: center; justify-content: center; user-select: none; z-index: 10; }
#sv-lightbox .lb-arrow:hover { background: rgba(60,66,80,0.9); }
#sv-lightbox .lb-prev { left: 24px; }
#sv-lightbox .lb-next { right: 24px; }
#sv-lightbox .lb-close { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; background: rgba(20,22,28,0.7); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%; color: white; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; }
#sv-lightbox .lb-close:hover { background: rgba(60,66,80,0.9); }
#sv-lightbox .lb-caption { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #e6e8ee; background: rgba(20,22,28,0.75); padding: 6px 14px; border-radius: 999px; font-size: 12px; }

.stadium-viewer aside.sv-sidebar { width: 300px; background: #14161c; border-left: 1px solid #262a36; display: flex; flex-direction: column; min-height: 0; }
.stadium-viewer .side-head { padding: 12px 16px; border-bottom: 1px solid #262a36; }
.stadium-viewer .side-head .title { font-size: 13px; font-weight: 600; }
.stadium-viewer .side-head .desc { font-size: 11px; color: #8b92a8; margin-top: 3px; }
.stadium-viewer .zone-groups { flex: 1; overflow-y: auto; padding: 8px 0; }
.stadium-viewer .group-block { border-bottom: 1px solid #1e222c; padding: 6px 0; }
.stadium-viewer .group-title { font-size: 11px; color: #7a8199; text-transform: uppercase; padding: 4px 16px; letter-spacing: .05em; }
.stadium-viewer .zone-chip { display: inline-block; margin: 3px 4px 3px 16px; padding: 4px 10px; background: #1a1d26; border: 1px solid #2a3040; border-radius: 999px; font-size: 12px; cursor: pointer; color: #e6e8ee; }
.stadium-viewer .zone-chip:hover { background: #2a3040; }
.stadium-viewer .zone-chip.active { background: #2b3654; border-color: #4b6bff; color: #b8c8ff; }
.stadium-viewer .zone-chip.has-detail { border-color: #4dafff; color: #b8d8ff; }
.stadium-viewer .zone-chip.has-detail::before { content: "◆ "; color: #4dafff; }
.stadium-viewer .zone-chip.disabled,
.stadium-viewer .zone-chip.muted { opacity: 0.58; color: #7f879b; border-color: #293040; background: #14161c; cursor: pointer; text-decoration: none; }
.stadium-viewer .zone-chip.disabled:hover,
.stadium-viewer .zone-chip.muted:hover { background: #222838; color: #d7dcec; }
.stadium-viewer .zone-chip.disabled.has-detail,
.stadium-viewer .zone-chip.muted.has-detail { color: #8aa6c7; border-color: #33445e; }
.stadium-viewer .zone-chip.disabled.has-detail::before,
.stadium-viewer .zone-chip.muted.has-detail::before { color: #628bb9; }
.stadium-viewer #sv-tooltip .badge.muted { background: #2a2d38; color: #8b92a8; border-color: #3a3f4d; }

.stadium-viewer #sv-legend { position: absolute; bottom: 16px; left: 16px; background: rgba(20,22,28,0.9); border: 1px solid #262a36; padding: 8px 12px; border-radius: 8px; font-size: 11px; color: #a4abbf; line-height: 1.6; }
.stadium-viewer #sv-legend kbd { background: #2a3040; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 10px; }

.stadium-viewer #sv-detailPanel { position: absolute; top: 16px; right: 16px; width: 280px; background: rgba(20,22,28,0.96); border: 1px solid #363c50; border-radius: 12px; padding: 16px; display: none; color: #e6e8ee; }
.stadium-viewer #sv-detailPanel.visible { display: block; }
.stadium-viewer #sv-detailPanel .zone-name { font-size: 20px; font-weight: 700; color: #ffd66e; }
.stadium-viewer #sv-detailPanel .group { font-size: 12px; color: #a4abbf; margin-top: 2px; }
.stadium-viewer #sv-detailPanel .status { font-size: 11px; margin-top: 6px; color: #6de3a4; }
.stadium-viewer #sv-detailPanel .status.missing { color: #ff9b9b; }
.stadium-viewer #sv-detailPanel .actions { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.stadium-viewer #sv-detailPanel .actions a, .stadium-viewer #sv-detailPanel .actions button { display: inline-block; padding: 6px 12px; background: #3d5cff; color: white; border-radius: 6px; text-decoration: none; font-size: 12px; border: none; cursor: pointer; }
.stadium-viewer #sv-detailPanel .actions button.secondary { background: #2a3040; }
.stadium-viewer #sv-detailPanel .close { position: absolute; top: 8px; right: 12px; color: #8b92a8; cursor: pointer; font-size: 18px; background: none; border: none; }

.stadium-viewer #sv-loadingOverlay { position: absolute; inset: 0; background: rgba(8,9,13,0.7); display: none; align-items: center; justify-content: center; z-index: 50; }
.stadium-viewer #sv-loadingOverlay.visible { display: flex; }
.stadium-viewer #sv-loadingOverlay .spinner { color: #a4abbf; font-size: 13px; }

/* ============ Mobile / narrow-viewport layout ============ */
@media (max-width: 820px) {
  .stadium-viewer { height: auto; min-height: 0; }
  .stadium-viewer .sv-hero { padding: 10px 14px; }
  .stadium-viewer .toolbar { width: 100%; }
  .stadium-viewer .toolbar input { flex: 1 1 140px; width: auto; min-width: 0; }
  .stadium-viewer .toolbar button { flex: 0 0 auto; }
  .stadium-viewer .sv-main { flex-direction: column; }
  .stadium-viewer #sv-viewerWrap { flex: 0 0 auto; width: 100%; height: 60vh; min-height: 380px; }
  .stadium-viewer aside.sv-sidebar { width: 100%; border-left: 0; border-top: 1px solid #262a36; max-height: 45vh; }
  .stadium-viewer #sv-legend { display: none; }
  .stadium-viewer #sv-detailPanel { top: 8px; right: 8px; left: 8px; width: auto; padding: 12px; }
  .stadium-viewer #sv-imgPreview .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stadium-viewer #sv-imgPreview .grid .cell { width: 100%; height: auto; aspect-ratio: 3 / 2; }
  .stadium-viewer #sv-imgPreview { max-width: calc(100vw - 20px); }
  #sv-lightbox .lb-arrow { width: 44px; height: 44px; font-size: 22px; }
  #sv-lightbox .lb-prev { left: 8px; }
  #sv-lightbox .lb-next { right: 8px; }
  #sv-lightbox .lb-close { top: 12px; right: 12px; width: 36px; height: 36px; font-size: 20px; }
}

@media (max-width: 480px) {
  .stadium-viewer #sv-viewerWrap { height: 55vh; min-height: 320px; }
  .stadium-viewer aside.sv-sidebar { max-height: 40vh; }
  .stadium-viewer .toolbar input { flex: 1 1 100%; }
  .stadium-viewer #sv-imgPreview .grid { grid-template-columns: 1fr; }
}
