/* Barangay Hazard Mapper - Main Stylesheet */

:root {
  /* HSL Color System */
  --bg-main: #0b0b0f;
  --bg-sidebar: rgba(18, 18, 26, 0.85);
  --bg-card: rgba(28, 28, 42, 0.55);
  --bg-card-hover: rgba(36, 36, 54, 0.7);
  --border-light: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(79, 70, 229, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Susceptibility Colors */
  --clr-flood: #e63946;
  --clr-landslide: #f77f00;
  --clr-stormsurge: #00b4d8;
  --clr-evacuation: #8b5cf6;
  --clr-river: #3a86c8;
  --clr-road: #ffffff;
  
  --clr-safe: #10b981;
  --clr-danger: #ef4444;
  --clr-warning: #f59e0b;
  
  /* Interactive Accents */
  --accent-primary: #4f46e5;
  --accent-hover: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.45);
  
  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Box Shadow & Blur */
  --blur-amount: 14px;
  --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.6);
  --shadow-light: 0 4px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* -------------------------------------------------------------
   Sidebar Styles (Glassmorphism & Rich Aesthetics)
   ------------------------------------------------------------- */
.sidebar {
  width: 380px;
  min-width: 380px;
  background-color: var(--bg-main);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(var(--blur-amount));
  background: var(--bg-sidebar);
}

.sidebar.collapsed {
  transform: none;
  min-width: 0;
  width: 0;
  overflow: hidden;
  border-right: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 26px;
  color: var(--clr-flood);
  filter: drop-shadow(0 0 8px rgba(230, 57, 70, 0.4));
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.1;
  color: var(--text-primary);
}

.brand .subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-toggle-btn-inner {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn-inner:hover {
  background: var(--border-light);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Scrollbar Styling for Sidebar */
.sidebar-content::-webkit-scrollbar {
  width: 5px;
}
.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Cards Design System */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.section-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-light);
}

.section-card h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

