/* Messstationen LWD Kärnten - Styles */

/* CSS Variables */
:root {
  --panel-width: 320px;
  --panel-bg: rgba(255, 255, 255, 0.85);
  --panel-blur: blur(20px);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  --primary: #0ea5e9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: rgba(226, 232, 240, 0.8);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Map */
#map {
  height: 100vh;
  width: 100%;
  height: 100dvh;
}

/* Control Panel */
.control-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: var(--panel-width);
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  background: var(--panel-bg);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-size: 17px;
  font-weight: 600;
}

.data-source {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Sections */
.section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Parameter Select */
.param-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: none;
}

/* Legend */
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-color {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Layer Toggles */
.layer-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 8px;
}

.layer-toggle:last-child {
  margin-bottom: 0;
}

.layer-toggle.active {
  border-color: #059669;
  background: rgba(5, 150, 105, 0.1);
}

.layer-toggle-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-toggle.active .layer-toggle-checkbox {
  background: #059669;
  border-color: #059669;
}

.layer-toggle-checkbox svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
  opacity: 0;
}

.layer-toggle.active .layer-toggle-checkbox svg {
  opacity: 1;
}

.layer-toggle-label {
  font-size: 13px;
  font-weight: 500;
}

.layer-toggle-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.layer-toggle.webcam-toggle.active {
  border-color: #475569;
  background: rgba(0, 0, 0, 0.1);
}

.layer-toggle.webcam-toggle.active .layer-toggle-checkbox {
  background: #475569;
  border-color: #475569;
}

/* Wind Toggle */
.layer-toggle.wind-toggle.active {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.1);
}

.layer-toggle.wind-toggle.active .layer-toggle-checkbox {
  background: #0ea5e9;
  border-color: #0ea5e9;
}

/* Snowfall Toggle */
.layer-toggle.snowfall-toggle.active {
  border-color: #08519C;
  background: rgba(8, 81, 156, 0.1);
}

.layer-toggle.snowfall-toggle.active .layer-toggle-checkbox {
  background: #08519C;
  border-color: #08519C;
}

.snowfall-panel-legend {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.8);
  border-radius: 8px;
}

.snowfall-panel-legend.visible {
  display: block;
}

/* Schneefall region tooltip */
.schneefall-tooltip {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  font-family: inherit;
  line-height: 1.4;
}
.schneefall-tooltip::before {
  border-top-color: rgba(255, 255, 255, 0.95) !important;
}

/* Remove Leaflet focus rectangle on polygon click */
.leaflet-interactive:focus {
  outline: none !important;
}

/* Gefahrenstufen Toggle */
.layer-toggle.gefahr-toggle.active {
  border-color: #1e293b;
  background: rgba(30, 41, 59, 0.08);
}
.layer-toggle.gefahr-toggle.active .layer-toggle-checkbox {
  background: #1e293b;
  border-color: #1e293b;
}
.gefahr-panel-legend {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.8);
  border-radius: 8px;
}
.gefahr-panel-legend.visible {
  display: block;
}
.gefahr-tooltip {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  font-family: inherit;
  line-height: 1.4;
}
.gefahr-tooltip::before {
  border-top-color: rgba(255, 255, 255, 0.95) !important;
}

.gefahr-badge-icon {
  background: none !important;
  border: none !important;
}
.gefahr-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  line-height: 1;
}

/* Radiation Toggle */
.layer-toggle.radiation-toggle.active {
  border-color: #1e3a5f;
  background: rgba(30, 58, 95, 0.1);
}

.layer-toggle.radiation-toggle.active .layer-toggle-checkbox {
  background: #1e3a5f;
  border-color: #1e3a5f;
}

.radiation-panel-legend {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.8);
  border-radius: 8px;
}

.radiation-panel-legend.visible {
  display: block;
}

/* Wind Transport Layer */
.cloud-icon {
  pointer-events: none;
  will-change: transform;
  contain: layout style paint;
}

.wind-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.wind-mode-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wind-mode-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.wind-mode-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.wind-mode-btn:hover {
  color: var(--text);
  border-color: #d1d5db;
}

.wind-mode-btn.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.wind-timeline-wrap {
  display: none;
  flex-direction: column;
  gap: 4px;
}

.wind-timeline-track {
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: visible;
}

