/* Light mode overrides */
.light-mode {
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ef 100%);
  color: #222;
}
.light-mode .sidebar {
  background: rgba(255,255,255,0.97);
  color: #222;
  border-right: 1px solid #e5e7eb;
  box-shadow: 2px 0 20px rgba(0,0,0,0.08);
}
.light-mode .header {
  background: linear-gradient(135deg, #fbbf24, #60a5fa)!important;
  color: #222;
}
.light-mode .control-group {
  background: rgba(0,0,0,0.03);
  border: 1px solid #e5e7eb;
}
.light-mode .__btn {
  background: rgba(0,0,0,0.04);
  color: #222;
  backdrop-filter: blur(0);
}
.light-mode .__btn:hover,
.light-mode .__btn.active {
  background: linear-gradient(135deg, #fbbf24, #60a5fa);
  color: #222;
  box-shadow: 0 8px 20px rgba(59,130,246,0.08);
}
.light-mode .__btn.danger,
.light-mode .__btn.danger:hover {
  background: linear-gradient(135deg, #ef4444, #fbbf24);
  color: #fff;
}
.light-mode .select-input {
  background: #fff;
  color: #222;
  border: 1px solid #e5e7eb;
}
.light-mode .select-input option {
  background: #fff;
  color: #222;
}
.light-mode .map-container {
  background: #f1f5f9;
}
.light-mode .status-bar,
.light-mode .legend,
.light-mode .loading {
  background: rgba(255,255,255,0.97);
  color: #222;
  border: 1px solid #e5e7eb;
}
.light-mode .status-value.active { color: #059669; }
.light-mode .status-value.warning { color: #f59e0b; }
.light-mode .status-value.danger { color: #ef4444; }
.light-mode .legend-color { border: 2px solid #e5e7eb; }
.light-mode .leaflet-popup-content-wrapper,
.light-mode .leaflet-popup-tip {
  background: #fff;
  color: #222;
  border: 1px solid #e5e7eb;
}
.light-mode .popup-title { color: #2563eb; }
.light-mode .notification {
  background: linear-gradient(135deg, #fbbf24, #60a5fa);
  color: #222;
  box-shadow: 0 8px 25px rgba(59,130,246,0.08);
}

.portal-container {
  display: flex;
  height: 100vh;
  backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
  width: 350px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
  margin-bottom: 60px;
}

.sidebar.collapsed {
  width: 70px;
}

.header {
  padding: 20px;
  background: linear-gradient(135deg, #1e40af, #7c3aed);
  color: white;
  text-align: center;
  position: relative;
}

.header h1 {
  font-size: 1.5rem;
  margin-bottom: 5px;
  font-weight: 700;
}

.header p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.toggle-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.controls {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.control-group {
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.control-group:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.control-group h3 {
  color: #60a5fa;
  margin-bottom: 15px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group h3 i {
  color: #f59e0b;
}

.__btn {
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
}

.__btn:hover {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.__btn.active {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.__btn.danger {
background: linear-gradient(135deg, #ef4444, #dc2626);
}

.__btn.danger:hover {
background: linear-gradient(135deg, #dc2626, #b91c1c);
box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.select-input {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  margin: 8px 0;
  backdrop-filter: blur(10px);
}

.select-input option {
  background: #1e293b;
  color: white;
}

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
  background: #0f172a;
}

#map {
  height: 100%;
  width: 100%;
}

/* Status Bar */
.status-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  bottom: auto;
  right: auto;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  padding: 15px 20px;
  border-radius: 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  min-width: 250px;
  transition: opacity 0.2s;
  opacity: 0.92;
}
.status-bar:hover {
  opacity: 1;
}

.legend {
  position: absolute;
  bottom: 100px;
  right: 20px;
  left: auto;
  top: auto;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  padding: 20px;
  border-radius: 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  max-width: 300px;
  transition: opacity 0.2s;
  opacity: 0.92;
}
.legend:hover {
  opacity: 1;
}
.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: inline-block;
  margin-right: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .status-bar {
    position: static;
    margin: 10px 0 0 0;
    width: calc(100% - 20px);
    left: 0;
    right: 0;
    top: auto;
  }
  .legend {
    position: static;
    margin: 10px 0 0 0;
    width: calc(100% - 20px);
    left: 0;
    right: 0;
    bottom: auto;
  }
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 12px;
}

.leaflet-popup-content {
  margin: 15px;
  line-height: 1.6;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-title {
  font-weight: 600;
  color: #60a5fa;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.popup-details {
  font-size: 0.9rem;
  opacity: 0.9;
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.analysis-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15,23,42,0.97);
  color: #fff;
  border-radius: 10px;
  padding: 24px 32px;
  z-index: 3001;
  border: 1px solid #60a5fa;
  box-shadow: 0 8px 32px rgba(59,130,246,0.18);
  font-size: 1rem;
  display: none;
}
.analysis-guide.show {
  display: block;
}
.clear-btn {
  margin-top: 10px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.clear-btn:hover {
  background: #ef4444;
}
