/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:              #0A0E1A;
  --surface:         #141927;
  --surface-high:    #1E2535;
  --border:          #2D3748;
  --primary:         #E53E3E;
  --primary-dim:     rgba(229,62,62,.15);
  --text:            #F7FAFC;
  --sub:             #A0AEC0;
  --muted:           #4A5568;

  --deceased:        #FC8181;
  --confirmed:       #F6AD55;
  --symptomatic:     #FBD38D;
  --asymptomatic:    #68D391;
  --recovered:       #76E4F7;
  --suspected:       #B794F4;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --header-h: 60px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input { font-family: inherit; }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section-content { padding: 28px 0 60px; }

/* ─── Skeleton / Loading ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-val,
.skeleton-lbl,
.skeleton-line {
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-high) 25%, var(--border) 50%, var(--surface-high) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-val  { height: 36px; width: 60%; margin-bottom: 8px; border-radius: 6px; }
.skeleton-lbl  { height: 14px; width: 80%; }
.skeleton-line { height: 14px; margin-bottom: 12px; }
.skeleton-line.short { width: 55%; }
.skeleton { border: 1px solid var(--border) !important; }
.stat-card.skeleton { align-items: flex-start; }

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20, 25, 39, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-dim);
  border: 1px solid var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

/* ─── Navigation ─────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-btn {
  color: var(--sub);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.nav-btn:hover  { color: var(--text); background: var(--surface-high); }
.nav-btn.active { color: var(--text); background: var(--surface-high); font-weight: 600; }

/* ─── Lang Switcher ──────────────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-high);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  flex-shrink: 0;
}
.lang-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  padding: 4px 9px;
  border-radius: 4px;
  transition: color .15s, background .15s;
  letter-spacing: .5px;
}
.lang-btn:hover  { color: var(--text); }
.lang-btn.active { color: var(--text); background: var(--border); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: .25s;
}

/* ─── Main / Tabs ────────────────────────────────────────────────────────────── */
.main { min-height: calc(100vh - var(--header-h) - 44px); }
.tab { display: none; }
.tab.active { display: block; }
.map-section { display: none; position: relative; }
.map-section.active { display: block; height: calc(100vh - var(--header-h)); }

/* ─── Alert Banner ───────────────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 28px;
}
.alert-pulse-wrap {
  width: 16px;
  height: 16px;
  position: relative;
  flex-shrink: 0;
}
@keyframes ping {
  0%, 100% { transform: scale(1); opacity: .8; }
  50%        { transform: scale(1.6); opacity: 0; }
}
.alert-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--primary);
  animation: ping 1.6s ease-in-out infinite;
}
.alert-pulse::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--primary);
}
.alert-body { flex: 1; }
.alert-level {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .5px;
}
.alert-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.alert-refresh {
  color: var(--sub);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.alert-refresh:hover { color: var(--text); background: var(--surface-high); }

/* ─── Error Box ──────────────────────────────────────────────────────────────── */
.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(252,129,129,.1);
  border: 1px solid var(--deceased);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  color: var(--deceased);
  font-size: 14px;
}

/* ─── Section Title ─────────────────────────────────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  margin-top: 32px;
}
.section-title:first-of-type { margin-top: 0; }

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  transition: border-color .2s, transform .15s;
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--muted); }
.stat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.stat-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--sub);
  font-weight: 500;
  margin-top: 2px;
}

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 4px;
}

/* ─── Generation Bars ────────────────────────────────────────────────────────── */
.gen-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.gen-row:last-child { border-bottom: none; }
.gen-label { font-size: 13px; color: var(--sub); width: 140px; flex-shrink: 0; }
.bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-high);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 4px;
  transition: width .8s cubic-bezier(.25,.46,.45,.94);
}
.gen-count {
  font-size: 14px;
  font-weight: 700;
  width: 28px;
  text-align: right;
}

/* ─── Vessel Card ────────────────────────────────────────────────────────────── */
.vessel-card { }
.vessel-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.vessel-icon-wrap {
  width: 48px;
  height: 48px;
  background: rgba(246,173,85,.12);
  border: 1px solid rgba(246,173,85,.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--confirmed);
  flex-shrink: 0;
}
.vessel-name { font-size: 16px; font-weight: 700; }
.vessel-sub  { font-size: 12px; color: var(--sub); margin-top: 2px; }
.vessel-stats {
  display: flex;
  align-items: center;
  gap: 24px;
}
.vessel-stat { display: flex; flex-direction: column; }
.vs-num { font-size: 28px; font-weight: 800; color: var(--confirmed); }
.vs-lbl { font-size: 11px; color: var(--sub); margin-top: 2px; }
.vs-divider { width: 1px; height: 40px; background: var(--border); }

/* ─── Sources ────────────────────────────────────────────────────────────────── */
.source-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.source-link:last-of-type { border-bottom: none; }
.source-link:hover { background: var(--surface-high); }
.source-ico {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.source-ico.confirmed  { background: rgba(246,173,85,.15); color: var(--confirmed); }
.source-ico.symptomatic { background: rgba(251,211,141,.15); color: var(--symptomatic); }
.source-ico.asymptomatic { background: rgba(104,211,145,.15); color: var(--asymptomatic); }
.source-body { flex: 1; }
.source-name { font-size: 14px; font-weight: 600; }
.source-sub  { font-size: 12px; color: var(--sub); margin-top: 1px; }
.source-arrow { color: var(--muted); flex-shrink: 0; }
.source-disclaimer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.5;
}

