/* ─── FlugMonitor NRW · Design System ─────────────────────────────────────── */
:root {
  --bg:        #0a0c10;
  --bg2:       #111318;
  --bg3:       #181c24;
  --border:    #232836;
  --border2:   #2e3545;
  --text:      #e8eaf0;
  --text2:     #8890a4;
  --text3:     #555e72;
  --accent:    #3d7fff;
  --accent2:   #6fa3ff;
  --warn:      #ff6b35;
  --warn2:     #ff9a6b;
  --ok:        #2dd4a0;
  --ok2:       #6ee7c7;
  --danger:    #ff3b5c;
  --yellow:    #f5c842;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
  --radius:    8px;
  --radius-lg: 14px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent2);
}

.logo-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
}

.logo-sub {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text2);
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active {
  background: rgba(61, 127, 255, 0.12);
  color: var(--accent2);
  border-left: 2px solid var(--accent);
}

.nav-icon { font-size: 14px; opacity: 0.7; }

.badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
  min-width: 18px;
  text-align: center;
}

.badge:empty, .badge[data-n="0"] { display: none; }

.sidebar-status {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
}
.status-dot.online { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.status-dot.error  { background: var(--danger); }

/* ─── Main ───────────────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  position: relative;
}

.view {
  display: none;
  padding: 28px 32px;
  min-height: 100vh;
}
.view.active { display: block; }

.view-header {
  margin-bottom: 28px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.view-header h1 {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-meta {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-mono);
}

/* ─── KPI Cards ──────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.kpi-card.kpi-warn { border-color: rgba(255, 107, 53, 0.35); }

.kpi-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-warn .kpi-value { color: var(--warn); }

.kpi-sub {
  font-size: 11px;
  color: var(--text3);
}

/* ─── Dashboard Grid ─────────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 13px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}

.card-body {
  padding: 0;
}

/* ─── Lists ──────────────────────────────────────────────────────────────────── */
.list-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background 0.1s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg3); }

.list-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}
.icon-warn { background: rgba(255,107,53,0.15); color: var(--warn); }
.icon-ok   { background: rgba(45,212,160,0.12); color: var(--ok); }
.icon-info { background: rgba(61,127,255,0.12); color: var(--accent2); }

.list-body { flex: 1; min-width: 0; }
.list-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-sub {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--font-mono);
}

.list-action {
  flex-shrink: 0;
}

/* ─── Verstösse Table ────────────────────────────────────────────────────────── */
.verst-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.verst-table th {
  text-align: left;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.verst-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: middle;
}
.verst-table tr:hover td { background: var(--bg3); }
.verst-table tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tag-hoehe { background: rgba(255,59,92,0.15); color: #ff6b84; border: 1px solid rgba(255,59,92,0.3); }
.tag-nacht { background: rgba(245,200,66,0.12); color: var(--yellow); border: 1px solid rgba(245,200,66,0.3); }
.tag-flugzeit { background: rgba(255,107,53,0.12); color: var(--warn); border: 1px solid rgba(255,107,53,0.3); }

.tag-gemeldet { background: rgba(45,212,160,0.1); color: var(--ok); border: 1px solid rgba(45,212,160,0.25); }
.tag-offen    { background: rgba(255,59,92,0.1); color: #ff6b84; border: 1px solid rgba(255,59,92,0.25); }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: opacity 0.15s;
}
.btn-sm:hover { opacity: 0.8; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.btn-success   { background: rgba(45,212,160,0.2); color: var(--ok); border: 1px solid rgba(45,212,160,0.4); }
.btn-warn      { background: rgba(255,107,53,0.15); color: var(--warn); border: 1px solid rgba(255,107,53,0.3); }

/* ─── Map ────────────────────────────────────────────────────────────────────── */
#map-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  height: calc(100vh - 130px);
}
#map { width: 100%; height: 100%; }

.map-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(10,12,16,0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(6px);
  z-index: 1000;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text2);
  font-family: var(--font-mono);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.green { background: var(--ok); }
.legend-dot.red   { background: var(--danger); }
.legend-dot.blue  { background: var(--accent); }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h2 {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.modal-meta {
  background: rgba(255,107,53,0.08);
  border: 1px solid rgba(255,107,53,0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--warn2);
  font-family: var(--font-mono);
}
.modal-fields label {
  display: block;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 4px;
  margin-top: 12px;
}
.modal-fields input, .modal-fields textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
  resize: vertical;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ─── Settings ───────────────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.settings-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.settings-card .card-header { font-size: 11px; }
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.setting-row:last-child { border-bottom: none; }
.setting-key { color: var(--text2); }
.setting-val {
  font-family: var(--font-mono);
  color: var(--accent2);
  font-weight: 700;
  font-size: 13px;
}
.setting-law {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ─── Flugzeuge Table ────────────────────────────────────────────────────────── */
.flugzeuge-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.flugzeuge-table th {
  text-align: left;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.flugzeuge-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.flugzeuge-table tr:hover td { background: var(--bg3); }
.flugzeuge-table tr:last-child td { border-bottom: none; }

.kennzeichen-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(61,127,255,0.1);
  border: 1px solid rgba(61,127,255,0.2);
  padding: 2px 8px;
  border-radius: 4px;
}

.hoehe-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hoehe-bar {
  width: 60px;
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.hoehe-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.hoehe-ok    { background: var(--ok); }
.hoehe-warn  { background: var(--warn); }
.hoehe-crit  { background: var(--danger); }

/* ─── Misc ───────────────────────────────────────────────────────────────────── */
.loading {
  padding: 32px;
  text-align: center;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

.mono { font-family: var(--font-mono); }

/* Leaflet dark style overrides */
.leaflet-tile-pane { filter: brightness(0.7) saturate(0.6) invert(0.9) hue-rotate(180deg); }
.leaflet-control-attribution { display: none !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: none;
}
.leaflet-popup-content { color: var(--text); font-family: var(--font-sans); font-size: 13px; }
.leaflet-popup-tip { background: var(--bg2); }
