html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
/* Color themes */
:root {
  --primary-color: #003865;
  --accent-color: #78BE21;
  --marker-red: #A6192E;
}
/* Title Bar */
#title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between; /* space out logo/title and button */
  height: 50px;
  background:var(--primary-color);
  color: white;
  font-weight: bold;
  padding: 0 10px;
  font-size: 1.5rem;
  border-bottom: 4px solid var(--accent-color); /* green accent line */
  font-family: Calibri, sans-serif !important;
}
/* Logo */
#mn-logo {
  height: 48px;
  margin-right: 10px;
}
/* Keep logo and text aligned */
#title-bar span {
  display: flex;
  align-items: center;
}
/* Info button wrapper */
#info-btn {
  background: none;
  padding: 0;
  cursor: pointer;
  border: none;
}
/* Circle around the icon */
#info-btn i {
  font-size: 1.6rem;
  color: var(--accent-color);
  background: var(--primary-color);
  padding: 0.6rem;
  border-radius: 50%;
}
/* Map */
#map {
  width: 100%;
  height: calc(100% - 50px);
}
/* Spinner */
#spinner {
  display: none;
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
  color:var(--primary-color);
  border-radius: 5px;
  z-index: 1000;
  font-weight: bold;
  font-family: Calibri, sans-serif !important;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
/* Spinner visible */
#spinner.visible {
  display: block;
}
/* Bottom profile panel */
#profile-panel {
  position: fixed;
  bottom: -260px; /* hidden by default */
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 275px;
  background: white;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  z-index: 1200;
  transition: bottom 0.28s ease-in-out;
  overflow: hidden;
  display: none;
}
/* Pannel visible */
#profile-panel.visible {
  bottom: 10px;
  display: block;
}
/* Chart container */
.chart-container-bottom {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}
/* Export button inside panel */
.export-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  font-family: Calibri, sans-serif !important;
}

.export-btn:hover {
  background: #0056b3;
}
/* Close (X) button */
#close-profile {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--primary-color);
  z-index: 10;
}

#close-profile:hover {
  color: var(--marker-red);
  font-weight: bold;
}
/* Draw vertices */
.leaflet-div-icon.leaflet-editing-icon {
  border-radius: 50% !important;
  width: 10px !important;
  height: 10px !important;
  margin-left: -5px !important;
  margin-top: -5px !important;
  background-color: var(--marker-red) !important;
  border: 1px solid #fff !important;
}
/* Custom crosshairs icon */
.custom-search-icon i {
  color: var(--marker-red);
  font-size: 30px;
  text-shadow: 1px 1px 2px black; /* makes icon pop */
}
/* Zoom-to-Minnesota button */
.zoom-to-mn {
  background-color: white;
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.zoom-to-mn:hover {
  background-color: var(--primary-color);
  color: white;
}
/* Style for the custom scale control */
.custom-scale {
  background-color: rgba(255, 255, 255, 1);
  padding: 4px 8px;
  border: 2px solid var(--primary-color);
  font-size: 12px;
  font-weight: bold;
  color: var(--primary-color);
  border-radius: 4px;
}
/* Style for the elevation popup text */
.elev-popup {
  color: var(--primary-color);
  font-size: 14px;
}
.elev-popup b {
  font-weight: bold;
 }
/* Style for the geolocator popup text */
.leaflet-popup-content {
  color: var(--primary-color);
  font-size: 14px;
}
/* Custom marker icon */
.custom-fa-icon {
  color: var(--marker-red);
  font-size: 24px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
/* Mobile-friendly profile panel */
@media (max-width: 768px) {
  #profile-panel {
    width: 100%;
    left: 0;
    transform: none;
    bottom: 0;
    height: 45vh;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -3px 10px rgba(0,0,0,0.25);
  }

  #profile-panel.visible {
    bottom: 0;
  }

  .chart-container-bottom {
    padding: 6px;
  }
/* Export CSV button */
  .export-btn {
    bottom: 6px;
    left: 6px;
    padding: 5px 8px;
    font-size: 12px;
  }

  #close-profile {
    top: 4px;
    right: 6px;
    font-size: 16px;
  }
}
/* Chart canvas fills container */
.chart-container-bottom canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

@media (max-width: 480px) {
  .export-btn,
  #close-profile {
    padding: 8px 10px;
    font-size: 14px;
  }
}
.elev-popup .popup-title {
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 2px;
}
#title-bar h1 {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0;
  color: white;
}
/* Layer control panel container */
.leaflet-control-layers {
  background-color: white !important;       /* white fill */
  border: 2px solid var(--primary-color) !important; /* match zoom button */
  border-radius: 6px;                        /* match zoom button */
  color: var(--primary-color);              
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); /* subtle shadow like zoom button */
}
/* Collapsed toggle icon (the small square button) */
.leaflet-control-layers-toggle {
  background-color: white !important;       /* white fill */
  border: 1px solid var(--primary-color) !important; /* blue border */
  color: var(--primary-color) !important;   /* icon color */
  box-shadow: none !important;              /* remove default shadow */
  border-radius: 4px; 
}
/* Fieldset around base and overlay layers */
.leaflet-control-layers fieldset {
  border: 1px solid var(--accent-color); /* green border */
  border-radius: 4px;                    /* optional: rounded corners */
  padding: 5px 8px;                      /* optional: spacing inside fieldset */
  margin-bottom: 6px;                    /* spacing between fieldsets */
}
/* Legend text (Base Layers / Overlay Layers) */
.leaflet-control-layers legend {
  color: var(--primary-color);
  font-weight: bold;
  padding: 0 4px;
}
/* Apply Calibri to all Leaflet UI text */
.leaflet-container,
.leaflet-control,
.leaflet-control *:not(i):not(.fa):not(.fas):not(.fa-solid),
.leaflet-popup-content,
.leaflet-tooltip,
.leaflet-bar a,
.leaflet-bar a span {
  font-family: Calibri, sans-serif;
}
/* Explicitly protect all Font Awesome icons */
i.fa,
i.fas,
i.fa-solid,
.leaflet-control i {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900;
}