/* Shared styles — Edinburgh Bike Parking */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #222;
  background: #f5f5f5;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────── */
header {
  background: #2c3e50;
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  z-index: 1000;
}

header h1 { font-size: 16px; font-weight: 600; }

header nav { display: flex; gap: 4px; margin-left: auto; }

header nav a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background .15s;
}
header nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
header nav a.active { background: rgba(255,255,255,.18); color: #fff; }

/* ── Filter bar (finder) ─────────────────────────────────────── */
#filter-bar {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 8px 16px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
}

.filter-group label { display: flex; align-items: center; gap: 6px; }

.filter-group select {
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 6px;
  background: #fff;
  cursor: pointer;
}

#status-bar {
  font-size: 12px;
  color: #666;
  padding: 4px 16px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

/* ── Map ─────────────────────────────────────────────────────── */
#map { flex: 1; min-height: 0; }

/* ── Legend (finder, floating) ───────────────────────────────── */
#legend {
  position: absolute;
  bottom: 28px;
  right: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  z-index: 1000;
  box-shadow: 0 1px 5px rgba(0,0,0,.2);
  pointer-events: none;
}
#legend h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #999;
  margin-bottom: 6px;
}
.legend-row { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.legend-row:last-child { margin-bottom: 0; }
.legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.15);
  flex-shrink: 0;
}
.legend-diamond {
  width: 10px; height: 10px;
  transform: rotate(45deg);
  border: 2px solid rgba(0,0,0,.15);
  flex-shrink: 0;
}

/* ── Cluster markers ─────────────────────────────────────────── */
.bm-cluster {
  width: 32px; height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid rgba(0,0,0,.2);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* Cargo bike: rotated square marker */
.bm-cargo {
  width: 12px; height: 12px;
  transform: rotate(45deg);
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ── Popups ──────────────────────────────────────────────────── */
.popup-title {
  font-weight: 600;
  font-size: 13px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.popup-rows { width: 100%; border-collapse: collapse; font-size: 12px; }
.popup-rows td { padding: 2px 0; vertical-align: top; }
.popup-rows td:first-child { color: #888; width: 100px; }

.popup-osm-link { margin-top: 8px; font-size: 12px; }
.popup-warn { margin-top: 6px; font-size: 12px; color: #e67e22; }

/* ── Layer controls (compare) ────────────────────────────────── */
#layer-controls {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 8px 16px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.swatch {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.2);
  flex-shrink: 0;
}

/* ── Table section (compare) ─────────────────────────────────── */
#table-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid #ddd;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  padding: 0 16px;
  flex-shrink: 0;
  background: #fff;
}

.tab {
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  color: #666;
  font-size: 13px;
  white-space: nowrap;
}
.tab.active { border-bottom-color: #2c3e50; color: #2c3e50; }
.tab:hover:not(.active) { color: #444; }

.panel { display: none; flex: 1; overflow-y: auto; }
.panel.active { display: block; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  background: #2c3e50;
  color: #fff;
  padding: 6px 10px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
table.data-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
table.data-table tr { cursor: pointer; }
table.data-table tr:hover td { background: #f0f4f8; }

.diff-pos { color: #27ae60; font-weight: 600; }
.diff-neg { color: #e74c3c; font-weight: 600; }
.warn-cell { color: #e67e22; font-weight: 600; }

/* ── Links ───────────────────────────────────────────────────── */
a { color: #2980b9; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  header h1 { font-size: 14px; }
  header nav a { padding: 4px 7px; font-size: 12px; }
  #filter-bar { gap: 10px; padding: 6px 10px; }
  .tab { padding: 7px 10px; font-size: 12px; }
}
