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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2235;
  --border: #1e2d45;
  --accent-primary: #00d4ff;
  --accent-secondary: #0066cc;
  --alert-high: #ff3b5c;
  --alert-medium: #ff9500;
  --alert-low: #34c759;
  --text-primary: #e8f4fd;
  --text-secondary: #8ba3c1;
  --text-muted: #4a6480;
  --chart-grid: #1a2a3a;
  --radius: 8px;
}

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

html { font-size: 14px; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #00d4ff, #0066cc);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.header-logo-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.header-logo-text span { color: var(--accent-primary); }

.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.header-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.header-week {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green {
  background: var(--alert-low);
  box-shadow: 0 0 6px var(--alert-low);
  animation: pulse-green 2s infinite;
}

.status-dot.red { background: var(--alert-high); }

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.header-fetch-info {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Alert Banner ── */
#alert-banner {
  display: none;
  background: rgba(255, 59, 92, 0.08);
  border-bottom: 1px solid rgba(255, 59, 92, 0.2);
  height: 36px;
  overflow: hidden;
  position: relative;
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
}

@keyframes ticker-scroll {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

.ticker-item {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 0 8px;
}

.ticker-item.alert-high { color: var(--alert-high); }
.ticker-item.alert-medium { color: var(--alert-medium); }
.ticker-item.alert-low { color: var(--alert-low); }
.ticker-item.ticker-info { color: var(--text-secondary); }
.ticker-item.ticker-pending { color: var(--text-muted); font-style: italic; }
.ticker-item.ticker-hanta { color: var(--accent-primary); font-weight: 700; letter-spacing: 0.02em; }
/* Ticker pausiert bei Hover */
.ticker-track:hover { animation-play-state: paused; cursor: default; }

/* ── Hanta Focus Bar ── */
#hanta-focus-bar {
  background: rgba(0, 212, 255, 0.04);
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.hf-label {
  color: #ff3b5c;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(255, 59, 92, 0.5);
}

.hf-divider {
  width: 1px;
  height: 16px;
  background: rgba(0, 212, 255, 0.2);
  flex-shrink: 0;
}

.hf-status {
  color: var(--text-primary);
  white-space: nowrap;
}

.hf-meta {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}
.ticker-sep { color: var(--text-muted); }
.trend-up-sm { color: var(--alert-medium); font-size: 11px; }
.trend-dn-sm { color: var(--alert-low); font-size: 11px; }

/* ── Layout ── */
.main-layout {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1800px;
  margin: 0 auto;
}

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

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
}

.kpi-label {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

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

.kpi-sub.ok { color: var(--alert-low); }

/* ── Charts section ── */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  min-height: 400px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}

.card-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.card-body {
  padding: 16px 20px;
  flex: 1;
  overflow: auto;
  position: relative;
}

.card-body.no-pad { padding: 0; }

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

select.ctrl-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
}

select.ctrl-select:focus { border-color: var(--accent-primary); }

.chart-wrapper {
  position: relative;
  height: 320px;
}

#chart-loading {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.7);
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Germany Map ── */
.map-card { min-height: 400px; }

.germany-map-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

#germany-map {
  flex: 1;
  max-height: 280px;
  width: 100%;
}

.state {
  fill: #1a2a3a;
  stroke: #0a0e1a;
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.3s ease;
}

.state:hover { stroke: var(--accent-primary); stroke-width: 2; filter: brightness(1.3); }
.state-selected { stroke: var(--accent-primary) !important; stroke-width: 2.5 !important; }

#map-tooltip {
  display: none;
  position: absolute;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  color: var(--text-primary);
}

/* ── Region bars ── */
.region-bars { display: flex; flex-direction: column; gap: 6px; }

.region-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 45px;
  align-items: center;
  gap: 8px;
}

.region-bar-name {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-bar-track {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.region-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.region-bar-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-primary);
  text-align: right;
}

/* ── Disease Table ── */
.disease-table-wrapper { overflow-x: auto; }

.disease-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.disease-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.disease-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(30, 45, 69, 0.5);
  vertical-align: middle;
}

