/* ===== StormSense v2.0 - Premium Design System ===== */

/* ===== CSS Variables & Theme ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors - Dark Theme */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: rgba(26, 26, 37, 0.85);
  --bg-card-hover: rgba(34, 34, 45, 0.9);
  --bg-glass: rgba(26, 26, 37, 0.6);
  
  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --border-glow: rgba(59, 130, 246, 0.3);
  
  /* Text */
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #0a0a0f;
  
  /* Accent Colors */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.4);
  
  /* Semantic Colors */
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.3);
  --warning: #eab308;
  --warning-glow: rgba(234, 179, 8, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --orange: #f97316;
  --orange-glow: rgba(249, 115, 22, 0.3);
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.3);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.3);
  
  /* Layer Colors */
  --layer-earthquakes: #f97316;
  --layer-fires: #ef4444;
  --layer-volcanoes: #dc2626;
  --layer-conflicts: #a855f7;
  --layer-storms: #3b82f6;
  --layer-floods: #06b6d4;
  --layer-flights: #22c55e;
  --layer-weather: #eab308;
  
  /* Effects */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  --blur: blur(12px);
  --blur-lg: blur(20px);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.7);
  
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --border-glow: rgba(59, 130, 246, 0.2);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* ===== Base Styles ===== */
html, body {
  height: 100%;
  font-family: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
  background: var(--border-hover); 
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: var(--transition);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
}

.brand:hover {
  background: var(--bg-card-hover);
}

.brand-logo {
  position: relative;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon {
  font-size: 1.6rem;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 8px var(--accent-glow));
}

.logo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--cyan);
  animation: spin 3s linear infinite;
}

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

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 50%, var(--success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 500;
}

/* ===== Status Bar ===== */
.status-bar {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  padding: 4px 0;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.status-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.status-count {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.85rem;
  min-width: 20px;
  text-align: center;
}

.status-icon {
  font-size: 1rem;
  filter: grayscale(0.2);
}

.status-label {
  display: none;
  color: var(--text-secondary);
  font-weight: 500;
}

@media (min-width: 1200px) {
  .status-label { display: inline; }
}

/* ===== Search Box ===== */
.search-box {
  flex: 1;
  max-width: 320px;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-fast);
}

[dir="rtl"] .search-icon { left: auto; right: 12px; }

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  transition: var(--transition-fast);
}

[dir="rtl"] .search-box input {
  padding: 0 14px 0 40px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input:focus + .search-icon {
  color: var(--accent);
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

[dir="rtl"] .search-clear { right: auto; left: 8px; }

.search-box input:not(:placeholder-shown) + .search-clear {
  display: flex;
}

.search-clear:hover {
  background: var(--danger);
  color: white;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  box-shadow: var(--shadow-lg);
}

.search-results.active {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-result {
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border);
}

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

.search-result:hover {
  background: var(--bg-card-hover);
}

.search-result svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-result-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.search-result-country {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ===== Nav Actions ===== */
.nav-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  position: relative;
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.nav-btn:active {
  transform: scale(0.95);
}

.live-btn {
  position: relative;
}

.live-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

/* Tooltip */
.tooltip-btn {
  position: relative;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
  box-shadow: var(--shadow);
  z-index: 1002;
}

.tooltip-btn:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
}

/* ===== Quick Stats ===== */
.quick-stats {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  z-index: 500;
  transition: var(--transition);
}

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

.quick-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.quick-stat-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* ===== Map Customization ===== */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: none !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 1.2rem !important;
  transition: var(--transition-fast) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-card-hover) !important;
  color: var(--accent) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  backdrop-filter: var(--blur-lg) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-lg) !important;
  padding: 0 !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 220px !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
}

.leaflet-container {
  background: var(--bg-primary);
}

/* ===== Custom Markers ===== */
.custom-marker {
  transition: transform 0.2s ease;
}

.custom-marker:hover {
  transform: scale(1.2);
  z-index: 1000;
}

/* ===== Panels ===== */
.panel {
  position: absolute;
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 600;
  display: none;
  max-height: calc(100vh - 100px);
  overflow: hidden;
}

