body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header content should appear above the map */
.header {
  background-color: rgba(255, 255, 255, 0.9);
  max-width: 700px;
  margin: 0 20px;
  z-index: 2;
}

.header h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.5em;
}

/* .header p {
  margin: 10;
  font-size: 1em;
} */

/* Map takes up remaining vertical space */
#map {
  flex: 1;
  width: 100%;
  height: 600px;
  position: relative;
  z-index: 0;
  padding: 10px;
}

/* Legend remains positioned over the map */
#legend {
  position: absolute;
  bottom: 100px;
  left: 15px;
  border-radius: 5px;
  padding: 10px 15px;
  font-family: sans-serif;
  font-size: 13px;
  z-index: 2;
  width: 250px;
}
.legend-scale {
  position: relative;
  display: flex;
  flex-direction: column;
}

.color-bar {
  position: relative;
  width: 100%;
  height: 20px;
  background: linear-gradient(to right, 
      #fee5d9, #fcae91, #fb6a4a, #cb181d);
  border: 1px solid #aaa;
  margin: 5px 0;
}

.herd-line {
  position: absolute;
  left: 75%;
  width: 2px;
  height: 25px;
  background-color: black;
  top: -3px;
}

.herd-label {
  position: absolute;
  left: 65%;
  top: 20px;
  text-align: center;
  font-weight: bold;
  font-size: 12px;
}

.legend-scale span:first-child { 
  position: absolute;
  top: -10px;
  left: 0;
  font-weight: bold;
}

.legend-scale span:last-child {
  position: absolute;
  top: -10px;
  right: 0;
  font-weight: bold;
}

/* Popup text formatting */
.mapboxgl-popup-content h4 {
  font-weight: 300;
  font-size: 0.9em;
  border-bottom: 0.5px solid rgb(80, 80, 80);
  margin: 0.5em 0;
}

.mapboxgl-popup-content h2 {
  font-weight: 500;
  margin: 0.5em 0 0.3em;
}

.mapboxgl-popup-content p {
  font-weight: 300;
  margin: 0.3em 0 0;
}

/* Footer */
footer {
  position: relative;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 10px 10px;
  font-size: 14px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  padding-right: 160px;
}

.footer-right {
  position: absolute;
  bottom: 10px;
  right: 10px;
}

.footer-logo {
  max-height: 50px;
  height: auto;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  #map {
    height: 400px;
  }

  .header {
    padding: 10px;
    margin: 0 10px;
  }
}