.wind-timeline-track .wind-slider {
  position: absolute;
  top: -5px;
  left: 0;
  width: 100%;
  height: 16px;
  background: transparent;
  margin: 0;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.wind-timeline-track .wind-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.wind-timeline-track .wind-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.wind-timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.wind-time-display {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
}

.wind-forecast-btn {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  transition: all 0.15s;
}

.wind-forecast-btn:hover {
  border-color: #d1d5db;
}

.wind-forecast-btn.active {
  background: #475569;
  color: white;
  border-color: #475569;
}

.wind-max-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.wind-max-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.wind-max-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.wind-max-unit {
  font-size: 11px;
  color: var(--text-muted);
}

/* Wind Panel Legend (inside control panel) */
.wind-panel-legend {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.8);
  border-radius: 8px;
}

.wind-panel-legend.visible {
  display: block;
}

.wind-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.wind-legend-item:last-child { margin-bottom: 0; }

.wind-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.wind-density-row {
  margin: 8px 0 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.wind-density-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}
.wind-density-select {
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.7);
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.wind-density-select:focus {
  border-color: var(--primary);
}
.wind-density-info {
  font-size: 9px;
  font-weight: 600;
  margin-top: 3px;
  color: var(--primary);
}

.wind-legend-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.wind-scale-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.wind-scale-bar {
  height: 6px;
  min-width: 8px;
  border-left: 1.5px solid var(--text-muted);
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transition: width 0.3s;
}

.wind-scale-row .wind-scale-value {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Webcam Markers */
.webcam-marker {
  background: #475569;
  border: 2px solid white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.webcam-tooltip {
  background: white !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  color: #475569 !important;
}

/* Webcam Map Button */
.map-webcam-btn {
  position: fixed;
  top: 42px;
  right: 12px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #64748b;
}
.map-webcam-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
  color: #475569;
}
.map-webcam-btn.active {
  background: #475569;
  color: white;
  box-shadow: 0 2px 12px rgba(71, 85, 105, 0.4), 0 0 0 1px rgba(71, 85, 105, 0.2);
}
.map-webcam-btn.active:hover {
  background: #334155;
}
.map-webcam-btn svg {
  width: 20px;
  height: 20px;
}

.webcam-popup-content {
  text-align: center;
  min-width: 200px;
}

.webcam-popup-content a {
  display: inline-block;
  background: #475569;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.webcam-popup-content a:hover {
  background: #e2e8f0;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
}

.search-box .clear {
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  padding: 4px;
}

.search-box .clear.visible {
  display: block;
}

.search-results {
  margin-top: 8px;
  max-height: 150px;
  overflow-y: auto;
  display: none;
}

.search-results.visible {
  display: block;
}

.search-result-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
}

.search-result-item:hover {
  background: rgba(14, 165, 233, 0.1);
}

.search-result-name {
  font-weight: 600;
  font-size: 13px;
}

.search-result-info {
  font-size: 11px;
  color: var(--text-muted);
}

/* Station List */
.station-list {
  max-height: 200px;
  overflow-y: auto;
}

.station-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.station-item:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: var(--primary);
}

.station-item-name {
  font-size: 13px;
  font-weight: 600;
}

.station-item-alt {
  font-size: 12px;
  color: var(--text-muted);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Popup Overlay */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
}

.popup-overlay.active {
  display: block;
}

/* Station Popup */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  z-index: 2001;
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.popup.active {
  display: flex;
}

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

.popup-title {
  font-size: 18px;
  font-weight: 700;
}

.forecast-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #475569;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

.close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #e2e8f0;
}

.close-btn svg {
  width: 16px;
  height: 16px;
  stroke: #64748b;
  stroke-width: 2.5;
}

.popup-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.popup-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 20px;
  background: #f8fafc;
  margin: 16px;
  border-radius: 12px;
}

.info-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 2px;
}

.info-value {
  font-size: 14px;
  font-weight: 600;
}

.popup-content {
  padding: 0 16px 16px;
}

.data-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 10px 16px;
  background: #475569;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #f8fafc;
}

.chart-range-btn {
  background: rgba(255,255,255,0.15);
  color: #f8fafc;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}

.chart-range-btn.active {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
}

/* Chart Legend */
.chart-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding: 12px 20px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 16px;
}

.chart-legend-bar .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
}

.chart-legend-bar .legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.chart-legend-bar .legend-line.solid {
  background: currentColor;
}

.chart-legend-bar .legend-line.dashed {
  background: repeating-linear-gradient(90deg, currentColor 0px, currentColor 6px, transparent 6px, transparent 10px);
}