.panel.active {
  display: flex;
  flex-direction: column;
  animation: panelSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelSlideIn {
  from { opacity: 0; transform: translateX(-20px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

[dir="ltr"] .panel.active {
  animation-name: panelSlideInLTR;
}

@keyframes panelSlideInLTR {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.layers-panel {
  top: 12px;
  left: 12px;
  width: 300px;
}

[dir="rtl"] .layers-panel {
  left: auto;
  right: 12px;
}

.dashboard-panel {
  top: 12px;
  left: 12px;
  width: 320px;
}

[dir="rtl"] .dashboard-panel {
  left: auto;
  right: 12px;
}

.info-panel {
  top: 50%;
  left: 12px;
  width: 280px;
  transform: translateY(-50%);
}

[dir="rtl"] .info-panel {
  left: auto;
  right: 12px;
}

.settings-panel {
  top: 12px;
  right: 12px;
  width: 300px;
}

[dir="rtl"] .settings-panel {
  right: auto;
  left: 12px;
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title svg {
  color: var(--accent);
}

.header-title h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.close-btn {
  width: 28px;
  height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition-fast);
}

.close-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* Panel Body */
.panel-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

/* ===== Layer Items ===== */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.layer-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.layer-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.layer-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.layer-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 6px;
  transition: var(--transition-fast);
}

.checkmark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: var(--transition-fast);
}

.layer-checkbox input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.layer-checkbox input:checked + .checkmark::after {
  transform: rotate(45deg) scale(1);
}

.layer-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.layer-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.layer-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.layer-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.layer-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  min-width: 40px;
  text-align: center;
}

.layer-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--warning);
  background: rgba(234, 179, 8, 0.15);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.dash-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
}

.dash-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.dash-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 1.4rem;
  flex-shrink: 0;
}

.dash-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.dash-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash-chart {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
}

.chart-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-bar-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  width: 60px;
  flex-shrink: 0;
}

.chart-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.chart-bar-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 30px;
  text-align: right;
}

/* ===== Settings ===== */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.setting-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.setting-icon {
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.setting-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.setting-value {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

.setting-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.setting-item:hover .setting-arrow {
  color: var(--text-secondary);
  transform: translateX(-4px);
}

[dir="ltr"] .setting-item:hover .setting-arrow {
  transform: translateX(4px);
}

.toggle {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  position: relative;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle.active {
  background: var(--accent);
}

.toggle.active::after {
  left: 22px;
  background: white;
}

.settings-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.version-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.build-date {
  background: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* ===== Map Legend ===== */
.map-legend {
  position: absolute;
  bottom: 80px;
  left: 20px;
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  z-index: 500;
  transition: var(--transition);
}

[dir="rtl"] .map-legend {
  left: auto;
  right: 20px;
}

.legend-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.1em;
}

.legend-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

/* ===== Locate Button ===== */
.locate-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  width: 48px;
  height: 48px;
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: var(--transition-fast);
}

.locate-btn:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

[dir="rtl"] .locate-btn {
  right: auto;
  left: 20px;
}

/* ===== Zoom Controls ===== */
.zoom-controls {
  position: absolute;
  bottom: 80px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[dir="rtl"] .zoom-controls {
  right: auto;
  left: 20px;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: var(--transition-fast);
}

.zoom-btn:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* ===== Refresh Indicator ===== */
.refresh-indicator {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow);
}

.refresh-indicator.active {
  display: flex;
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.refresh-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== Loading ===== */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: var(--blur-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.loading.active {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-spinner {
  position: relative;
  width: 60px;
  height: 60px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
  inset: 8px;
  border-top-color: var(--cyan);
  animation-direction: reverse;
  animation-duration: 0.8s;
}

.spinner-ring:nth-child(3) {
  inset: 16px;
  border-top-color: var(--success);
  animation-duration: 0.6s;
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Popup Styles ===== */
.popup-content {
  padding: 16px;
  min-width: 200px;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.popup-icon {
  font-size: 2rem;
  line-height: 1;
}

.popup-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.popup-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.popup-row:last-child {
  border-bottom: none;
}

.popup-label {
  color: var(--text-muted);
  font-weight: 500;
}

.popup-value {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.popup-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
  font-family: inherit;
}

.popup-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[dir="rtl"] .toast-container {
  right: auto;
  left: 20px;
}

.toast {
  background: var(--bg-glass);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  max-width: 320px;
}

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

[dir="rtl"] .toast {
  animation-name: toastSlideInRTL;
}

@keyframes toastSlideInRTL {
  from { opacity: 0; transform: translateX(-100px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* ===== Info Panel ===== */
.info-content {}

.info-section {
  text-align: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.info-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.info-type {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-muted);
  font-weight: 500;
}

.info-value {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .status-bar {
    gap: 4px;
  }
  
  .status-item {
    padding: 6px 10px;
  }
  
  .status-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 8px 12px;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .navbar-left {
    order: 1;
    width: 100%;
  }
  
  .status-bar {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding: 4px 0 0;
  }
  
  .search-box {
    order: 2;
    flex: 1;
    max-width: none;
    min-width: 200px;
  }
  
  .nav-actions {
    order: 2;
  }
  
  .quick-stats {
    display: none;
  }
  
  .layers-panel,
  .dashboard-panel,
  .settings-panel {
    width: calc(100% - 24px);
    max-height: 70vh;
  }
  
  .info-panel {
    width: calc(100% - 24px);
    bottom: 20px;
    top: auto;
    transform: none;
  }
  
  .map-legend {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-text {
    display: none;
  }
  
  .status-item {
    padding: 6px 8px;
  }
  
  .status-count {
    font-size: 0.75rem;
  }
  
  .search-box {
    min-width: 150px;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Utility Classes */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
