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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #07090e;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
}

/* Map Canvas Container */
#map {
  width: 100%;
  height: 100vh;
  background: #07090e;
  z-index: 1;
}

/* Custom Canvas Light Overlay */
.glow-canvas-layer {
  pointer-events: none;
  z-index: 400;
}

/* Top HUD Header */
.hud-top {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud-brand {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(14px);
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.brand-glow-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff3a0;
  box-shadow: 0 0 14px 4px #ffc83b, 0 0 28px 8px rgba(255, 170, 0, 0.4);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ffd000;
  background: rgba(255, 208, 0, 0.12);
  border: 1px solid rgba(255, 208, 0, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
  margin-top: 1px;
}

/* Metrics Counter Panel */
.metrics-panel {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(14px);
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.metric-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-glow {
  background: #fff4a3;
  box-shadow: 0 0 8px 2px #ffc83b;
}

.dot-dim {
  background: #f59e0b;
  opacity: 0.7;
}

.dot-dark {
  background: #18202f;
  border: 1.5px solid #f8fafc;
  box-shadow: 0 0 6px rgba(248, 250, 252, 0.45);
}

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.metric-label {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Search Box for Communities */
.search-panel {
  pointer-events: auto;
  position: relative;
  width: 280px;
}

.search-panel input {
  width: 100%;
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.search-panel input:focus {
  border-color: rgba(255, 208, 0, 0.5);
  box-shadow: 0 0 15px rgba(255, 208, 0, 0.25);
}

.search-results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  background: rgba(13, 17, 23, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  z-index: 2000;
}

.search-item {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-item:hover {
  background: rgba(255, 208, 0, 0.15);
}

.search-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.search-item-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* Layer Pills */
.layer-pills {
  pointer-events: auto;
  display: flex;
  gap: 6px;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(14px);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pill {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.pill-github {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #94a3b8;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding-left: 10px;
  margin-left: 4px;
}

.pill-github:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

.pill.active {
  background: rgba(255, 208, 0, 0.15);
  border-color: rgba(255, 208, 0, 0.35);
  color: #ffdc33;
  font-weight: 600;
}

.pill-separator {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: auto 3px;
}

.pill-live.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* District Details Card (Floating Sidebar) */
.district-card {
  position: absolute;
  top: 90px;
  right: 20px;
  width: 320px;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  display: none;
  animation: fadeIn 0.2s ease;
}

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

.btn-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
}

.card-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.badge-on {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.badge-maybe {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.badge-off {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-tg-channel {
  display: block;
  margin-top: 12px;
  padding: 9px 12px;
  background: #0284c7;
  color: #ffffff;
  text-decoration: none;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-tg-channel:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.card-operator {
  font-size: 11px;
  color: #ffd000;
  font-weight: 500;
  margin-bottom: 14px;
}

.card-group-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 20px;
}

.card-group-num {
  font-size: 15px;
  font-weight: 700;
  color: #ffd000;
  font-family: 'JetBrains Mono', monospace;
}

.card-group-hint {
  font-size: 11px;
  color: #64748b;
}

.card-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.timeline-mini {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  height: 28px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-bar {
  border-radius: 2px;
  height: 100%;
  transition: transform 0.15s ease;
}

.mini-bar.current {
  border: 1.5px solid #fff;
  transform: scaleY(1.15);
}

.mini-bar.bar-on {
  background: #ffcc00;
  box-shadow: 0 0 6px rgba(255, 204, 0, 0.5);
}

.mini-bar.bar-maybe {
  background: #926900;
}

.mini-bar.bar-off {
  background: #1e293b;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #64748b;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* Bottom HUD Timeline Bar */
.hud-bottom {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(840px, calc(100% - 40px));
}

.timeline-controls {
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(16px);
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.live-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.time-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #ffd000;
  min-width: 58px;
  text-align: center;
}

.slider-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: #1e293b;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffd000;
  box-shadow: 0 0 12px #ffc83b;
  cursor: pointer;
  border: 2px solid #fff;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
}

/* Custom Tooltip Styling for Leaflet */
.leaflet-popup-content-wrapper {
  background: rgba(13, 17, 23, 0.94) !important;
  color: #fff !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}

.leaflet-popup-tip {
  background: rgba(13, 17, 23, 0.94) !important;
}

@media (max-width: 768px) {
  .hud-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .hud-bottom {
    width: calc(100% - 24px);
  }
  .region-pills {
    display: none;
  }
}
