body {
  margin: 0;
  padding: 0;
}

/* Outer container — positions the loading overlay relative to the map */
#map-container {
  position: relative;
  width: 90%;
  height: 600px;
  margin: 10px auto; /* Fixed: Added missing 'px' unit */
}

/* Trip branding logo, pinned top-left over the map.
   pointer-events: none ensures it doesn't block map interaction. */
#map-container .overlay-image {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 96px;
  z-index: 1000;
  pointer-events: none;
}

/* Map canvas fills the container */
#map {
  width: 100%;
  height: 100%;
}

/* Mapbox popup width override — wide enough for the HTML desc field
   generated by getTripPoints (datetime, lat, lng, altitude, ID) */
.mapboxgl-popup-content {
  width: 350px !important;
  overflow: auto;
  padding: 10px;
  font-size: 14px;
}

.my-custom-popup {
  max-width: 350px;
}

/* Semi-transparent loading overlay shown while the map and waypoints load.
   Hidden once the getTripPoints fetch and icon loading are complete.
   Replaced by an error message if the fetch fails. */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
  z-index: 10;
}

/* CSS spinner shown during load */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.2);
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.loading-text {
  font-size: 1.2em;
  color: #333;
}

/* Error state — shown in place of the spinner if the data fetch fails */
.error-text {
  font-size: 1.2em;
  color: #cc0000;
  text-align: center;
  padding: 0 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#status-banner {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
  font-family: sans-serif;
  font-size: 15px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none; /* Allows users to pan the map under the banner */
  width: max-content;
  max-width: 90vw;
  backdrop-filter: blur(4px);
}

#banner-weather {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Unifies the color and opacity for all vertical bars */
.banner-divider,
.banner-divider-inline {
  opacity: 0.3;
  color: #333;
}

/* Stays visible on mobile, unlike .banner-divider — used between
   temp and wind, which should stay on the same line at all sizes */

@media (max-width: 600px) {
  #status-banner {
    font-size: 13px;
    padding: 10px 18px;
    top: 10px;
    gap: 4px;
    flex-direction: column;
    text-align: center;
    border-radius: 20px;
  }

  .banner-divider {
    display: none;
  }

  #banner-weather {
    flex-direction: column;
    gap: 2px;
  }

  .banner-sun {
    display: block;
    margin-left: 0;
    margin-top: 2px;
  }
}

/* Ensure the text align perfectly on their own line */
.banner-top-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}