/* ============== Explore (polygon-driven browse) ============== */

.explore-body { background: var(--bg-soft); margin: 0; }

.explore-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100vh - 62px);
  min-height: 540px;
}

/* Left rail */
.rail {
  background: var(--bg);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.rail-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-2);
}
.rail-section:last-child { border-bottom: 0; flex: 1; }
.rail-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.rail-title small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--muted-2);
  font-size: 11px;
}
.rail-num {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
}
.rail-num.full {
  background: var(--amber-soft);
  color: var(--amber);
}

/* Segmented control */
.seg-group {
  display: flex;
  background: var(--bg-soft-2);
  border-radius: var(--r-md);
  padding: 3px;
  margin-bottom: 8px;
}
.seg-group .seg {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--t-sm);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--fast);
}
.seg-group .seg.active {
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

/* Selected list */
.selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.selected-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  font-size: var(--t-sm);
  font-weight: 500;
}
.selected-list li button {
  background: transparent;
  border: 0;
  color: var(--red);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-block { width: 100%; display: flex; justify-content: center; margin-bottom: 6px; }

/* Stats pane */
.stats-pane {
  background: linear-gradient(160deg, var(--bg) 0%, #FBFCFE 100%);
}
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: var(--t-sm);
  border-bottom: 1px dashed var(--line-2);
}
.stat-row:last-child { border-bottom: 0; }
.stat-row .v {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.stat-group .gh {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.trend-canvas-wrap {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
}

.stat-row.clickable-subtype {
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin: 0 -10px;
  transition: background var(--fast);
  border-bottom: 1px dashed var(--line-2);
}
.stat-row.clickable-subtype:hover {
  background: var(--accent-soft);
}
.stat-row.clickable-subtype:hover .chev { color: var(--accent); }
.chev {
  display: inline-block;
  color: var(--muted-2);
  font-weight: 700;
  margin-left: 4px;
  transition: transform var(--fast);
}
.stat-row.clickable-subtype:hover .chev {
  transform: translateX(2px);
}

.hint {
  font-size: var(--t-xs);
  color: var(--muted);
  margin: 0;
}

/* Map */
.map-container { position: relative; }
#map { width: 100%; height: 100%; }

.map-controls {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  gap: 10px;
  z-index: 10;
}
.control-pill {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  box-shadow: var(--sh-2);
  border: 1px solid var(--line);
  font-weight: 500;
}
.control-pill strong { color: var(--ink); font-weight: 700; }

/* Listings overlay (slides up from bottom) */
.listings-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-height: 60vh;
  background: var(--bg);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-4);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 240ms cubic-bezier(.22,.95,.3,1.04);
  z-index: 20;
}
.listings-overlay.hidden {
  transform: translateY(calc(100% + 30px));
  pointer-events: none;
}
.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.overlay-header h3 {
  font-family: var(--font-serif);
  font-size: var(--t-xl);
  font-weight: 600;
  margin: 4px 0 0;
}
.overlay-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.mini-card {
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 12px;
  cursor: pointer;
  border: 1px solid var(--line-2);
  transition: all var(--fast);
}
.mini-card:hover {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: var(--sh-1);
}
.mini-card .price {
  font-size: var(--t-md);
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.mini-card .addr {
  font-size: var(--t-sm);
  color: var(--body);
  margin-top: 2px;
}
.mini-card .meta {
  font-size: var(--t-xs);
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .explore-layout { grid-template-columns: 1fr; height: auto; }
  .rail { max-height: 50vh; }
  .map-container { height: 60vh; }
}
