/* =============================================================================
 * Seeing Markets — viz 5 — Zonal Pricing Map
 * Uses the global theme variables: --bg, --bg-card, --text, --text-soft,
 * --text-mute, --accent, --rule. Light/dark switching is done via body.theme-dark.
 * ========================================================================== */

.viz-panel[data-viz="5"] { --viz5-nodata: var(--rule, #e4e7ec); }

.viz5-wrap {
  position: relative;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px 22px 16px;
}

.viz5-expand {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
  color: var(--text-soft);
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.viz5-expand:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.viz5-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  border: none;
  border-radius: 0;
  padding: 28px clamp(16px, 5vw, 64px);
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.viz5-wrap.is-fullscreen .viz5-stage {
  flex: 1 1 auto;
  align-items: center;
}
.viz5-wrap.is-fullscreen .viz5-svg {
  transform-origin: center center;
  max-height: 85vh;
  max-width: 900px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  /* nivel zoom în fullscreen: 1.0 = normal, crește pentru mai mare */
transform: scale(1.0);
}
body.viz5-noscroll { overflow: hidden; }

/* --- Header --- */
.viz5-head { text-align: center; margin-bottom: 14px; }
.viz5-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.viz5-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.viz5-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  opacity: 0.85;
}

/* --- Stage (legendă + svg + tooltip) --- */
.viz5-stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow: hidden;
}

/* --- Legendă --- */
.viz5-legend {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 6px;
  user-select: none;
}
.viz5-legend-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-mute);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.viz5-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 20px;
}
.viz5-legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.viz5-legend-val {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}

/* --- SVG --- */
.viz5-svg {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  max-height: 85vh;
  display: block;
}
.viz5-zone {
  stroke: var(--bg-card);
  stroke-width: 1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: filter 0.15s ease, stroke 0.15s ease;
  outline: none;
}
.viz5-zone:hover,
.viz5-zone.is-active {
  filter: brightness(1.08) saturate(1.1);
  stroke: var(--accent);
  stroke-width: 1.6;
}
.viz5-zone:focus-visible {
  stroke: var(--accent);
  stroke-width: 2;
}
.viz5-price {
  font-size: 11px;
  font-weight: 700;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.55);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* --- Tooltip --- */
.viz5-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(14px, -50%);
  min-width: 120px;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.viz5-tt-name {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text);
}
.viz5-tt-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.viz5-tt-price span {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-mute);
}
.viz5-tt-code {
  margin-top: 3px;
  font-size: 0.68rem;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

/* --- Footer --- */
.viz5-foot {
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--text-mute);
  text-align: center;
}
.viz5-foot .ti { font-size: 0.8rem; vertical-align: -1px; }

/* --- Responsive --- */
@media (max-width: 560px) {
  .viz5-stage { flex-direction: column; align-items: stretch; }
  .viz5-legend {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 12px;
    order: 2;
  }
  .viz5-legend-title { width: 100%; }
  .viz5-price { font-size: 9px; stroke-width: 2px; }
}

.viz5-zoombar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.viz5-zoombar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: pointer;
}
.viz5-zoombar button:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.viz5-zoom-range {
  width: 160px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* --- Controls bar (scale picker + show values) --- */
.viz5-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.viz5-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.viz5-check input { cursor: pointer; }
.viz5-scales {
  display: flex;
  gap: 4px;
}
.viz5-scale-btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text-soft);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.viz5-scale-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.viz5-scale-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Spread line + equal-price highlight ---------------------------------- */
.viz5-spread {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: .85;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.viz5-spread-detail { font-size: 11px; opacity: .65; }

.viz5-match {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 6px 9px;
  border-left: 2px solid #3FA9C4;
  background: rgba(63, 169, 196, .07);
}
.viz5-clear {
  margin-left: 6px;
  font: inherit;
  font-size: 10.5px;
  padding: 1px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  opacity: .7;
  cursor: pointer;
}
.viz5-clear:hover { opacity: 1; }

.viz5-zone { cursor: pointer; transition: opacity .18s ease; }
.viz5-zone.is-dimmed,
.viz5-price.is-dimmed { opacity: .18; }
.viz5-zone.is-matched { stroke: #111; stroke-width: 1.6; }
body.theme-dark .viz5-zone.is-matched { stroke: #fff; }