/* SCHNEEKARTE — Design System Implementation
   Typography: monospace primary (JetBrains Mono / system), sans secondary
   Color: dark theme, cool terminal palette with functional accents
   Layout: rigid grid, bordered panels, flat opaque fields */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@400;500&display=swap');

:root {
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: 'Inter', system-ui, sans-serif;

  --bg-0: #0a0a0c;
  --bg-1: #111114;
  --bg-2: #1a1a1e;
  --bg-3: #242428;

  --border: #2a2a30;
  --border-strong: #3a3a42;

  --text-primary: #e8e8ec;
  --text-secondary: #8888a0;
  --text-muted: #55556a;

  --accent: #e09030;
  --accent-dim: #a06820;
  --status-ok: #30a060;
  --status-error: #c03030;
  --status-loading: #6080c0;

  --snow-trace: #e8e8e8;
  --sidebar-width: 320px;
  --header-height: 40px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* === HEADER === */
#header {
  height: var(--header-height);
  background: var(--bg-1);
  border-bottom: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 12px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.header-sub {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.header-sep {
  color: var(--border-strong);
  font-weight: 300;
}

.header-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.header-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-box {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border: 1px solid;
}

.status-loading {
  color: var(--status-loading);
  border-color: var(--status-loading);
  background: rgba(96, 128, 192, 0.1);
}

.status-ok {
  color: var(--status-ok);
  border-color: var(--status-ok);
  background: rgba(48, 160, 96, 0.1);
}

.status-error {
  color: var(--status-error);
  border-color: var(--status-error);
  background: rgba(192, 48, 48, 0.1);
}

/* === LAYOUT === */
#layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: calc(100vh - var(--header-height));
}

/* === SIDEBAR === */
#sidebar {
  background: var(--bg-1);
  border-right: 2px solid var(--border-strong);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-track {
  background: var(--bg-1);
}

#sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}

/* === PANELS === */
.panel {
  border-bottom: 1px solid var(--border);
}

.panel-header {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

.panel-body {
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* === FIELDS === */
.field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.field-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}

.field-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* === SEGMENTED CONTROLS (TIMESTEP BUTTONS) === */
.segmented-controls {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.seg-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  color: var(--text-secondary);
  cursor: pointer;
  flex: 1;
  text-align: center;
  min-width: 44px;
}

.seg-btn:hover {
  background: var(--bg-3);
  color: var(--text-primary);
}

.seg-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text-primary);
  font-weight: 700;
}

/* === CONTROLS === */
.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  background: var(--bg-2);
  cursor: pointer;
  position: relative;
}

.toggle-label input[type="checkbox"]:checked {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 8px;
  height: 8px;
  background: var(--accent);
}

.toggle-text {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.input-field {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  color: var(--text-primary);
  width: 80px;
  outline: none;
}

.input-field:focus {
  border-color: var(--accent);
}

.input-unit {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.btn {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border: 1px solid var(--accent);
  background: var(--bg-2);
  color: var(--accent);
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}

/* === SLIDER === */
.slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  outline: none;
  flex: 1;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* === LEGEND === */
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 1px 0;
}

.legend-swatch {
  width: 20px;
  height: 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.legend-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* === FOOTER === */
.panel-footer {
  padding: 8px 12px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-text {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* === MAP === */
#map {
  width: 100%;
  height: 100%;
  background: var(--bg-0);
}

/* Override Leaflet controls for design consistency */
.leaflet-control-zoom a {
  font-family: var(--mono) !important;
  background: var(--bg-2) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 0 !important;
  width: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
  font-size: 14px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-3) !important;
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 0 !important;
}

.leaflet-control-attribution {
  font-family: var(--mono) !important;
  font-size: 8px !important;
  background: var(--bg-1) !important;
  color: var(--text-muted) !important;
  border: none !important;
  padding: 2px 6px !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* Subtle dim on base tiles — labels are on a separate pane above overlays */
.leaflet-tile-pane {
  filter: brightness(0.9) saturate(0.5);
}

/* Snow/elevation overlays use their native colors */
.snow-overlay, .elev-overlay {
  filter: none;
}