/* ─── Last Updated ───────────────────────────────────────────────────────────── */
.last-updated {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 24px;
}

/* ─── Cases Controls ─────────────────────────────────────────────────────────── */
.cases-controls {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  background: var(--bg);
  padding: 16px 0 12px;
}
.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  gap: 8px;
  margin-bottom: 12px;
  transition: border-color .15s;
}
.search-wrap:focus-within { border-color: var(--primary); }
.search-icon { color: var(--muted); flex-shrink: 0; }
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 12px 0;
}
.search-input::placeholder { color: var(--muted); }
.search-clear {
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: color .15s, background .15s;
}
.search-clear:hover { color: var(--text); background: var(--surface-high); }
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .15s;
}
.chip:hover  { color: var(--text); border-color: var(--muted); }
.chip.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.cases-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 8px;
}

/* ─── Cases Grid ─────────────────────────────────────────────────────────────── */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.loading-msg {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--sub);
  font-size: 15px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ─── Case Card ─────────────────────────────────────────────────────────────── */
.case-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.case-card:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.case-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.case-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.gen-tag {
  font-size: 11px;
  color: var(--sub);
  background: var(--surface-high);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.case-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.case-loc {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--sub);
  overflow: hidden;
}
.case-loc-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.case-date { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ─── Status Badge ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }

/* ─── Map ────────────────────────────────────────────────────────────────────── */
#map {
  width: 100%;
  height: 100%;
  background: #1a2332;
}
.leaflet-container { background: #1a2332; }
.leaflet-tile { filter: brightness(.82) saturate(.65); }
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.leaflet-popup-tip-container { display: none; }
.leaflet-popup-content {
  margin: 12px 14px;
  font-family: 'Inter', sans-serif;
  min-width: 160px;
}
.pop-name  { font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.pop-status{ font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.pop-loc   { font-size: 11px; color: var(--sub); }
.pop-date  { font-size: 11px; color: var(--muted); margin-top: 3px; }
.leaflet-control-attribution { background: rgba(10,14,26,.8) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--sub) !important; }

.map-legend {
  position: absolute;
  bottom: 20px;
  left: 12px;
  z-index: 999;
  background: rgba(20,25,39,.93);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.legend-item:last-child { margin-bottom: 0; }
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(10,14,26,.8);
  flex-shrink: 0;
}
.legend-label { font-size: 12px; font-weight: 500; }

/* ─── Info Page ──────────────────────────────────────────────────────────────── */
.info-header {
  text-align: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.info-logo-wrap {
  width: 80px;
  height: 80px;
  background: rgba(229,62,62,.12);
  border: 1px solid rgba(229,62,62,.3);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin: 0 auto 16px;
}
.info-title   { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.info-version { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.info-desc    { font-size: 14px; color: var(--sub); max-width: 480px; margin: 0 auto; line-height: 1.6; }

.body-text { font-size: 14px; color: var(--text); line-height: 1.65; }
.body-text strong { color: var(--text); font-weight: 700; }

.symptom-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.symptom-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--sub);
}
.symptom-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--symptomatic);
  flex-shrink: 0;
}

.disclaimer-box {
  display: flex;
  gap: 14px;
  background: rgba(251,211,141,.08);
  border: 1px solid rgba(251,211,141,.25);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 24px;
  margin-bottom: 8px;
}
.disclaimer-icon { color: var(--symptomatic); flex-shrink: 0; margin-top: 2px; }
.disclaimer-box p { font-size: 13px; color: var(--sub); line-height: 1.6; }
.disclaimer-box strong { color: var(--text); font-weight: 700; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10,14,26,.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
}
.modal-close:hover { color: var(--text); background: var(--surface-high); }
.modal-name  { font-size: 20px; font-weight: 700; margin-bottom: 10px; padding-right: 32px; line-height: 1.3; }
.modal-id    { font-size: 11px; color: var(--muted); font-family: monospace; margin-top: 6px; }
.detail-section { margin-top: 20px; }
.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.detail-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 8px;
}
.detail-row:last-child { border-bottom: none; }
.detail-key   { color: var(--sub); width: 120px; flex-shrink: 0; }
.detail-val   { color: var(--text); font-weight: 500; flex: 1; text-align: right; }
.detail-notes {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  background: var(--surface-high);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 8px;
  white-space: pre-wrap;
}

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.footer-time { color: var(--muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { display: none; }
  .hamburger { display: flex; }
  .nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    gap: 4px;
    z-index: 99;
  }
  .nav.open .nav-btn { width: 100%; text-align: left; padding: 12px 16px; border-radius: var(--radius-sm); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .symptom-grid { grid-template-columns: repeat(2, 1fr); }
  .vessel-stats { flex-wrap: wrap; gap: 16px; }
  .vs-divider { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cases-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 4px; text-align: center; }
}