/* Charts */
.charts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-container {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.chart-wrap {
  padding: 8px 4px 8px 0;
  display: flex;
  justify-content: center;
}

.chart-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 12px 0;
  letter-spacing: 0.3px;
}

.loading-data {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

/* Catchment Popup */
.catchment-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  z-index: 2001;
  width: 90%;
  max-width: 420px;
  display: none;
  flex-direction: column;
}

.catchment-popup.active {
  display: flex;
}

.catchment-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #528052;
  color: white;
}

.catchment-popup-title {
  font-size: 16px;
  font-weight: 700;
}

.catchment-popup-content {
  padding: 20px;
}

.gemeinden-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.gemeinde-tag {
  background: #f1f5f9;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Marker Tooltips */
.marker-tooltip {
  background: white !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-tooltip-top:before {
  border-top-color: white !important;
}

/* Wind Arrow */
.wind-arrow-icon {
  background: transparent !important;
  border: none !important;
}

.wind-arrow-tooltip {
  background: white !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;
}

.wind-arrow-tooltip .speed {
  font-weight: 600;
  font-size: 12px;
}

.wind-arrow-tooltip .direction {
  color: var(--text-muted);
}

/* Leaflet Controls */
.leaflet-control-zoom {
  border: none !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
  background: var(--panel-bg) !important;
}

.leaflet-control-zoom a {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  color: var(--text) !important;
  background: transparent !important;
  border-bottom: 1px solid var(--border) !important;
}

/* Layer Button */
.layer-btn {
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}

.layer-btn.active {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.1);
  font-weight: 600;
}

.layer-btn:last-child {
  margin-bottom: 0;
}

.mobile-only {
  display: none;
}

/* Floating Timeline - Mobile Only */
.floating-timeline {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1e293b;
  border-top: 1px solid #334155;
  padding: 10px 12px 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  z-index: 100;
  margin: 0 -12px -12px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.floating-timeline-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.floating-timeline-time {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.floating-timeline-badge {
  display: none;
  background: #475569;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.floating-timeline-badge.visible {
  display: inline-block;
}

.floating-timeline-track {
  height: 40px;
  background: #334155;
  border-radius: 4px;
  position: relative;
  touch-action: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.floating-timeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #475569;
  border-radius: 4px 0 0 4px;
  pointer-events: none;
}

.floating-timeline-forecast {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(100, 116, 139, 0.25);
  border-left: 2px dashed #64748b;
  border-radius: 0 4px 4px 0;
  pointer-events: none;
}

.floating-timeline-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: #f8fafc;
  border: 3px solid #64748b;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 10;
  cursor: grab;
  transition: border-color 0.15s, background 0.15s;
}

.floating-timeline-handle:active {
  cursor: grabbing;
}

.floating-timeline-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: #64748b;
  border-radius: 50%;
  transition: background 0.15s;
}

.floating-timeline-handle.in-forecast {
  border-color: #475569;
  background: #cbd5e1;
}

.floating-timeline-handle.in-forecast::after {
  background: #475569;
}

.floating-timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: #64748b;
  padding: 0 2px;
}

.floating-timeline-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  justify-content: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #334155;
}

.floating-timeline-value {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #e2e8f0;
}

.floating-timeline-value-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.floating-timeline-value-num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .mobile-only {
    display: block;
  }
  
  .floating-timeline {
    display: block;
  }
  
  .control-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 45dvh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  
  .popup {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 90dvh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  
  .popup-info {
    grid-template-columns: repeat(2, 1fr);
    padding: 12px;
    margin: 12px;
    gap: 10px;
  }
  
  .info-value {
    font-size: 12px;
  }
  
  .catchment-popup {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  
  .chart-legend-bar {
    display: none;
  }
  
  .uplot .u-legend {
    display: none;
  }
  
  .chart-wrap {
    padding: 4px 8px 8px;
  }
  
  .leaflet-control-attribution {
    position: fixed !important;
    top: 4px;
    right: 4px;
    bottom: auto !important;
    left: auto !important;
    background: rgba(255, 255, 255, 0.7) !important;
    padding: 2px 5px !important;
    font-size: 8px !important;
    border-radius: 3px;
    white-space: nowrap;
    max-width: none;
  }

  .popup.gefahr-popup .data-info,
  .popup.gefahr-popup .floating-timeline {
    display: none !important;
  }

}
