/* ============================================================
   Design tokens — Bloomberg-inspired monochrome
   ============================================================ */
:root {
  --bg:           #050505;
  --panel:        #0c0c0c;
  --elevated:     #141414;
  --border:       #222222;
  --border-mid:   #333333;
  --text:         #ebebeb;
  --text-muted:   #787878;
  --text-dim:     #3d3d3d;
  --data:         #ffffff;
  --snow:         #a8c8e8;   /* snow depth numbers — only non-grey color */
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

/* ============================================================
   Layout
   ============================================================ */
body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Left Panel
   ============================================================ */
#filter-panel {
  width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border-mid);
  overflow: hidden;
  z-index: 1000;
}

/* Header */
#panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 2px solid var(--text);
  flex-shrink: 0;
  gap: 10px;
}

#panel-header h1 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

#match-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Sidebar toggle button (in header) */
#sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  font-family: inherit;
  padding: 0;
}
#sidebar-toggle:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Sidebar show button (floats on map when panel is hidden) */
#sidebar-show {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1500;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  font-family: inherit;
  padding: 0;
}
#sidebar-show:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Status bar */
.status-bar {
  padding: 6px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  border-left: 2px solid var(--text-muted);
  flex-shrink: 0;
}
.status-bar.error {
  color: #cc4444;
  border-left-color: #cc4444;
}

/* Scrollable filters area */
#filters {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}
#filters::-webkit-scrollbar { width: 3px; }
#filters::-webkit-scrollbar-track { background: transparent; }
#filters::-webkit-scrollbar-thumb { background: var(--border-mid); }

/* Filter sections */
.filter-section {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.filter-section h2 {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ============================================================
   Pass toggle buttons
   ============================================================ */
#pass-toggle-group {
  display: flex;
  gap: 6px;
}

.pass-btn {
  flex: 1;
  padding: 6px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.pass-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.pass-btn:not(.active):hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

/* ============================================================
   Sliders
   ============================================================ */
.slider-group {
  margin-bottom: 18px;
}
.slider-group:last-child { margin-bottom: 4px; }

.slider-group label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.range-display {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* noUiSlider overrides */
.noUi-target {
  background: var(--border-mid);
  border: none;
  box-shadow: none;
  height: 2px;
  border-radius: 0;
}

.noUi-connect {
  background: var(--text);
  border-radius: 0;
}

.noUi-handle {
  width: 12px !important;
  height: 12px !important;
  top: -5px !important;
  right: -6px !important;
  border-radius: 0;
  border: 1px solid var(--text);
  background: var(--panel);
  box-shadow: none;
  cursor: pointer;
}
.noUi-handle:hover { background: var(--text); }
.noUi-handle::before,
.noUi-handle::after { display: none; }

/* ============================================================
   Reset button
   ============================================================ */
#reset-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 16px 16px 0;
  padding: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
#reset-btn:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ============================================================
   Map container
   ============================================================ */
#map-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#map {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* ============================================================
   Top 5 Table (floating card)
   ============================================================ */
#top5-container {
  position: absolute;
  bottom: 36px;
  right: 12px;
  width: 240px;
  background: rgba(10, 10, 10, 0.96);
  border: 1px solid var(--border-mid);
  border-radius: 0;
  box-shadow: none;
  z-index: 890;
  overflow: hidden;
  font-size: 12px;
}

#top5-header {
  padding: 7px 10px 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

#top5-table {
  width: 100%;
  border-collapse: collapse;
}

#top5-table thead th {
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#top5-table thead th:first-child { width: 20px; text-align: center; }
#top5-table thead th:last-child   { text-align: right; }

#top5-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text-muted);
}

#top5-table tbody tr:last-child td { border-bottom: none; }
#top5-table tbody tr:hover td { background: var(--elevated); }

#top5-table tbody td:first-child {
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

#top5-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--text);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#top5-table tbody td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--snow);
  font-variant-numeric: tabular-nums;
}

.top5-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 10px;
}

/* ============================================================
   Map Legend
   ============================================================ */
.map-legend {
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid var(--border-mid);
  border-radius: 0;
  padding: 10px 12px;
  font-size: 11px;
  font-family: "Inter", sans-serif;
  color: var(--text-muted);
  line-height: 1.9;
  box-shadow: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  display: inline-block;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   Mountain tooltip
   ============================================================ */
.mountain-tooltip {
  background: #000 !important;
  border: 1px solid var(--border-mid) !important;
  border-radius: 0 !important;
  color: var(--text) !important;
  font-family: "Inter", sans-serif !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  padding: 4px 8px !important;
  box-shadow: none !important;
  white-space: nowrap;
}
.mountain-tooltip::before { display: none !important; }

/* ============================================================
   Detail Panel
   ============================================================ */
#detail-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 270px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  background: rgba(10, 10, 10, 0.97);
  border: 1px solid var(--border-mid);
  border-radius: 0;
  box-shadow: none;
  z-index: 900;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}
#detail-panel::-webkit-scrollbar { width: 3px; }
#detail-panel::-webkit-scrollbar-thumb { background: var(--border-mid); }

#detail-panel.hidden { display: none; }

#detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  transition: background 0.1s, color 0.1s;
}
#detail-close:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

#detail-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
  padding-right: 28px;
  color: var(--data);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

#detail-content .detail-state {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 14px;
}
.detail-badge.epic        { background: #0057a8; }
.detail-badge.ikon        { background: #a83240; }
.detail-badge.independent { background: #3a6b3e; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  padding: 9px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.detail-stat:nth-child(even) { border-right: none; }
.detail-stat:nth-last-child(-n+2) { border-bottom: none; }

.detail-stat .label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.detail-stat .value {
  font-size: 16px;
  font-weight: 700;
  color: var(--data);
  font-variant-numeric: tabular-nums;
}

.detail-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.live-conditions h4 {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.live-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.live-row:last-of-type { border-bottom: none; }

.live-row .live-val {
  font-weight: 700;
  color: var(--snow);
  font-variant-numeric: tabular-nums;
}
.live-row .live-val.na { color: var(--text-dim); }

.conditions-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-mid);
  padding-bottom: 1px;
  transition: color 0.1s, border-color 0.1s;
}
.conditions-link:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.price-row:last-of-type { border-bottom: none; }
.price-row .price-val {
  font-weight: 700;
  color: var(--data);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Utility
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 640px) {
  body { flex-direction: column; }

  #filter-panel {
    width: 100%;
    min-width: unset;
    height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--border-mid);
  }

  #map-container {
    height: 55vh;
    flex: unset;
  }

  #detail-panel {
    top: auto;
    bottom: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 50vh;
  }

  #top5-container { display: none; }
}
