/* ==========================================================================
   BMKG Real-Time Dashboard - Complete Unified Stylesheet
   Includes: Leaflet Core CSS + Custom Design System + Balanced Responsive Layout
   ========================================================================== */

/* --------------------------------------------------------------------------
   LEAFLET CORE STYLES (Self-Contained)
   -------------------------------------------------------------------------- */
.leaflet-pane, .leaflet-tile, .leaflet-marker-icon, .leaflet-marker-shadow,
.leaflet-tile-container, .leaflet-pane > svg, .leaflet-pane > canvas,
.leaflet-zoom-box, .leaflet-image-layer, .leaflet-layer {
  position: absolute; left: 0; top: 0;
}
.leaflet-container { overflow: hidden; -webkit-tap-highlight-color: transparent; }
.leaflet-tile, .leaflet-marker-icon, .leaflet-marker-shadow {
  -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-user-drag: none;
}
.leaflet-tile::selection { background: transparent; }
.leaflet-safari .leaflet-tile { image-rendering: -webkit-optimize-contrast; }
.leaflet-safari .leaflet-tile-container { -webkit-transform: translate3d(0,0,0); }
.leaflet-tile { filter: inherit; visibility: hidden; }
.leaflet-tile-loaded { visibility: inherit; }
.leaflet-zoom-box { width: 0; height: 0; -moz-box-sizing: border-box; box-sizing: border-box; z-index: 800; }
.leaflet-overlay-pane svg { -moz-user-select: none; }
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape { width: 1px; height: 1px; }
.lvml { behavior: url(#default#VML); display: inline-block; position: absolute; }
.leaflet-control { position: relative; z-index: 800; pointer-events: visiblePainted; pointer-events: auto; }
.leaflet-top, .leaflet-bottom { position: absolute; z-index: 1000; pointer-events: none; }
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-control { float: left; clear: both; }
.leaflet-right .leaflet-control { float: right; }
.leaflet-top .leaflet-control { margin-top: 10px; }
.leaflet-bottom .leaflet-control { margin-bottom: 10px; }
.leaflet-left .leaflet-control { margin-left: 10px; }
.leaflet-right .leaflet-control { margin-right: 10px; }
.leaflet-fade-anim .leaflet-tile { opacity: 0; -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; transition: opacity 0.2s linear; }
.leaflet-fade-anim .leaflet-tile-loaded { opacity: 1; }
.leaflet-zoom-animated { -webkit-transform-origin: 0 0; -ms-transform-origin: 0 0; transform-origin: 0 0; }
.leaflet-zoom-anim .leaflet-zoom-animated { -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); transition: transform 0.25s cubic-bezier(0,0,0.25,1); }
.leaflet-pan-anim .leaflet-tile, .leaflet-zoom-anim .leaflet-tile { -webkit-transition: none; -moz-transition: none; transition: none; }
.leaflet-interactive { cursor: pointer; }
.leaflet-grab { cursor: -webkit-grab; cursor: -moz-grab; cursor: grab; }
.leaflet-crosshair, .leaflet-crosshair .leaflet-interactive { cursor: crosshair; }
.leaflet-popup-pane, .leaflet-control { cursor: auto; }
.leaflet-dragging .leaflet-grab, .leaflet-dragging .leaflet-grab .leaflet-interactive, .leaflet-dragging .leaflet-marker-draggable { cursor: move; cursor: -webkit-grabbing; cursor: -moz-grabbing; cursor: grabbing; }
.leaflet-marker-icon, .leaflet-marker-shadow { display: block; }
.leaflet-bar { box-shadow: 0 1px 5px rgba(0,0,0,0.4); border-radius: 4px; }
.leaflet-bar a, .leaflet-bar a:hover { background-color: #fff; border-bottom: 1px solid #ccc; width: 26px; height: 26px; line-height: 26px; display: block; text-align: center; text-decoration: none; color: black; }
.leaflet-bar a:hover { background-color: #f4f4f4; }
.leaflet-bar a:first-child { border-top-left-radius: 4px; border-top-right-radius: 4px; }
.leaflet-bar a:last-child { border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-bottom: none; }
.leaflet-control-zoom-in, .leaflet-control-zoom-out { font: bold 18px 'Lucida Console', Monaco, monospace; text-indent: 1px; }
.leaflet-control-attribution, .leaflet-control-scale-line { padding: 0 5px; color: #333; }
.leaflet-control-attribution a { text-decoration: none; }
.leaflet-control-attribution a:hover { text-decoration: underline; }
.leaflet-container .leaflet-control-attribution, .leaflet-container .leaflet-control-scale { font-size: 11px; }
.leaflet-popup { position: absolute; text-align: center; margin-bottom: 20px; }
.leaflet-popup-content-wrapper { padding: 1px; text-align: left; border-radius: 12px; }
.leaflet-popup-content { margin: 13px 19px; line-height: 1.4; }
.leaflet-popup-tip-container { width: 40px; height: 20px; position: absolute; left: 50%; margin-left: -20px; overflow: hidden; pointer-events: none; }
.leaflet-popup-tip { width: 17px; height: 17px; padding: 1px; margin: -10px auto 0; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: white; color: #333; box-shadow: 0 3px 14px rgba(0,0,0,0.4); }
a.leaflet-popup-close-button { position: absolute; top: 0; right: 0; padding: 4px 4px 0 0; border: none; text-align: center; width: 18px; height: 14px; font: 16px/14px Tahoma, Verdana, sans-serif; color: #c3c3c3; text-decoration: none; font-weight: bold; background: transparent; }
a.leaflet-popup-close-button:hover { color: #999; }

/* --------------------------------------------------------------------------
   DASHBOARD DESIGN TOKENS & SYSTEM
   -------------------------------------------------------------------------- */
:root {
  /* Dark Mode Defaults */
  --bg-primary: #080e1a;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-card-hover: rgba(26, 38, 66, 0.9);
  --bg-glass: rgba(15, 23, 42, 0.75);
  --bg-glass-subtle: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.09);
  --border-color-hover: rgba(56, 189, 248, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --font-main: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-subtle: rgba(0, 0, 0, 0.03);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(2, 132, 199, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --accent-blue: #0284c7;
  --accent-cyan: #0891b2;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
}

/* Base resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.dashboard-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px 60px 24px;
}

/* --------------------------------------------------------------------------
   HEADER & CONTROLS
   -------------------------------------------------------------------------- */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 16px;
  z-index: 1000;
  gap: 16px;
}

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

.brand-logo-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  flex-shrink: 0;
}

.brand-logo-wrap svg {
  width: 26px;
  height: 26px;
  color: #ffffff;
}

.brand-title {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.header-clocks {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: var(--radius-md);
}

.clock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.clock-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
}

.clock-val {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.clock-divider {
  width: 1px;
  height: 22px;
  background: var(--border-color);
}

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

.live-visitor-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-emerald);
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 10px rgba(16, 185, 129, 0.9); }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.btn-icon-control {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-icon-control svg { width: 18px; height: 18px; }

.lang-switch {
  display: flex;
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 2px;
}

.lang-btn {
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.4);
}

/* --------------------------------------------------------------------------
   ALERT TICKER
   -------------------------------------------------------------------------- */
.alert-ticker-container {
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.12));
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  padding: 10px 18px;
  gap: 14px;
  transition: all 0.3s ease;
}

.ticker-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-rose);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.ticker-badge.badge-news {
  background: var(--accent-blue);
}

.ticker-badge.badge-pr {
  background: var(--accent-emerald);
}

.ticker-content {
  flex: 1;
  font-size: 0.86rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.ticker-content:hover {
  text-decoration: underline;
}

.ticker-nav-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ticker-nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.ticker-nav-btn:hover {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   BALANCED GRID SYSTEM
   -------------------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.grid-full-width {
  grid-column: 1 / -1;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.glass-card:hover {
  border-color: var(--border-color-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

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

.card-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-title-icon.weather-icon { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.card-title-icon.quake-icon { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.card-title-icon.map-icon { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.card-title-icon.alert-icon { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.card-title-icon.visitor-icon { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

.card-title-icon svg { width: 18px; height: 18px; }

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   ROW 1: WEATHER & EARTHQUAKE SPOTLIGHT (BALANCED)
   -------------------------------------------------------------------------- */
.custom-select {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.custom-select option { background-color: var(--bg-secondary); }

.weather-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 10px 0 16px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.weather-main-img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(56, 189, 248, 0.25));
}

.weather-temp-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.weather-temp-current {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.weather-temp-unit { font-size: 1.4rem; font-weight: 600; color: var(--text-secondary); }
.weather-condition-text { font-size: 1.1rem; font-weight: 700; color: var(--accent-blue); }
.weather-location-name { font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

.weather-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric-box {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon-wrap svg { width: 16px; height: 16px; }
.metric-label { font-size: 0.64rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.metric-val { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }

.hourly-timeline-wrap {
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.hourly-timeline-wrap::-webkit-scrollbar { height: 5px; }
.hourly-timeline-wrap::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

.hourly-track { display: flex; gap: 8px; min-width: max-content; }

.hourly-card {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 74px;
}

.hourly-card.active-slot { background: rgba(56, 189, 248, 0.12); border-color: var(--accent-blue); }
.hourly-time { font-size: 0.68rem; font-weight: 700; color: var(--text-secondary); }
.hourly-icon { width: 28px; height: 28px; object-fit: contain; }
.hourly-temp { font-size: 0.88rem; font-weight: 800; color: var(--text-primary); }
.hourly-desc { font-size: 0.62rem; color: var(--text-muted); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.daily-forecast-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
}

.daily-card {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.daily-left { display: flex; align-items: center; gap: 8px; }
.daily-icon { width: 32px; height: 32px; object-fit: contain; }
.daily-day-name { font-size: 0.8rem; font-weight: 700; }
.daily-condition { font-size: 0.68rem; color: var(--text-muted); }
.daily-temp-range { font-size: 0.82rem; font-weight: 800; color: var(--accent-blue); }

/* Earthquake Spotlight Section */
.quake-hero-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0 16px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.quake-mag-badge-large {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.quake-mag-badge-large::after {
  content: 'M';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.7rem;
  font-weight: 800;
}

.quake-headline {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}

.quake-datetime {
  font-size: 0.78rem;
  color: var(--accent-rose);
  font-weight: 600;
  margin-top: 3px;
}

.quake-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.quake-stat-item {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.quake-stat-lbl { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.quake-stat-val { font-size: 0.86rem; font-weight: 700; color: var(--text-primary); margin-top: 2px; }

.tsunami-status-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.tsunami-status-tag.safe {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.tsunami-status-tag.alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--accent-rose);
}

.btn-shakemap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--accent-blue);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.btn-shakemap:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
}

/* Shakemap Direct Image Container */
.quake-shakemap-preview-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-glass-subtle);
  margin-bottom: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quake-shakemap-preview-wrap:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.2);
}

.quake-card-shakemap-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
  display: block;
}

.quake-shakemap-preview-wrap:hover .quake-card-shakemap-img {
  transform: scale(1.04);
}

.shakemap-overlay-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  transition: all 0.2s ease;
}

.quake-shakemap-preview-wrap:hover .shakemap-overlay-hint {
  background: rgba(2, 132, 199, 0.9);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   ROW 2: INTERACTIVE MAP (FREE TILES, NO WATERMARKS)
   -------------------------------------------------------------------------- */
.map-controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.map-btn-group {
  display: flex;
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.map-btn, .map-layer-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-btn:hover, .map-layer-btn:hover {
  color: var(--text-primary);
}

.map-btn.active, .map-layer-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
}

.map-container-wrap {
  position: relative;
  width: 100%;
  height: 520px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

#earthquake-map {
  width: 100%;
  height: 100%;
  z-index: 10;
  background: #0b132b;
}

/* --------------------------------------------------------------------------
   FLOATING FELT EARTHQUAKES WIDGET (TOP RIGHT OF MAP)
   -------------------------------------------------------------------------- */
.map-quake-floating-widget {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1200 !important;
  pointer-events: auto;
  width: 295px;
  max-width: calc(100% - 28px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .map-quake-floating-widget {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.map-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

[data-theme="light"] .map-widget-header {
  background: rgba(0, 0, 0, 0.02);
}

.map-widget-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.widget-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose);
  animation: pulseDot 2s infinite;
}

.map-widget-title {
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.widget-count-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.widget-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.widget-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.map-quake-floating-widget.collapsed .widget-toggle-btn svg {
  transform: rotate(180deg);
}

.map-widget-body {
  max-height: 230px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.map-widget-body::-webkit-scrollbar {
  width: 4px;
}

.map-widget-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

.map-quake-floating-widget.collapsed .map-widget-body {
  max-height: 0;
  padding: 0;
  overflow: hidden;
}

.map-widget-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-subtle);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-widget-item:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(-2px);
}

.widget-mag-pill {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.widget-mag-pill.high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.widget-mag-pill.mid {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.widget-mag-pill.low {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.widget-item-info {
  flex: 1;
  min-width: 0;
}

.widget-item-loc {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-item-sub {
  font-size: 0.63rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 1px;
}

.widget-item-mmi {
  font-size: 0.62rem;
  color: var(--accent-blue);
  font-weight: 600;
}

.widget-placeholder {
  padding: 14px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.map-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.legend-item { display: flex; align-items: center; gap: 5px; font-weight: 600; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot.red { background-color: #ef4444; box-shadow: 0 0 6px #ef4444; }
.legend-dot.orange { background-color: #f59e0b; }
.legend-dot.blue { background-color: #38bdf8; }

/* Pulsating Radar Epicenter Marker */
.leaflet-epicenter-marker { position: relative; }
.epicenter-core {
  width: 18px;
  height: 18px;
  background: #ef4444;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 14px #ef4444;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.epicenter-wave {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  margin-top: -30px;
  margin-left: -30px;
  border: 2px solid #ef4444;
  border-radius: 50%;
  animation: ripple-wave 2.2s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
  pointer-events: none;
}

.epicenter-wave.wave-2 { animation-delay: 0.7s; }
.epicenter-wave.wave-3 { animation-delay: 1.4s; }

@keyframes ripple-wave {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}

.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip { background: var(--bg-secondary) !important; }

.popup-quake-card { font-family: var(--font-main); min-width: 220px; }
.popup-quake-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); padding-bottom: 4px; margin-bottom: 6px; }
.popup-mag { font-size: 1.15rem; font-weight: 800; color: var(--accent-rose); }
.popup-time { font-size: 0.7rem; color: var(--text-muted); }
.popup-loc { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.popup-detail { font-size: 0.7rem; color: var(--text-secondary); line-height: 1.4; }

/* --------------------------------------------------------------------------
   ROW 3: WARNINGS & RECENT EARTHQUAKES (EQUAL 500px HEIGHT)
   -------------------------------------------------------------------------- */
.warning-tabs-group {
  display: flex;
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.warning-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.warning-tab-btn:hover {
  color: var(--text-primary);
}

.warning-tab-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
}

.warning-tab-btn .tab-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
}

.alert-feed-grid,
.news-feed-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}

.alert-feed-grid::-webkit-scrollbar,
.news-feed-grid::-webkit-scrollbar,
.quake-table-wrap::-webkit-scrollbar {
  width: 5px;
}
.alert-feed-grid::-webkit-scrollbar-thumb,
.news-feed-grid::-webkit-scrollbar-thumb,
.quake-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

/* News Card Components */
.news-card-item {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-card-item:hover {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.08);
  transform: translateX(2px);
}

.news-card-thumb-wrap {
  width: 90px;
  height: 75px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.news-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.news-card-item:hover .news-card-thumb {
  transform: scale(1.08);
}

.news-card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.news-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.news-source-tag {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.news-source-tag.official {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.news-source-tag.news {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.news-date-text {
  font-size: 0.66rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.news-date-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ticker-time-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  margin-left: 6px;
}

.news-title-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-excerpt-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alert-card-item {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-amber);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-card-item.danger { border-left-color: var(--accent-rose); }
.alert-card-top { display: flex; align-items: center; justify-content: space-between; }
.alert-province-badge { font-size: 0.68rem; font-weight: 800; padding: 2px 8px; border-radius: 10px; background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.alert-card-item.danger .alert-province-badge { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.alert-pubtime { font-size: 0.66rem; color: var(--text-muted); }
.alert-card-title { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.alert-card-desc { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.4; }
.alert-districts-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.district-pill { font-size: 0.62rem; background: var(--bg-glass); border: 1px solid var(--border-color); padding: 2px 6px; border-radius: 4px; color: var(--text-secondary); }

.quake-table-wrap {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.quake-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.quake-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
}

.quake-table th {
  padding: 8px 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.quake-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.quake-table tr:hover td { background: var(--bg-glass-subtle); }

.table-mag-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.72rem;
  color: #ffffff;
}

.table-mag-badge.high { background: #ef4444; }
.table-mag-badge.mid { background: #f59e0b; }
.table-mag-badge.low { background: #0284c7; }

/* --------------------------------------------------------------------------
   ROW 4: VISITOR STATS & NETWORK TRANSPARENCY
   -------------------------------------------------------------------------- */
.visitor-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.visitor-stat-card {
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.visitor-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.visitor-stat-icon svg { width: 20px; height: 20px; }
.visitor-stat-val { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.visitor-stat-lbl { font-size: 0.72rem; color: var(--text-secondary); font-weight: 600; }

.ip-transparency-card {
  margin-top: 14px;
  background: var(--bg-glass-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.ip-info-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-secondary); }
.ip-highlight { font-family: monospace; background: rgba(56, 189, 248, 0.12); color: var(--accent-blue); padding: 2px 6px; border-radius: 4px; font-weight: 700; }

/* --------------------------------------------------------------------------
   MODAL & FOOTER
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active { opacity: 1; pointer-events: auto; }

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1.4rem; width: 32px; height: 32px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; align-items: center; overflow-y: auto; }
.shakemap-img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }

.dashboard-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--accent-blue); }

/* --------------------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .visitor-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .map-container-wrap { height: 420px; }
}

@media (max-width: 768px) {
  .dashboard-wrapper { padding: 12px 14px 40px 14px; }
  .header-bar { flex-direction: column; align-items: stretch; gap: 14px; }
  .header-actions { justify-content: space-between; }
  .header-clocks { justify-content: space-around; }
  .weather-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .daily-forecast-grid { grid-template-columns: 1fr; }
  .weather-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .map-container-wrap { height: 350px; }
  .visitor-stats-grid { grid-template-columns: 1fr; }
}
