/* =========================================================
   MOBILE + RESPONSIVE FIXES
   ========================================================= */

:root {
  --sidebar-w: 320px;
  --event-w: 340px;
  --topbar-h: 52px;
}

/* ---------- Base mobile-first resets ---------- */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0e17;
  color: #c8d4e8;
  font-family: 'Share Tech Mono', monospace;
  -webkit-text-size-adjust: 100%;
}

#main {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* ---------- TOP BAR ---------- */
#topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #0d121c;
  border-bottom: 1px solid rgba(0,255,136,0.25);
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
}

#topbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

#topbar .logo img {
  width: 88px;
  height: 66px;
}

.weather-center {
  font-size: 12px;
  white-space: nowrap;
  overflow-x: auto;
  flex: 1;
  text-align: center;
  scrollbar-width: none;
}
.weather-center::-webkit-scrollbar { display: none; }

.status-bar {
  display: flex;
  gap: 12px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------- SIDEBAR + EVENT PANEL (desktop default) ---------- */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  overflow-y: auto;
  background: #0b1019;
  border-right: 1px solid rgba(0,255,136,0.2);
  padding: 12px;
  box-sizing: border-box;
}

#eventPanel {
  width: var(--event-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0b1019;
  border-left: 1px solid rgba(0,255,136,0.2);
}

#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

#map {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 200px;
}

/* ---------- MOBILE DRAWER SYSTEM ---------- */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #0d121c;
  border-top: 1px solid rgba(0,255,136,0.3);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav button {
  background: none;
  border: none;
  color: #00ff88;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  min-width: 64px;
}

.mobile-nav button.active {
  color: #fff;
  text-shadow: 0 0 8px #00ff88;
}

.mobile-nav button span {
  font-size: 18px;
  line-height: 1;
}

/* ---------- MEDIA QUERIES ---------- */
@media (max-width: 1100px) {
  :root {
    --sidebar-w: 280px;
    --event-w: 300px;
  }
}

@media (max-width: 900px) {
  /* Hide side panels by default on tablet/phone */
  #sidebar,
  #eventPanel {
    position: fixed;
    top: var(--topbar-h);
    bottom: 56px;           /* leave room for bottom nav */
    z-index: 95;
    width: min(340px, 88vw);
    max-width: 100%;
    transition: transform 0.28s ease;
    box-shadow: 0 0 30px rgba(0,0,0,0.6);
  }

  #sidebar {
    left: 0;
    transform: translateX(-105%);
  }
  #sidebar.open {
    transform: translateX(0);
  }

  #eventPanel {
    right: 0;
    transform: translateX(105%);
  }
  #eventPanel.open {
    transform: translateX(0);
  }

  #content {
    width: 100%;
  }

  .mobile-overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .mobile-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav {
    display: flex;
  }

  /* Compact topbar */
  #topbar {
    padding: 0 8px;
    gap: 6px;
  }
  #topbar .logo {
    font-size: 12px;
  }
  .status-bar {
    display: none;          /* hide on very small screens – info still in sidebar */
  }
  .weather-center {
    font-size: 11px;
  }

  /* Make sure map fills remaining space */
  #main {
    height: calc(100vh - var(--topbar-h) - 56px);
  }

  /* Content header + footer adjustments */
  .content-header {
    padding: 6px 10px !important;
    font-size: 11px;
  }
  #footer {
    font-size: 10px !important;
    padding: 4px 8px !important;
    flex-wrap: wrap;
    gap: 4px;
  }
}

@media (max-width: 600px) {
  #topbar .logo span {
    display: none;          /* keep only the icon on tiny phones */
  }
  .weather-center {
    font-size: 10px;
  }
  #sidebar,
  #eventPanel {
    width: 100%;
    max-width: 100%;
  }
}

/* Utility classes used by the JS below */
.hidden-mobile { display: none !important; }

.legend-box {
  background: rgba(0,0,0,0.55);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  width: 260px;
  line-height: 1.4;
}

.fault-legend-box {
  background: rgba(0,0,0,0.55);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  width: 240px;
  line-height: 1.4;
}

.legend-title {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 8px;
}

.legend-color.dextral { background: #0077ff; }
.legend-color.reverse { background: #ff3333; }
.legend-color.normal  { background: #33cc33; }

/* ---------- REVIEW / QUALITY STATUS ---------- */
.status-badge {
  font-weight: bold;
  letter-spacing: 0.5px;
}
.status-badge.best,
.status-badge.reviewed {
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0,255,136,0.5);
}
.status-badge.preliminary,
.status-badge.automatic {
  color: var(--amber, #ff9800);
  text-shadow: 0 0 6px rgba(255,152,0,0.4);
}
.status-badge.deleted {
  color: #ff3131;
  text-shadow: 0 0 6px rgba(255,49,49,0.4);
}
.status-badge.unknown {
  color: var(--muted, #6b7a8f);
}

.eq-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.eq-status .status-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.eq-status.is-best, .eq-status.is-reviewed { color: #00ff88; }
.eq-status.is-best .status-dot-sm, .eq-status.is-reviewed .status-dot-sm {
  background: #00ff88;
  box-shadow: 0 0 5px #00ff88;
}
.eq-status.is-preliminary, .eq-status.is-automatic { color: var(--amber, #ff9800); }
.eq-status.is-preliminary .status-dot-sm, .eq-status.is-automatic .status-dot-sm {
  background: var(--amber, #ff9800);
  box-shadow: 0 0 5px var(--amber, #ff9800);
}
.eq-status.is-deleted { color: #ff3131; }
.eq-status.is-deleted .status-dot-sm {
  background: #ff3131;
  box-shadow: 0 0 5px #ff3131;
}
.eq-status.is-unknown { color: var(--muted, #6b7a8f); }
.eq-status.is-unknown .status-dot-sm { background: var(--muted, #6b7a8f); }