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

body {
  font-family: 'Consolas', 'Monaco', 'Cascadia Code', 'SF Mono', 'Roboto Mono', monospace;
  line-height: 1.6;
  color: #e0e0e0;
  background-color: #0a0a0a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background-color: #1a1a1a;
  color: #ffffff;
  padding: 0.75rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  border-bottom: 1px solid #404040;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-logo {
  font-size: 1.5rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.main-navigation {
  margin-left: auto;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: #b0b0b0;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 2px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.nav-link:hover,
.nav-link:focus {
  background-color: #404040;
  color: #ffffff;
  outline: none;
}

.nav-link.current {
  background-color: #4080ff;
  color: #ffffff;
  font-weight: 600;
}

/* Dashboard */
.dashboard-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
  width: 100%;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #404040;
}

.page-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.page-title {
  font-size: 1.75rem;
  color: #ffffff;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.status-dot.online {
  background-color: #00ff80;
  box-shadow: 0 0 12px rgba(0, 255, 128, 0.6);
  animation: pulse 2s infinite;
}

.status-text {
  font-weight: 600;
  color: #00ff80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Legend */
.legend-section {
  background-color: #2a2a2a;
  padding: 1rem;
  border-radius: 2px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
  border: 1px solid #404040;
}

.legend-title {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.legend-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  border: 1px solid #ddd;
}

.legend-color.low {
  background-color: #000080;
}
.legend-color.medium {
  background-color: #0080ff;
}
.legend-color.high {
  background-color: #ff8000;
}
.legend-color.critical {
  background-color: #ff0000;
}

.legend-label {
  font-size: 0.9rem;
  color: #b0b0b0;
  font-weight: 500;
}

/* Dashboard header (part with controls) */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #ecf0f1;
}

.controls-and-legend {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.map-controls {
  background-color: #2a2a2a;
  padding: 1rem;
  border-radius: 2px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
  border: 1px solid #404040;
}

.map-controls .control-title {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.map-controls .control-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.map-controls .control-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid #606060;
  background-color: #404040;
  color: #e0e0e0;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: all 0.2s ease;
  min-width: 32px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-controls .control-btn:hover,
.map-controls .control-btn:focus {
  background-color: #4080ff;
  color: #ffffff;
  border-color: #4080ff;
  outline: none;
  box-shadow: 0 0 8px rgba(64, 128, 255, 0.4);
}

.map-controls .power-filter {
  padding: 0.5rem;
  border: 1px solid #606060;
  border-radius: 2px;
  background-color: #404040;
  color: #e0e0e0;
  font-size: 0.85rem;
  margin-left: 0.5rem;
  font-family: inherit;
}

.map-controls .power-filter:focus {
  outline: 2px solid #4080ff;
  border-color: #4080ff;
  box-shadow: 0 0 8px rgba(64, 128, 255, 0.4);
}

/* Dashboard content */
.dashboard-content {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 1.5rem;
  min-height: 500px;
}

/* Map */
.map-container {
  background-color: #1a1a1a;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  position: relative;
  height: 100%; /* Fill grid cell height */
  border: 1px solid #404040;
}

.world-map {
  position: relative;
  height: 100%; /* Fill container height */
  min-height: 400px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.map-container {
  display: flex;
  flex-direction: column;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.map-placeholder {
  display: none;
}

/*** Leaflet styling ***/
.leaflet-control-zoom {
  display: none; /* Using custom zoom controls */
}

.leaflet-popup-content-wrapper {
  background: #1a1a1a;
  color: #ffffff;
  border-radius: 8px;
}

.leaflet-popup-content {
  color: #ffffff;
}

.leaflet-popup-tip {
  background: #1a1a1a;
}

/* Loading overlay */
.map-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  z-index: 1000;
  border-radius: 8px;
}

.loading-spinner {
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Stats panel */
.stats-panel {
  background-color: #2a2a2a;
  padding: 1.25rem;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  height: fit-content;
  border: 1px solid #404040;
}

.stats-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: #ffffff;
  border-bottom: 1px solid #404040;
  padding-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stats-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stats-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stats-label {
  font-size: 0.85rem;
  color: #b0b0b0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-value {
  font-size: 0.95rem;
  color: #e0e0e0;
  font-weight: 500;
}

.stats-value.critical-reading {
  color: #ff0000;
  font-weight: 700;
  text-shadow: 0 0 4px rgba(255, 0, 0, 0.5);
}

.location-photos {
  border-top: 1px solid #404040;
  padding-top: 1rem;
}

.photos-title {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.photo-placeholder {
  width: 100%;
  border-radius: 2px;
  background-color: #404040;
  border: 1px solid #606060;
}

/* Footer/bottom status bar */
.site-footer {
  background-color: #1a1a1a;
  color: #e0e0e0;
  padding: 1rem 0;
  margin-top: 2rem;
  border-top: 1px solid #404040;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.external-link {
  color: #4080ff;
  text-decoration: none;
  font-weight: 500;
}

.external-link:hover,
.external-link:focus {
  text-decoration: underline;
  outline: none;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(64, 128, 255, 0.5);
}

.footer-separator {
  color: #606060;
}

.disclaimer {
  color: #b0b0b0;
  font-weight: 400;
}

*:focus {
  outline: 2px solid #4080ff;
  outline-offset: 2px;
}

button:focus,
select:focus,
a:focus {
  outline: 2px solid #4080ff;
  outline-offset: 2px;
}

@media screen and (max-width: 767px) {
  /* Header */
  .header-content {
    flex-direction: column;
    gap: 1rem;
    padding: 0 0.75rem;
  }

  .site-branding {
    justify-content: center;
  }

  .site-title {
    font-size: 1.1rem;
  }

  .main-navigation {
    margin-left: 0; /* Override desktop right-alignment */
    width: 100%;
  }

  .nav-menu {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    text-align: center;
    align-items: center;
  }

  .nav-link {
    display: block;
    padding: 0.75rem;
  }

  /* Dashboard */
  .dashboard-main {
    padding: 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .controls-and-legend {
    flex-direction: column;
    gap: 1rem;
  }

  .map-controls .control-group {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .map-controls .power-filter {
    width: 100%;
    margin-left: 0;
    margin-top: 0.5rem;
  }

  /* Force single column */
  .dashboard-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .world-map {
    height: 300px;
  }

  /* Stats panel adjustments */
  .stats-panel {
    order: -1; /* Move stats panel above map */
    padding: 1rem;
  }

  .stats-title {
    font-size: 1rem;
  }

  /* Footer adjustments */
  .footer-content {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 0 0.75rem;
  }

  .footer-right {
    flex-direction: column;
    gap: 0.5rem;
  }

  .footer-separator {
    display: none;
  }
}

@media screen and (min-width: 768px) and (max-width: 1023px) {
  /* Header */
  .header-content {
    padding: 0 1rem;
  }

  .nav-menu {
    gap: 1.5rem;
  }

  /* Dashboard */
  .dashboard-main {
    padding: 1.25rem;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 1.5rem;
  }

  .controls-and-legend {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
  }

  .dashboard-content {
    grid-template-columns: 1fr 280px;
    gap: 1.25rem;
    min-height: auto;
  }

  /* Footer */
  .footer-content {
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .footer-right {
    gap: 0.75rem;
  }
}

@media screen and (min-width: 1024px) and (max-width: 1199px) {
  .header-content,
  .dashboard-main,
  .footer-content {
    max-width: 100%;
    padding: 0 1.5rem;
  }

  .dashboard-content {
    grid-template-columns: 1fr 280px;
    min-height: auto;
  }
}

@media screen and (max-width: 479px) {
  .site-header {
    padding: 0.5rem 0;
  }

  .site-title {
    font-size: 1rem;
  }

  .site-logo {
    font-size: 1.25rem;
  }

  .dashboard-main {
    padding: 0.75rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .map-controls,
  .legend-section {
    padding: 0.75rem;
  }

  .control-title,
  .legend-title {
    font-size: 0.85rem;
  }

  .map-controls .control-btn {
    padding: 0.5rem;
    min-width: 28px;
    font-size: 0.85rem;
  }

  .world-map {
    height: 250px;
  }

  .stats-panel {
    padding: 0.75rem;
  }

  .legend-list {
    gap: 0.375rem;
  }

  .legend-item {
    font-size: 0.85rem;
  }
}

/* Very wide screens */
@media screen and (min-width: 1400px) {
  .header-content,
  .dashboard-main,
  .footer-content {
    max-width: 1400px;
  }
}

/* Keep touch targets accessible on mobile by making them bigger */
@media screen and (max-width: 767px) {
  .control-btn,
  .nav-link,
  .power-filter {
    min-height: 44px;
  }
}
