/* Hamburg-Tracker — Editorial / Hafen-Look
   Inspiration: Zeitungsfreigabe, schwarzer Hafenstahl, signalrot
*/
:root {
  --bg: #f5f2eb;
  --bg-paper: #fafaf7;
  --ink: #161616;
  --ink-soft: #4a4a4a;
  --line: #d8d3c8;
  --line-strong: #161616;
  --accent: #c8102e;        /* HSV Hamburg-Rot */
  --accent-2: #1d4e89;      /* gegnerblau */
  --both: #6b2a8c;          /* mischfarbe */
  --warn: #c87a10;
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Menlo', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--bg);
  border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: var(--bg);
  padding: 2px 10px 0;
  line-height: 1;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.6;
}

.user-area {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-area .user-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}

/* ---- Layout ---- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
}
.sidebar {
  background: var(--bg-paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 45vh; }
}

/* ---- Panels ---- */
.panel {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 16px;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
}
.hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

/* ---- Standings ---- */
.standing-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.standing-row:last-child { border-bottom: none; }
.standing-row .swatch {
  width: 14px; height: 14px;
  display: inline-block;
}
.standing-row .name {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.05em;
}
.standing-row .score {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.02em;
}
.standing-row .score small {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-left: 4px;
}
.progress-bar {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--line);
  position: relative;
  margin-top: 4px;
}
.progress-bar .fill {
  position: absolute;
  inset: 0;
  width: var(--p, 0%);
  background: var(--c, var(--ink));
  transition: width 0.4s ease;
}

/* ---- Buttons ---- */
.btn {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent); }
.btn-small { padding: 6px 10px; font-size: 11px; }
.btn-strava { background: #fc4c02; }
.btn-strava:hover { background: #d63f00; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-danger { background: var(--accent); }

/* ---- Forms ---- */
form label {
  display: block;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
form input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--bg-paper);
  font-family: var(--font-body);
  font-size: 14px;
  margin-top: 4px;
  color: var(--ink);
}
form input:focus { outline: 2px solid var(--accent); }
.coord-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.add-form {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}
.add-form summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ---- Addresses list ---- */
.address-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.address-item .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.address-item button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

/* ---- Activities ---- */
.activities-list {
  max-height: 50vh;
  overflow-y: auto;
  margin-top: 8px;
}
.activity {
  border: 1px solid var(--line);
  margin-bottom: 8px;
  padding: 10px;
  background: var(--bg-paper);
  font-size: 13px;
}
.activity .act-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.activity .act-name {
  font-weight: 600;
  flex: 1;
  margin-right: 8px;
}
.activity .act-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.activity .act-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.activity .act-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.activity .badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  display: inline-block;
}
.activity .badge.counted { background: var(--ink); color: var(--bg); }
.activity .badge.invalid { background: var(--warn); color: var(--bg); }
.activity .badge.valid { background: #2d6e3e; color: var(--bg); }
.activity .districts {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
}

.sync-status {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  min-height: 16px;
  margin-bottom: 8px;
}

/* ---- Map ---- */
.map-wrap {
  position: relative;
  overflow: hidden;
}
#map {
  width: 100%; height: 100%;
}
.map-legend {
  position: absolute;
  bottom: 18px; left: 18px;
  background: var(--bg-paper);
  border: 1px solid var(--line-strong);
  padding: 10px 14px;
  z-index: 500;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 4px 4px 0 var(--ink);
}
.legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
}
.swatch {
  display: inline-block;
  width: 16px; height: 12px;
  border: 1px solid var(--ink);
}
.swatch-open { background: transparent; }
.swatch-you  { background: var(--accent); opacity: 0.45; }
.swatch-bro  { background: var(--accent-2); opacity: 0.45; }
.swatch-both { background: var(--both); opacity: 0.6; }

.progress-overlay {
  position: absolute;
  top: 18px; right: 18px;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  z-index: 500;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.05em;
  box-shadow: 4px 4px 0 var(--accent);
}
.progress-overlay small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.7;
  margin-top: 2px;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 22, 22, 0.65);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-paper);
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 var(--accent);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: var(--bg);
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.08em;
  margin: 0;
  border: none;
  padding: 0;
}
.modal-head .close-btn {
  background: none;
  border: none;
  color: var(--bg);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}
.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.modal-foot .summary {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.bulk-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
}
.bulk-toolbar .filter-input {
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 13px;
  flex: 1;
  min-width: 180px;
}
.bulk-toolbar select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-paper);
}

.bulk-list {
  border: 1px solid var(--line);
}
.bulk-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  background: var(--bg-paper);
}
.bulk-row:nth-child(even) { background: var(--bg); }
.bulk-row:last-child { border-bottom: none; }
.bulk-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
}
.bulk-row .bulk-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.bulk-row .bulk-name {
  font-weight: 500;
}
.bulk-row .badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 6px;
  letter-spacing: 0.05em;
}
.badge-counted { background: var(--ink); color: var(--bg); }
.badge-new { background: var(--accent); color: var(--bg); }

.progress-msg {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  margin-bottom: 12px;
}
.progress-msg.error { background: var(--warn); }

/* ---- Leaflet overrides ---- */
.leaflet-popup-content-wrapper {
  border-radius: 0;
  background: var(--bg-paper);
  border: 1px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--ink);
}
.leaflet-popup-tip { background: var(--bg-paper); }
.leaflet-popup-content {
  font-family: var(--font-body);
  font-size: 13px;
  margin: 12px 16px;
}
.leaflet-popup-content strong {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.leaflet-popup-content .bezirk {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