.disease-table td.num {
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.disease-row {
  cursor: pointer;
  transition: background 0.15s;
}

.disease-row:hover { background: var(--bg-tertiary); }
.disease-row.active { background: rgba(0, 212, 255, 0.06); }
.disease-row.active td:first-child { border-left: 2px solid var(--accent-primary); }

.disease-name { font-weight: 500; }

.category-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.cat-zoonosen { background: rgba(52, 199, 89, 0.15); color: #34c759; }
.cat-atemwege { background: rgba(0, 212, 255, 0.12); color: var(--accent-primary); }
.cat-gastrointestinal { background: rgba(255, 149, 0, 0.12); color: var(--alert-medium); }
.cat-reiseassoziiert { background: rgba(175, 82, 222, 0.15); color: #af52de; }
.cat-impfpr-ventabel { background: rgba(255, 59, 92, 0.12); color: var(--alert-high); }
.cat-lebensmittel { background: rgba(255, 214, 10, 0.12); color: #ffd60a; }

.trend-high { color: var(--alert-high); font-weight: 600; }
.trend-medium { color: var(--alert-medium); font-weight: 500; }
.trend-low-up { color: #ffd60a; }
.trend-down { color: var(--alert-low); }
.trend-neutral { color: var(--text-muted); }

.alert-icon { margin-left: 4px; }

.pending-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(74, 100, 128, 0.15);
  color: var(--text-muted);
  font-style: italic;
  border: 1px solid rgba(74, 100, 128, 0.2);
  white-space: nowrap;
  cursor: help;
}

.disease-table td[title] { cursor: help; }

.source-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}
.source-real {
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
  border: 1px solid rgba(52, 199, 89, 0.3);
}
.source-estimated {
  background: rgba(139, 163, 193, 0.1);
  color: #8ba3c1;
  border: 1px solid rgba(139, 163, 193, 0.2);
}

/* ── Heatmap ── */
.heatmap-wrapper { display: flex; flex-direction: column; gap: 8px; position: relative; }

.heatmap-week-labels {
  position: relative;
  height: 16px;
  margin-left: 40px;
}

.hm-wl {
  position: absolute;
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  transform: translateX(-50%);
}

.heatmap-grid { display: flex; flex-direction: column; gap: 3px; }

.hm-row { display: flex; align-items: center; gap: 6px; }

.hm-year {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

.hm-cells { display: flex; gap: 2px; flex-wrap: nowrap; }

.hm-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  cursor: default;
  transition: transform 0.1s;
  flex-shrink: 0;
}

.hm-cell:hover { transform: scale(1.4); z-index: 5; }

.hm-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 40px;
  margin-top: 4px;
}

.hm-leg-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-width: 20px;
}

/* ── Fetch log ── */
.fetch-log-table { width: 100%; border-collapse: collapse; font-size: 12px; }

.fetch-log-table th {
  padding: 8px 12px;
  text-align: left;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.fetch-log-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(30, 45, 69, 0.5);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.status-SUCCESS { background: rgba(52, 199, 89, 0.15); color: var(--alert-low); }
.status-PARTIAL { background: rgba(255, 149, 0, 0.15); color: var(--alert-medium); }
.status-ERROR   { background: rgba(255, 59, 92, 0.15); color: var(--alert-high); }
.status-RUNNING { background: rgba(0, 212, 255, 0.12); color: var(--accent-primary); }
.status-DEMO    { background: rgba(175, 82, 222, 0.15); color: #af52de; }

/* ── Two-column bottom row ── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Toast ── */
.toast {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 999;
  max-width: 320px;
}

.toast-success { background: rgba(52, 199, 89, 0.15); border: 1px solid var(--alert-low); color: var(--alert-low); }
.toast-error   { background: rgba(255, 59, 92, 0.15); border: 1px solid var(--alert-high); color: var(--alert-high); }

/* ── Help Button ── */
.btn-help {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.btn-help:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* ── Info Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 820px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-primary);
}

.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  padding: 10px 18px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.modal-tab:hover { color: var(--text-secondary); }
.modal-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

.modal-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.modal-content h3 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.modal-content h3:first-child { margin-top: 0; }

.modal-content p { margin-bottom: 10px; }

.modal-content strong { color: var(--text-primary); }

.modal-content a {
  color: var(--accent-secondary);
  text-decoration: none;
}
.modal-content a:hover { color: var(--accent-primary); text-decoration: underline; }

.modal-source {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.disease-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.disease-info-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

.disease-info-card .dic-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 4px;
}

.disease-info-card .dic-cat {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.disease-info-card .dic-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
}

.disease-info-card .dic-link {
  font-size: 11px;
}

.terms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.term-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(30,45,69,0.5);
}

.term-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
}

.term-val { font-size: 12px; }

/* ── Footer ── */
.footer {
  margin-top: 32px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

.footer a { color: var(--accent-secondary); text-decoration: none; }
.footer a:hover { color: var(--accent-primary); }
.disclaimer { margin-top: 8px; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .charts-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .header-center { display: none; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .main-layout { padding: 12px; }
}
