/* ==========================================================================
   PulseMonitor - Modern, High-Performance Text-Focused Dashboard Theme
   ========================================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101622;
  --bg-tertiary: #172033;
  --bg-hover: #1e2942;
  --bg-card: rgba(16, 22, 34, 0.85);

  --border-subtle: #1e293b;
  --border-focus: #3b82f6;
  --border-hazard: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-purple: #a855f7;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost, .btn-action, .btn-micro {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  padding: 8px 16px;
}
.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-subtle);
  padding: 8px 14px;
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
}
.btn-ghost:hover {
  color: var(--text-main);
  background: var(--bg-tertiary);
}

.btn-micro {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  font-size: 0.75rem;
}
.btn-micro:hover {
  color: var(--text-muted);
}

.btn-action {
  background: #0ea5e9;
  color: white;
  padding: 8px 14px;
}

/* ==========================================================================
   Main Layout & Grid
   ========================================================================== */

.main-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
  flex: 1;
}

.intel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

@media (max-width: 980px) {
  .intel-grid {
    grid-template-columns: 1fr;
  }
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Card Styling */
.intel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.tag-weather { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.tag-seismic { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.tag-forecast { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.tag-alerts { background: rgba(16, 185, 129, 0.15); color: #34d399; }

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

.update-pill, .radius-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Briefing & Critical Alert Banners
   ========================================================================== */

.critical-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.critical-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.alert-symbol {
  font-size: 1.8rem;
  animation: shake 1.5s infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

.briefing-card {
  background: linear-gradient(135deg, rgba(23, 32, 51, 0.8), rgba(16, 22, 34, 0.95));
  border-color: #2a3a5a;
}

.briefing-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}

.section-heading {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.location-coords {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.briefing-actions {
  display: flex;
  gap: 8px;
}

.morning-briefing-box {
  margin-top: 14px;
  padding: 14px 18px;
  background: rgba(10, 13, 20, 0.6);
  border-left: 3px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.6;
}

/* ==========================================================================
   Weather Intel & Hazard Grid
   ========================================================================== */

.temp-hero {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 20px;
}

.temp-main {
  display: flex;
  align-items: flex-start;
}

.temp-val {
  font-size: 3.8rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #ffffff;
}

.temp-unit {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-top: 4px;
}

.temp-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weather-label {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e2e8f0;
}

.feels-like {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Hazard cards for specific user checks: rain, thunderstorm, sun, wind */
.hazard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.hazard-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s ease;
}

.hazard-card.warning {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}

.hazard-card.danger {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.hazard-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.hazard-icon {
  font-size: 1.1rem;
}

.hazard-name {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
}

.hazard-status {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.hazard-detail {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Metric Rows */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.85rem;
}

.metric-label {
  color: var(--text-muted);
}

.metric-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #cbd5e1;
}

/* ==========================================================================
   Daily Text Forecast
   ========================================================================== */

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.forecast-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  gap: 12px;
}

.forecast-day-name {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 90px;
}

.forecast-condition-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.forecast-temps {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.temp-max {
  color: #f87171;
  font-weight: 600;
  margin-right: 6px;
}

.temp-min {
  color: #60a5fa;
}

/* ==========================================================================
   Seismic Intel & Indian Ocean Tsunami Shield
   ========================================================================== */

.tsunami-shield-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.shield-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.shield-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.badge-normal {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-watch {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
  animation: pulse-ring 2s infinite ease;
}

.badge-warning {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.6);
  animation: pulse-ring 1.2s infinite ease;
}

.shield-zones {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.shield-text {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.eta-box {
  margin-top: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.eta-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fca5a5;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.eta-content {
  font-size: 0.85rem;
  color: #fff;
  line-height: 1.5;
}

.proximity-summary {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-amber);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #cbd5e1;
  margin-bottom: 16px;
  line-height: 1.5;
}

.tsunami-alert {
  background: rgba(239, 68, 68, 0.18);
  border: 2px solid var(--accent-red);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.tsunami-icon {
  font-size: 1.8rem;
}

.tsunami-details strong {
  color: #fca5a5;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.tsunami-details p {
  font-size: 0.85rem;
  color: #fee2e2;
}

.quake-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quake-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.quake-item:hover {
  transform: translateX(2px);
  border-color: #334155;
}

.quake-mag-badge {
  min-width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  line-height: 1;
}

.mag-light {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mag-moderate {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.mag-strong {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
  animation: pulse-ring 2s infinite ease;
}

.quake-body {
  flex: 1;
}

.quake-place {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.quake-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.quake-distance {
  color: var(--accent-blue);
  font-weight: 600;
}

.quake-time {
  color: var(--text-muted);
}

/* ==========================================================================
   Alert Dispatch Log
   ========================================================================== */

.alert-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
}

.log-time {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.log-msg {
  color: #cbd5e1;
  line-height: 1.4;
}

.empty-state {
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 20px;
  text-align: center;
  font-style: italic;
}

/* ==========================================================================
   Modal / Settings View
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
}

.config-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-prefix {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
  border-right: 1px solid var(--border-subtle);
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-col label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-col input, .form-col select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font-main);
  outline: none;
}

.form-col input:focus, .form-col select:focus {
  border-color: var(--border-focus);
}

/* Switch & Checkbox */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  font-size: 0.85rem;
  color: #e2e8f0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2563eb;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #cbd5e1;
  cursor: pointer;
}

.check-item input[type="checkbox"] {
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
}

.test-feedback {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  margin-top: 6px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  padding: 18px 24px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: auto;
}

.app-footer a {
  color: var(--accent-blue);
  text-decoration: none;
}
.app-footer a:hover {
  text-decoration: underline;
}

.search-box-wrapper {
  position: relative;
  margin-top: 6px;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 120;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

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

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

.search-result-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

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

.search-feedback {
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* Recommendation Box in Settings */
.recommendation-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 10px;
}

.recommendation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #38bdf8;
  margin-bottom: 4px;
}

.rec-text {
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 10px;
}

.rec-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

#btn-apply-recommended-quake {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid #38bdf8;
  padding: 6px 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

#btn-apply-recommended-quake:hover {
  background: #0284c7;
  color: #fff;
}

.rec-safe-tag {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: #34d399;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Language Switcher
   ========================================================================== */
.lang-switch-group {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lang-btn:hover {
  color: var(--text-main);
}

.lang-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.4);
}

/* ==========================================================================
   Nilwala River Hydrology & Water Level Monitor
   ========================================================================== */
.tag-river {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.river-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.river-gauge-visual {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.river-stat-main {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.river-level-val {
  font-size: 3.2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
  color: #38bdf8;
  transition: color 0.3s ease;
}

.river-level-unit {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-muted);
}

.river-stage-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.river-stage-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  width: fit-content;
}

.river-discharge {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.river-stations-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.station-tag {
  font-size: 0.72rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Animated River Flow Graphic */
.river-animation-container {
  position: relative;
  height: 125px;
  background: #091829;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.2);
  overflow: hidden;
  margin-bottom: 20px;
}

.river-depth-markers {
  position: absolute;
  top: 0;
  right: 12px;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
  padding: 8px 0;
  pointer-events: none;
}

.river-depth-markers .marker {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(10, 13, 20, 0.75);
  border-left: 2px solid #64748b;
  color: var(--text-muted);
}

.river-depth-markers .marker.alert {
  border-left-color: #f59e0b;
  color: #fbbf24;
}

.river-depth-markers .marker.minor {
  border-left-color: #f97316;
  color: #fdba74;
}

.river-depth-markers .marker.major {
  border-left-color: #ef4444;
  color: #fca5a5;
  font-weight: 600;
}

.river-water-surface {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 65%;
  transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.river-waves {
  position: absolute;
  top: -24px;
  left: 0;
  width: 200%;
  height: 28px;
}

.wave-layer {
  animation: riverWaveFlow 7s linear infinite;
  fill: #0284c7;
  opacity: 0.8;
}

.wave-layer.wave-2 {
  animation: riverWaveFlow 5s linear infinite reverse;
  fill: #0369a1;
  opacity: 0.6;
}

@keyframes riverWaveFlow {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.river-water-body {
  flex: 1;
  background: linear-gradient(180deg, #0284c7 0%, #0c4a6e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.river-flow-speed {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 10px;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
}

/* Turbid / Amber / Crimson Flood Mode Tinting */
.river-animation-container.stage-alert .river-water-body {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
}
.river-animation-container.stage-alert .wave-layer {
  fill: #b45309;
}
.river-animation-container.stage-alert .river-level-val {
  color: #f59e0b;
}

.river-animation-container.stage-minor .river-water-body {
  background: linear-gradient(180deg, #c2410c 0%, #7c2d12 100%);
}
.river-animation-container.stage-minor .wave-layer {
  fill: #ea580c;
}
.river-animation-container.stage-minor .river-level-val {
  color: #f97316;
}

.river-animation-container.stage-major .river-water-body {
  background: linear-gradient(180deg, #b91c1c 0%, #450a0a 100%);
}
.river-animation-container.stage-major .wave-layer {
  fill: #dc2626;
}
.river-animation-container.stage-major .river-level-val {
  color: #ef4444;
}

/* 7-Day History Chart */
.river-history-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

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

.history-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.history-trend {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.river-history-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  padding: 10px 4px 4px 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.river-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}

.river-bar-fill-wrap {
  width: 100%;
  height: 65px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.river-bar-fill {
  width: 70%;
  border-radius: 4px 4px 0 0;
  background: #0284c7;
  transition: height 0.5s ease;
  min-height: 4px;
}

.river-bar-fill.bar-today {
  background: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  border: 1px solid #ffffff;
}

.river-bar-val {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.river-bar-date {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ==========================================================================
   Southern Coast & Weligama Bay Marine Monitor (Sea Level & Tides)
   ========================================================================== */
.tag-marine {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.marine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 600px) {
  .marine-grid {
    grid-template-columns: 1fr;
  }
}

.marine-metric-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.marine-metric-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.marine-metric-val {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.marine-metric-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.tide-container {
  background: rgba(14, 165, 233, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
}

.tide-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.tide-title {
  font-size: 0.9rem;
  color: #f8fafc;
}

.tide-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tide-phase-pill {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.tide-milestones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.tide-milestone {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.tide-milestone.high-tide {
  border-left: 3px solid #38bdf8;
}

.tide-milestone.low-tide {
  border-left: 3px solid #f59e0b;
}

.tide-milestone .tide-icon {
  font-size: 1.4rem;
}

.tide-time {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.tide-level {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.tide-visual-wrapper {
  margin-top: 8px;
}

.tide-curve-svg {
  width: 100%;
  height: 60px;
  display: block;
}

.tide-time-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 4px;
}

/* ==========================================================================
   2D Sri Lanka Island & Seismic Wave Radar Visual
   ========================================================================== */
.sri-lanka-radar-box {
  background: #09111e;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 16px;
  overflow: hidden;
  position: relative;
}

.radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.78rem;
}

.radar-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.green {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.legend-dot.red {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.radar-threat-indicator {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 600;
}

.sri-lanka-svg-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 290px;
  background: radial-gradient(circle at 75% 85%, rgba(239, 68, 68, 0.08) 0%, transparent 60%);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.radar-sweep-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.08);
}

.radar-ring.ring-1 { width: 140px; height: 140px; }
.radar-ring.ring-2 { width: 240px; height: 240px; }
.radar-ring.ring-3 { width: 340px; height: 340px; }

/* 2D Seismic Shockwave Ripples (Hidden by default, shown only during actual earthquake / tsunami threat) */
.seismic-shockwave-layer {
  display: none;
  position: absolute;
  bottom: 10px;
  right: 20px;
  width: 100px;
  height: 100px;
  pointer-events: none;
}

.seismic-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  margin-top: -15px;
  border-radius: 50%;
  border: 2px solid rgba(239, 68, 68, 0.7);
  opacity: 0;
  animation: shockwaveRipple 3.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.seismic-ripple.ripple-2 { animation-delay: 1.1s; }
.seismic-ripple.ripple-3 { animation-delay: 2.2s; }

@keyframes shockwaveRipple {
  0% {
    transform: scale(0.3);
    opacity: 0.9;
    border-color: #ef4444;
  }
  50% {
    opacity: 0.6;
    border-color: #f97316;
  }
  100% {
    transform: scale(7.5);
    opacity: 0;
    border-color: #38bdf8;
  }
}

.ocean-radar-svg {
  width: 100%;
  max-width: 380px;
  height: auto;
  position: relative;
  z-index: 5;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.5));
}

.ocean-water-label {
  font-family: var(--font-mono);
  font-size: 7.5px;
  fill: rgba(56, 189, 248, 0.4);
  letter-spacing: 0.5px;
  user-select: none;
}

.distance-ring {
  fill: none;
  stroke-dasharray: 4, 3;
}

.distance-ring.ring-400 {
  stroke: rgba(56, 189, 248, 0.45);
  stroke-width: 1.2;
}

.distance-ring.ring-1500 {
  stroke: rgba(56, 189, 248, 0.3);
  stroke-width: 1.2;
}

.distance-ring.ring-3000 {
  stroke: rgba(239, 68, 68, 0.5);
  stroke-width: 1.5;
}

.distance-label {
  font-family: var(--font-mono);
  font-size: 6.8px;
  fill: #94a3b8;
  user-select: none;
}

.distance-label.label-3000 {
  fill: #f87171;
  font-weight: 600;
}

.distance-label.label-1500 {
  fill: #7dd3fc;
}

.distance-label.label-400 {
  fill: #38bdf8;
}

.home-center-icon {
  font-size: 14px;
  user-select: none;
}

.home-center-label {
  font-family: var(--font-main);
  font-size: 8px;
  font-weight: 700;
  fill: #38bdf8;
  text-anchor: middle;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}

.home-pulse-halo {
  fill: none;
  stroke: #38bdf8;
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: homePulse 2s infinite ease-in-out;
}

@keyframes homePulse {
  0% {
    transform: scale(0.85);
    opacity: 0.9;
    stroke-width: 1.5;
  }
  50% {
    transform: scale(2.2);
    opacity: 0;
    stroke-width: 0.8;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.9;
    stroke-width: 1.5;
  }
}

.map-node-label {
  font-family: var(--font-main);
  font-size: 7.5px;
  fill: #cbd5e1;
  user-select: none;
}

.map-node-label.node-weligama {
  fill: #34d399;
  font-weight: 600;
}

.trench-box-title {
  font-family: var(--font-main);
  font-size: 7.5px;
  font-weight: 700;
  fill: #fca5a5;
}

.trench-box-sub {
  font-family: var(--font-mono);
  font-size: 6.5px;
  fill: #cbd5e1;
}

.cyclone-track-ring {
  fill: none;
  stroke: rgba(168, 85, 247, 0.4);
  stroke-width: 1;
  stroke-dasharray: 3, 2;
}

.cyclone-symbol {
  font-size: 13px;
  transform-box: fill-box;
  transform-origin: center;
  display: inline-block;
  animation: cycloneSpin 8s linear infinite;
  user-select: none;
}

@keyframes cycloneSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-360deg);
  }
}

.cyclone-track-label {
  font-family: var(--font-mono);
  font-size: 6.8px;
  fill: #c084fc;
}

.radar-status-bar {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: rgba(10, 13, 20, 0.7);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.radar-blink-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse-ring 1.5s infinite;
}

/* Radar Zoom Controls & Interactive Canvas */
.radar-zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 25;
  background: rgba(10, 16, 28, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.radar-zoom-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border-radius: 4px;
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.radar-zoom-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: scale(1.06);
}

.radar-zoom-btn.zoom-level-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #38bdf8;
}

.sri-lanka-svg-container.is-zoomed {
  cursor: grab;
}

.sri-lanka-svg-container.is-grabbing {
  cursor: grabbing;
}

#radar-zoom-layer {
  transform-origin: 200px 200px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.trench-fault-name {
  font-family: var(--font-mono);
  font-size: 6.2px;
  fill: #fca5a5;
  letter-spacing: 0.4px;
  user-select: none;
}

.trench-arrow-label {
  font-family: var(--font-mono);
  font-size: 5.8px;
  fill: #fca5a5;
  font-weight: 600;
  user-select: none;
}


