/* ====================== BASIS & ROOT ====================== */
:root {
  --bg-body: #f4f7f6;
  --bg-list: #ffffff;
  --text-primary: #333;
  --text-secondary: #555;
  --border: #ddd;
  --shadow: rgba(0, 0, 0, 0.08);
  --touch-size: 48px; /* Mindest-Touch-Zielgröße */
  --success: #27ae60;
  --warning: #f39c12;
  --error: #e74c3c;
  --info: #3498db;
}

html.dark, body.dark {
  --bg-body: #121212;
  --bg-list: #1e1e1e;
  --text-primary: #e0e0e0;
  --text-secondary: #aaaaaa;
  --border: #444;
  --shadow: rgba(0, 0, 0, 0.6);
  --success: #2ecc71;
  --warning: #f1c40f;
  --error: #e74c3c;
  --info: #3498db;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: manipulation; /* Verhindert unnötiges Zoomen */
}

/* ====================== HEADER ====================== */
.header-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.header-section h1 {
  font-size: 1.75em;
  margin: 0 0 18px 0;
  text-align: center;
  font-weight: 600;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.header-actions button {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05em;
  border-radius: 10px;
  min-height: var(--touch-size);
  font-weight: 500;
  transition: all 0.2s ease;
}

/* Spezielle Button-Farben */
.test-alarm-btn {
  background: #e74c3c;
  color: white;
  border: none;
}

.test-alarm-btn:hover, .test-alarm-btn:active {
  background: #c0392b;
  transform: scale(1.02);
}

.refresh-btn, .theme-btn {
  background: var(--bg-list);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.refresh-btn:hover, .theme-btn:hover {
  background: var(--details-hover);
  border-color: #4a90e2;
}

/* ====================== STATUS & COUNTDOWN ====================== */
#last-updated,
#countdown-timer,
#status {
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  background: var(--bg-list);
}

#last-updated {
  color: var(--text-secondary);
  background: var(--bg-list);
}

#countdown-timer {
  color: var(--info);
  background: rgba(52, 152, 219, 0.08);
  border-color: rgba(52, 152, 219, 0.3);
}

#status {
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Status-Varianten */
#status.loading {
  background: rgba(52, 152, 219, 0.12);
  color: var(--info);
  border-color: var(--info);
  animation: pulse 1.8s infinite ease-in-out;
}

#status.success {
  background: rgba(39, 174, 96, 0.12);
  color: var(--success);
  border-color: var(--success);
}

#status.error {
  background: rgba(231, 76, 60, 0.12);
  color: var(--error);
  border-color: var(--error);
}

#status.warning {
  background: rgba(243, 156, 18, 0.12);
  color: var(--warning);
  border-color: var(--warning);
}

/* Puls-Animation für "wird aktualisiert" */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ====================== LIST CONTAINER ====================== */
#list-container {
  width: 100%;
  height: 45%;
  max-height: 55vh;
  overflow-y: auto;
  background: var(--bg-list);
  border-bottom: 2px solid var(--border);
  box-sizing: border-box;
  padding: 16px 14px;
  -webkit-overflow-scrolling: touch; /* iOS Smooth Scroll */
}

/* ====================== MAP ====================== */
#map-container {
  flex: 1;
  height: 55%;
  width: 100%;
}

/* ====================== CONTENT ====================== */
.category-section {
  margin-bottom: 22px;
}

.category-header {
  font-weight: bold;
  font-size: 1.35em;
  margin-bottom: 10px;
  padding: 8px 0;
}

.summary-section, .details-content {
  margin-bottom: 10px;
}

.report-item {
  background: var(--report-bg);
  border: 1px solid var(--border);
  border-left: 6px solid #ccc;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 8px;
  box-shadow: 0 2px 6px var(--shadow);
  font-size: 0.96em;
  min-height: 52px; /* besseres Touch-Ziel */
  transition: all 0.2s ease;
}

.report-item:active {
  transform: scale(0.98);
  box-shadow: 0 1px 3px var(--shadow);
}

.report-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 10px;
  font-size: 0.94em;
}

/* Visuelle Markierung für "Andere" */
.category-andere {
  background: #f8f8f8;
  border: 2px dashed #999;
  border-radius: 8px;
  padding: 14px;
}

html.dark .category-andere {
  background: #2a2a2a;
  border-color: #777;
}

/* ====================== IMPORTANT POPUP ====================== */
.important-popup {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e1e;
  color: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
  z-index: 10000;
  min-width: 300px;
  max-width: 92vw;
  border: 3px solid #e74c3c;
}

/* ====================== MEDIA QUERIES – RESPONSIVE ====================== */
@media (min-width: 901px) {
  body {
    flex-direction: row;
  }
  #list-container {
    width: 35%;
    height: 100%;
    border-bottom: none;
    border-right: 2px solid var(--border);
    padding: 20px;
    max-height: none;
  }
  #map-container {
    height: 100%;
  }
  .header-section h1 {
    text-align: left;
    font-size: 1.9em;
  }
  .header-actions {
    flex-direction: row;
    gap: 10px;
  }
  .header-actions button {
    width: auto;
    min-height: auto;
  }
}

/* Sehr kleine Handys */
@media (max-width: 380px) {
  #list-container {
    height: 48%;
  }
  #map-container {
    height: 52%;
  }
  .report-grid {
    grid-template-columns: 110px 1fr;
  }
}

/* Touch-Optimierungen */
button, .report-item, summary {
  touch-action: manipulation;
}

.report-item {
  cursor: pointer;
}

summary {
  padding: 12px 14px;
  min-height: 52px;
}

/* ====================== TOGGLE BUTTON ====================== */
.toggle-view-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05em;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 10px;
  min-height: 52px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.toggle-view-btn:hover {
  background: #2980b9;
}

.toggle-view-btn:active {
  transform: scale(0.98);
}

/* Zustand: Karte vergrößert (Liste minimiert) */
body.map-expanded #list-container {
  height: 68px !important;           /* nur Header sichtbar */
  overflow: hidden;
  padding-bottom: 0;
}

body.map-expanded #categories-container,
body.map-expanded #last-updated,
body.map-expanded #countdown-timer,
body.map-expanded #status {
  display: none;
}

body.map-expanded #map-container {
  height: calc(100% - 68px) !important;
}

/* ====================== RESPONSIVE ANPASSUNGEN ====================== */
@media (min-width: 901px) {
  .toggle-view-btn {
    display: none;   /* Auf Desktop nicht nötig */
  }
}

@media (max-width: 900px) {
  .header-actions {
    gap: 10px;
  }
}s