/* Barangay Info Card */
.info-card {
  background: linear-gradient(135deg, rgba(28, 28, 42, 0.85) 0%, rgba(20, 20, 30, 0.85) 100%);
  border-left: 3px solid var(--clr-flood);
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.info-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.city-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.stats-grid-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-stat {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Search Box Design */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.search-box input {
  width: 100%;
  padding: 10px 36px 10px 36px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(0, 0, 0, 0.4);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

/* Search Dropdown Panel */
.search-results-dropdown {
  margin-top: 8px;
  background: #181824;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  z-index: 1010;
  position: relative;
}

.search-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.search-item-type {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.search-item-action {
  font-size: 12px;
  color: var(--accent-primary);
}

/* Map Layer Control Styles */
.layer-group {
  margin-bottom: 16px;
}

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

.layer-group h3 {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.layer-control {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.layer-control:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Custom Checkbox Design */
.checkbox-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 12px;
}

.checkbox-wrapper input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.custom-checkbox {
  height: 18px;
  width: 18px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-wrapper input:checked ~ .custom-checkbox {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.custom-checkbox::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-wrapper input:checked ~ .custom-checkbox::after {
  display: block;
}

/* Checkbox specific colors for Hazard groups */
.custom-checkbox-flood {
  border-color: var(--clr-flood);
}
.checkbox-wrapper input:checked ~ .custom-checkbox-flood {
  background-color: var(--clr-flood);
  border-color: var(--clr-flood);
}

.custom-checkbox-landslide {
  border-color: var(--clr-landslide);
}
.checkbox-wrapper input:checked ~ .custom-checkbox-landslide {
  background-color: var(--clr-landslide);
  border-color: var(--clr-landslide);
}

.custom-checkbox-stormsurge {
  border-color: var(--clr-stormsurge);
}
.checkbox-wrapper input:checked ~ .custom-checkbox-stormsurge {
  background-color: var(--clr-stormsurge);
  border-color: var(--clr-stormsurge);
}

/* Text styles in layers */
.layer-lbl {
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.icon-layer {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.text-blue { color: var(--clr-river); }
.text-gray { color: #94a3b8; }
.text-flood { color: var(--clr-flood); }
.text-landslide { color: var(--clr-landslide); }
.text-stormsurge { color: var(--clr-stormsurge); }
.text-evacuation { color: var(--clr-evacuation); }

/* Badges */
.badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 6px;
  border-radius: 4px;
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--clr-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.hazard-level-indicator {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 30px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-flood {
  background: rgba(230, 57, 70, 0.15);
  color: #ff4d5a;
  border: 1px solid rgba(230, 57, 70, 0.3);
}
.badge-landslide {
  background: rgba(247, 127, 0, 0.15);
  color: #ff9f3a;
  border: 1px solid rgba(247, 127, 0, 0.3);
}
.badge-stormsurge {
  background: rgba(0, 180, 216, 0.15);
  color: #33ccff;
  border: 1px solid rgba(0, 180, 216, 0.3);
}

/* Basemap Grid */
.basemap-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.basemap-btn {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-secondary);
  padding: 10px 4px;
  font-family: var(--font-body);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.basemap-btn i {
  font-size: 16px;
}

.basemap-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.basemap-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Live Metrics Table */
.stats-panel-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  font-size: 12px;
}

.stat-row-lbl {
  color: var(--text-secondary);
}

.stat-row-val {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
}

/* Action Buttons */
.btn {
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: all 0.25s ease;
}

.btn-block {
  width: 100%;
  margin-bottom: 8px;
}

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

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-secondary);
}

/* -------------------------------------------------------------
   Map Area & Interface Styling
   ------------------------------------------------------------- */
.map-area {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.top-nav {
  height: 60px;
  min-height: 60px;
  background: #121217;
  border-bottom: 1px solid var(--border-light);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 999;
  box-shadow: var(--shadow-light);
}

.sidebar-toggle-trigger-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: none; /* Only visible on mobile/collapsed sidebar */
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar.collapsed ~ .map-area .sidebar-toggle-trigger-btn {
  display: flex !important;
}

.sidebar-toggle-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.top-nav-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-primary);
}

.quick-status-pills {
  display: flex;
  gap: 12px;
}

.pill {
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--clr-safe);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pill-time {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* Map Container */
#map {
  flex: 1;
  width: 100%;
  background-color: #0b0b0f;
  z-index: 1;
}

/* Leaflet Custom overrides (Premium dark theme look) */
.leaflet-container {
  background: #0b0b0f !important;
}

.leaflet-bar {
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-light) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: #171724 !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
  transition: background-color 0.2s ease;
}

.leaflet-bar a:hover {
  background-color: #242436 !important;
}

.leaflet-bar a.leaflet-disabled {
  background-color: #11111a !important;
  color: var(--text-muted) !important;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  background: #171724 !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-premium) !important;
  padding: 4px;
}

.leaflet-popup-tip {
  background: #171724 !important;
  border: 1px solid var(--border-light) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-family: var(--font-body);
  line-height: 1.4;
}

.leaflet-popup-content h4 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  color: var(--text-primary);
}

.leaflet-popup-content p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.leaflet-popup-content .popup-meta-row {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
}

.leaflet-popup-content .popup-meta-lbl {
  color: var(--text-muted);
}

.leaflet-popup-content .popup-meta-val {
  font-weight: 600;
  color: var(--text-primary);
}

/* -------------------------------------------------------------
   Map Overlays (Legend & Side Details Panels)
   ------------------------------------------------------------- */
.floating-overlay {
  position: absolute;
  z-index: 500;
  background: rgba(23, 23, 36, 0.85);
  backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-premium);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Legend Overlay Box */
.legend-box {
  bottom: 24px;
  left: 24px;
  width: 250px;
  padding: 12px 16px;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}

.legend-header h4 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.legend-toggle:hover {
  color: var(--text-primary);
}

.legend-box.minimized {
  width: 140px;
}
.legend-box.minimized .legend-content {
  display: none;
}

.legend-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
}

.legend-section-lbl {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.legend-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.legend-color-patch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.legend-line-patch {
  width: 18px;
  height: 3px;
  margin-right: 8px;
}

.legend-icon-patch {
  width: 18px;
  display: flex;
  justify-content: center;
  margin-right: 6px;
  font-size: 11px;
}

/* Feature Details Panel (Sliding out overlay on the right) */
.details-box {
  top: 80px;
  right: 24px;
  width: 320px;
  max-height: calc(100% - 130px);
  padding: 20px;
  overflow-y: auto;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.details-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.details-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.details-content h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  padding-right: 20px;
}

.details-prop-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.details-prop-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.details-prop-lbl {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.details-prop-val {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.3;
}

.details-prop-badge {
  display: inline-block;
  align-self: flex-start;
  margin-top: 2px;
}

.facility-status-active {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.facility-status-standby {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Toast Notifications */
.toast-notification {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 1000;
  background: rgba(16, 16, 24, 0.9);
  border: 1px solid var(--border-light);
  border-radius: 30px;
  padding: 10px 24px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(10px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Custom Marker Styling (Evacuation points) */
.custom-marker-div {
  position: relative;
}

.marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  background: var(--clr-evacuation);
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -15px 0 0 -15px;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  animation: bounceMarker 1.2s infinite alternate;
}

.marker-pin::after {
  content: '';
  width: 14px;
  height: 14px;
  background: #12121c;
  position: absolute;
  border-radius: 50%;
}

.marker-pin i {
  color: #ffffff;
  transform: rotate(45deg);
  font-size: 11px;
  position: relative;
  z-index: 10;
}

@keyframes bounceMarker {
  0% { transform: rotate(-45deg) translate(0px, 0px); }
  100% { transform: rotate(-45deg) translate(-2px, -2px); }
}

/* Active Indicator pulse */
.marker-pulse {
  background: rgba(139, 92, 246, 0.2);
  border-radius: 50%;
  height: 40px;
  width: 40px;
  position: absolute;
  margin: -20px 0 0 -20px;
  animation: pulsateMarker 1.8s ease-out infinite;
  opacity: 0;
}

@keyframes pulsateMarker {
  0% { transform: scale(0.1, 0.1); opacity: 0.0; }
  50% { opacity: 0.8; }
  100% { transform: scale(1.2, 1.2); opacity: 0.0; }
}

/* -------------------------------------------------------------
   Responsive Styles & Collapsible sidebar triggers
   ------------------------------------------------------------- */
@media (max-width: 900px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 60px; /* underneath navigation bar */
    height: calc(100% - 60px);
    width: 320px;
    min-width: 320px;
    transform: translateX(-320px);
  }
  
  .sidebar.collapsed {
    transform: translateX(-320px);
    width: 0;
    min-width: 0;
    overflow: hidden;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar-toggle-btn-inner {
    display: none;
  }
  
  .sidebar-toggle-trigger-btn {
    display: flex;
  }
}

@media (max-width: 600px) {
  .top-nav {
    padding: 0 12px;
  }
  .quick-status-pills {
    display: none;
  }
  .legend-box {
    left: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    max-height: 150px;
  }
  .details-box {
    right: 12px;
    top: 72px;
    width: calc(100% - 24px);
    max-height: 50%;
  }
}

/* Printing styles */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }
  .sidebar, .top-nav, .floating-overlay {
    display: none !important;
  }
  #map {
    width: 100%;
    height: 100%;
  }
}

/* Sidebar Footer & Geoportal badge */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer p {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: center;
}

.authority-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-safe);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.text-green {
  color: var(--clr-safe);
}

/* Official NOAH hazard source note */
.layer-source-note {
  margin: 6px 0 12px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.10);
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: rgba(226, 232, 240, 0.88);
  font-size: 0.78rem;
  line-height: 1.35;
}
.layer-source-note i { color: #38bdf8; margin-right: 4px; }
#official-noah-overlay canvas { pointer-events: none !important; }

/* Revised print/export map frame: centered half-page map with side details */
.print-export-container * { box-sizing: border-box; }
.export-header {
  height: 82px;
  padding: 16px 22px;
  background: #111827;
  color: #ffffff;
  border-bottom: 4px solid #dc2626;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.export-header h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  line-height: 1.1;
  color: #ffffff;
}
.export-subtitle { margin-top: 5px; font-size: 12px; color: #cbd5e1; }
.export-header-meta { text-align: right; font-size: 11px; color: #cbd5e1; line-height: 1.5; }
.export-header-meta strong { color: #ffffff; font-size: 13px; letter-spacing: .5px; }
.export-body-layout {
  height: 676px;
  padding: 10px 16px 16px 16px;
  display: grid;
  grid-template-columns: 270px 1fr 270px;
  gap: 16px;
  align-items: center;
  background: #e5e7eb;
}
.export-side-panel {
  height: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  overflow: hidden;
  font-size: 10px;
  color: #111827;
  display: flex;
  flex-direction: column;
}
.export-side-panel h4 {
  margin: 0 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
  color: #991b1b;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
}
.export-map-section {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.export-map-wrapper {
  width: 600px;
  height: 405px;
  overflow: hidden;
  position: relative;
  border: 4px solid #111827;
  border-radius: 10px;
  background: #0b0b0f;
  box-shadow: 0 8px 24px rgba(15,23,42,.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.export-map-wrapper canvas { display: block; max-width: 100%; max-height: 100%; }
.export-north-arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 58px;
  background: rgba(255,255,255,.92);
  border: 2px solid #111827;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(15,23,42,.25);
  z-index: 5;
}
.export-north-triangle {
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 28px solid #111827;
  margin-bottom: 3px;
}
.export-north-label {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  color: #111827;
  font-size: 14px;
  line-height: 1;
}

.export-map-scale-row {
  width: 600px;
  height: 40px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-top: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #111827;
}
.export-scale-bar {
  width: 120px;
  height: 12px;
  border-left: 2px solid #111827;
  border-right: 2px solid #111827;
  border-bottom: 4px solid #111827;
  position: relative;
}
.export-scale-bar span {
  display: block;
  width: 50%;
  height: 8px;
  background: #111827;
}
.export-scale-label { font-weight: 800; font-size: 12px; }
.export-scale-info { font-size: 10px; color: #475569; }
.export-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
  line-height: 1.2;
  margin-bottom: 10px;
}
.export-table th,
.export-table td {
  border: 1px solid #d1d5db;
  padding: 4px 5px;
  vertical-align: top;
}
.export-table th {
  width: 42%;
  background: #f3f4f6;
  color: #374151;
  text-align: left;
  font-weight: 700;
}
.export-small-table { font-size: 8.5px; }
.export-small-table th { width: auto; }
.export-school-list ol {
  margin: 0 0 8px 16px;
  padding: 0;
  font-size: 9.5px;
  line-height: 1.25;
}
.export-school-list li { margin-bottom: 3px; }
.export-legend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  font-size: 9px;
  margin-bottom: 10px;
}
.export-note,
.export-muted {
  color: #64748b;
  font-size: 8.5px;
  line-height: 1.25;
}
.export-note-box {
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  font-size: 9px;
  line-height: 1.35;
}
.export-references-box {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}
.export-references-content {
  font-size: 7.8px;
  line-height: 1.22;
  color: #334155;
}
.export-references-content ul {
  margin: 0 0 0 12px;
  padding: 0;
}
.export-references-content li {
  margin-bottom: 2px;
}

.export-map-references-box {
  width: 600px;
  max-height: 132px;
  margin-top: 8px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  color: #111827;
}
.export-map-references-box h4 {
  margin: 0 0 4px 0;
  color: #991b1b;
  font-size: 10px;
  text-transform: uppercase;
  font-family: 'Outfit', sans-serif;
}
.export-map-references-box .export-references-content {
  font-size: 7px;
  line-height: 1.12;
}
.export-map-references-box .export-references-content ol {
  margin: 0 0 0 12px;
  padding: 0;
}
.export-map-references-box .export-references-content li {
  margin-bottom: 1px;
}

.export-footer {
  height: 42px;
  padding: 7px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  background: #111827;
  color: #d1d5db;
  border-top: 3px solid #dc2626;
  font-size: 11px;
  line-height: 1.3;
}
.export-footer strong { color: #ffffff; }
