/* ───────────────────────────────────────────
   GeoMeasure — style.css
   Aesthetic: Industrial / utilitarian dark
─────────────────────────────────────────── */

:root {
  --bg:        #0e0f11;
  --bg2:       #15171a;
  --bg3:       #1c1f24;
  --border:    #2a2d34;
  --accent:    #00e5a0;
  --accent2:   #0099ff;
  --danger:    #ff4d6a;
  --text:      #e8eaf0;
  --muted:     #6b7280;
  --sidebar-w: 260px;
  --radius:    6px;
  --font-mono: 'Space Mono', monospace;
  --font-ui:   'DM Sans', sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

body { display: flex; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  padding-bottom: 16px;
}

.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.logo-icon { font-size: 18px; color: var(--accent); line-height: 1; }
.logo-text strong { color: var(--text); }

.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 16px 6px;
}

/* ── Tools ── */
.tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.tool-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border); }
.tool-btn.active { background: rgba(0,229,160,0.08); color: var(--accent); border-color: rgba(0,229,160,0.25); }

.tool-icon { font-size: 15px; line-height: 1; }

/* ── Stats ── */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px;
}

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.2s;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ── Map style switcher ── */
.map-styles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px;
}

.style-btn {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.style-btn:hover { background: var(--bg3); color: var(--text); }
.style-btn.active { background: rgba(0,153,255,0.1); color: var(--accent2); border-color: rgba(0,153,255,0.3); }

/* ── Actions ── */
.actions {
  display: flex;
  gap: 6px;
  padding: 6px 10px 0;
}

.action-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
}

.action-btn.undo { color: var(--muted); }
.action-btn.undo:hover { background: var(--bg3); color: var(--text); }
.action-btn.clear { color: var(--danger); border-color: rgba(255,77,106,0.25); }
.action-btn.clear:hover { background: rgba(255,77,106,0.1); }

/* ── Instructions ── */
.instructions {
  margin: 10px 10px 0;
  padding: 10px 12px;
  background: rgba(0,229,160,0.04);
  border: 1px solid rgba(0,229,160,0.12);
  border-radius: var(--radius);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.instructions strong { color: var(--accent); }

/* ── Map ── */
#map {
  flex: 1;
  height: 100%;
  background: var(--bg);
}

/* Leaflet overrides */
.leaflet-container { background: #1a1c20; font-family: var(--font-ui); }

.leaflet-control-zoom a {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: var(--bg3) !important; color: var(--accent) !important; }

.leaflet-control-attribution {
  background: rgba(14,15,17,0.8) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--accent2) !important; }

/* ── Popup ── */
.leaflet-popup-content-wrapper {
  background: var(--bg2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
  color: var(--text) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
}
.leaflet-popup-tip { background: var(--bg2) !important; }
.leaflet-popup-close-button { color: var(--muted) !important; }

/* ── Mode badge ── */
.mode-badge {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-w) + 16px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  z-index: 999;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: all 0.2s;
}

/* ── Segment label ── */
.segment-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.segment-label div {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #fff;
  background: rgba(0,229,160,0.85);
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Scrollbar ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Cursor on map while measuring ── */
#map.measuring-mode { cursor: crosshair !important; }
