/* =====================
   Global Styles
   ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  height: 100%;
  font-family: 'Lexend', sans-serif;
  background-color: #1F1F1F;
  color: #FFFFFF;
  overflow: hidden; /* Prevent body scrollbars if map is full screen */
  touch-action: manipulation; /* Apply to the whole
}

/* =====================
   Logo Box Styling
   ===================== */

.logo-box {
  position: fixed;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  z-index: 1001;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
}

.logo-box:hover,
.logo-box:focus {
  background-color: rgba(0, 0, 0, 0.8);
}

.logo-box:focus {
  outline: 2px solid #FF6347;
}

.logo-icon {
  width: 30px;
  height: 30px;
  margin-right: 8px;
}

.logo-text {
  font-family: 'Lexend', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
}

/* =====================
   Layer List Panel Styling
   ===================== */

.layer-list-panel {
  position: absolute;
  top: 60px;
  left: 10px;
  width: 250px;
  max-height: 400px;
  background-color: #2B2B2B;
  border: 1px solid #555;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  padding: 10px;
  z-index: 1002;
  display: none;
  overflow-y: auto;
  border-radius: 5px;
  font-family: 'Nunito', sans-serif;
}

.layer-list-panel.active {
  display: block;
}

.layer-list-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.layer-list-panel .panel-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-family: 'Nunito', sans-serif;
  color: #FFFFFF;
}

.layer-list-panel .close-btn {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #FFFFFF;
}
.layer-list-panel .close-btn:hover {
    color: #FF6347;
}

.layer-list-panel .panel-content {}

.layer-list-panel .layer-item {
  margin-bottom: 8px;
}

.layer-list-panel .layer-item label {
  margin-left: 5px;
  font-size: 14px;
  color: #FFFFFF;
}

.layer-list-panel .layer-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #FF6347;
}

.layer-list-panel .layer-item input[type="checkbox"]:focus {
  outline: 2px solid #FF6347;
}

/* =====================
   Fixed Vertical Toolbar Styling
   ===================== */

.vertical-toolbar {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 60px;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.vertical-toolbar .toolbar-btn {
  background-color: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 24px;
  cursor: pointer;
  padding: 15px;
  margin: 10px 0;
  transition: background-color 0.3s ease, color 0.3s ease;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  position: relative;
}

.vertical-toolbar .toolbar-btn:hover,
.vertical-toolbar .toolbar-btn:focus {
  background-color: rgba(255, 255, 255, 0.1);
  color: #FF6347;
  outline: none;
}

.vertical-toolbar .toolbar-btn:active { /* Style for when button is actively being pressed */
  background-color: rgba(255, 255, 255, 0.2);
}

/* Style for the Historical Fires button when its panel is active (JS adds .active class) */
.vertical-toolbar .toolbar-btn#historicalFiresBtn.active {
  background-color: rgba(255, 99, 71, 0.3); /* Example: a distinct "active" background */
  color: #FF6347; /* Example: distinct "active" icon color */
}


/* Tooltip Base Style - ALWAYS HIDDEN INITIALLY */
.vertical-toolbar .toolbar-btn[title]::after {
  content: attr(title);
  position: absolute;
  left: -210px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #333;
  color: #fff;
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 14px;
  z-index: 10;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out 0.3s, visibility 0s linear 0.5s; /* Delay appearance, hide faster */
}

/* Show tooltip ONLY on hover or focus */
.vertical-toolbar .toolbar-btn:hover::after,
.vertical-toolbar .toolbar-btn:focus::after {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0.3s, 0.3s; /* Delay before appearing on hover */
}

/* Specifically for historicalFiresBtn: if it's .active (panel is open), DO NOT show tooltip */
.vertical-toolbar .toolbar-btn#historicalFiresBtn.active:hover::after,
.vertical-toolbar .toolbar-btn#historicalFiresBtn.active:focus::after {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition-delay: 0s !important;
}


/* =====================
   Basemap Dropdown Styling -- CORRECTED SECTION
   ===================== */

.basemap-dropdown {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 100%;
  margin-right: 10px;

  width: 200px;
  background-color: #2B2B2B;
  padding: 10px;
  border-radius: 8px;
  box-shadow: -2px 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 1001;

  /* --- CRITICAL FOR DEFAULT HIDDEN STATE & ANIMATION --- */
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(10px); /* Initial state for pop-out */
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out, visibility 0s linear 0.2s;
}

.basemap-dropdown.active {
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0); /* Final state */
  transition-delay: 0s;
}

.basemap-dropdown select {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 4px;
  background-color: #1F1F1F;
  color: #FFFFFF;
  font-size: 14px;
  cursor: pointer;
}

.basemap-dropdown select:focus {
  outline: 2px solid #FF6347;
}

/* =====================
   Search Panel Styling
   ===================== */

#searchPanel {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 300px;
  max-height: 350px;
  background-color: #2B2B2B;
  color: #FFFFFF;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
  z-index: 1002;
  padding: 20px;
  border-radius: 8px;
  display: none;
  overflow-y: auto;
}

#searchPanel.active {
  display: block;
}

#searchPanel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#searchPanel h2 {
  font-size: 20px;
}

#searchPanel .close-panel-btn {
  font-size: 24px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}
#searchPanel .close-panel-btn:hover {
  color: #FF6347;
}

#searchPanel input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  background-color: #1F1F1F;
  color: #FFFFFF;
  border: 1px solid #555;
  border-radius: 4px;
}

#searchResults {
  list-style-type: none;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

#searchResults li {
  padding: 10px;
  border-bottom: 1px solid #444;
  cursor: pointer;
}

#searchResults li:hover {
  background-color: #333;
}

/* =====================
   Map Container Styling
   ===================== */

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

/* =====================
   Fullscreen About Panel Styling
   ===================== */

#aboutPanel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(43, 43, 43, 0.98);
  color: #FFFFFF;
  z-index: 1500;
  padding: 20px;
  display: none;
  overflow-y: auto;
}

#aboutPanel.active {
  display: block;
}

#aboutPanel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#aboutPanel h2 {
  font-size: 24px;
}

#aboutPanel p {
  margin-bottom: 15px;
  font-size: 16px;
  line-height: 1.6;
}

#aboutPanel a {
  color: #FF6347;
  text-decoration: none;
}

#aboutPanel a:hover {
  text-decoration: underline;
}

#aboutPanel .close-panel-btn {
  font-size: 36px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
}
#aboutPanel .close-panel-btn:hover {
  color: #FF6347;
}

#aboutPanel .panel-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* =====================
   Modal Styling (Share Map)
   ===================== */

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
}
.modal.active {
    display: flex;
}

.modal-content {
  background-color: #1F1F1F;
  padding: 25px 20px;
  border: 1px solid #444;
  width: 80%;
  max-width: 550px;
  color: #FFFFFF;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal .close-btn {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
  background: none;
  border: none;
  padding: 5px;
  line-height: 1;
}

.modal .close-btn:hover,
.modal .close-btn:focus {
  color: #fff;
}

#shareMapURL {
    width: 100%;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #2B2B2B;
    color: #FFFFFF;
    font-size: 0.9em;
    margin-bottom: 15px;
}
#copyURLBtn {
    margin-top: 0;
    padding: 8px 12px;
    font-size: 0.9em;
    background-color: #FF6347;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#copyURLBtn:hover {
    background-color: #E0523A;
}

.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-track { background: #2b2b2b; border-radius: 4px; }
.modal-content::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; }

/* =====================
   Info Box Styling
   ===================== */

#infoBox {
  position: fixed;
  top: 80px;
  right: 80px;
  width: 300px;
  max-width: 300px;
  max-height: 250px;
  overflow-y: auto;
  background-color: rgba(43, 43, 43, 0.9);
  color: #FFFFFF;
  padding: 10px;
  border-radius: 8px;
  z-index: 1000;
  display: none;
}

#infoBox.active {
  display: block;
}

#infoBox h2, #infoBox h3 {
  margin-top: 0;
  font-size: 14px;
  margin-bottom: 8px;
}

#infoBox p {
  font-size: 10px;
  line-height: 1.2;
  margin-bottom: 4px;
}

#infoBox strong {
  font-size: 11px;
  font-weight: bold;
  color: #FF6347;
}

#infoBox span.value {
  font-size: 10px;
  font-weight: normal;
  color: #FFFFFF;
}

#infoBox a {
  color: #FF6347;
  text-decoration: none;
  font-size: 10px;
}

#infoBox a:hover {
  text-decoration: underline;
}

#infoBox::-webkit-scrollbar { width: 6px; }
#infoBox::-webkit-scrollbar-track { background: #2b2b2b; border-radius: 4px; }
#infoBox::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; }


/* =====================
   Historical Fires Control Panel
   ===================== */
#historicalFiresPanel {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(43, 43, 43, 0.9);
  padding: 10px 15px;
  border-radius: 8px;
  display: none;
  width: auto;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  font-size: 0.9em;
}

#historicalFiresPanel .year-input-container {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

#historicalFiresPanel .year-input-container label {
  color: white;
  margin-right: 8px;
  margin-bottom: 0;
  font-size: 1em;
  white-space: nowrap;
}

#historicalFiresPanel input[type="number"] {
  flex-grow: 1;
  width: 100px;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #555;
  background-color: #1F1F1F;
  color: #FFFFFF;
  font-size: 1em;
}

#historicalFiresPanel .checkbox-container {
  margin-top: 0;
  display: flex;
  align-items: center;
}
#historicalFiresPanel .checkbox-container input[type="checkbox"] {
  margin-right: 8px;
  width: 15px;
  height: 15px;
  accent-color: #FF6347;
  flex-shrink: 0;
}
#historicalFiresPanel .checkbox-container label {
  margin-bottom: 0;
  font-size: 1em;
  color: #f0f0f0;
}


/* =====================
   Popup Content Styling (Mapbox GL Popups)
   ===================== */
.mapboxgl-popup-content {
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: #333;
  background-color: #ffffff;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.mapboxgl-popup-content h3 { margin: 0 0 5px; font-size: 16px; }
.mapboxgl-popup-close-button { color: #333; }
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip { border-top-color: #ffffff; }
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip { border-bottom-color: #ffffff; }
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip { border-right-color: #ffffff; }
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip { border-left-color: #ffffff; }


/* =====================
   Marker Styling (Disaster, Volcano)
   ===================== */
.marker {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.disaster-marker { width: 20px; height: 20px; }

/* =====================
   Legend Styling
   ===================== */

.legend-toggle-btn {
  position: fixed;
  bottom: 20px; /* Adjusted for potential Mapbox attribution/controls */
  left: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #FFFFFF;
  border: none;
  border-radius: 4px;
  width: 40px;
  height: 40px;
  font-size: 18px; /* Slightly smaller icon */
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.legend-toggle-btn:hover,
.legend-toggle-btn:focus {
  background-color: rgba(0, 0, 0, 0.9);
  color: #FF6347;
  outline: none;
}

.legend-toggle-btn:focus {
  outline: 2px solid #FF6347;
  outline-offset: 1px;
}

.legend-panel {
  position: fixed;
  bottom: 65px; /* 20px (button bottom) + 40px (button height) + 5px spacing */
  left: 10px;
  width: 280px;
  max-height: calc(100vh - 85px - 20px); /* Full height minus button and some padding */
  background-color: #2B2B2B;
  border: 1px solid #555;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  padding: 10px;
  z-index: 1002;
  display: none;
  overflow-y: auto;
  border-radius: 5px;
  font-family: 'Nunito', sans-serif;
  color: #FFFFFF;
}

.legend-panel.active {
  display: block;
}

.legend-panel .panel-header { /* Re-uses similar structure to other panels */
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.legend-panel .panel-header h3 {
  margin: 0;
  font-size: 1.1em;
  font-family: 'Nunito', sans-serif;
  color: #FFFFFF;
}

.legend-panel .close-btn { /* Re-uses styles from .layer-list-panel .close-btn */
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #FFFFFF;
}
.legend-panel .close-btn:hover {
    color: #FF6347;
}

.legend-panel .panel-content {} /* For consistency, can be empty */

.legend-panel .panel-content h4 {
  font-size: 1em;
  margin-top: 12px;
  margin-bottom: 8px;
  color: #FF6347; /* Highlight legend section titles */
  padding-bottom: 3px;
  border-bottom: 1px solid #444;
}
.legend-panel .panel-content h4:first-child {
  margin-top: 0;
}

.legend-panel .legend-group {
  list-style: none;
  padding-left: 0;
  margin-bottom: 15px;
}

.legend-panel .legend-group li {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  color: #E0E0E0; /* Lighter than pure white for better readability */
}

.legend-panel .legend-color {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  display: inline-block;
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: 50%; /* Changed from 3px to 50% to make it a circle */
  vertical-align: middle;
}

.legend-panel .legend-icon-img {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  vertical-align: middle;
  flex-shrink: 0;
}

.legend-panel::-webkit-scrollbar { width: 6px; }
.legend-panel::-webkit-scrollbar-track { background: #1F1F1F; border-radius: 3px; }
.legend-panel::-webkit-scrollbar-thumb { background-color: #555; border-radius: 3px; }

/* =====================
   Responsive Adjustments
   ===================== */

@media (max-width: 767px) {
  .logo-box { top: 10px; left: 10px; padding: 5px 8px; }
  .logo-icon { width: 25px; height: 25px; margin-right: 5px; }
  .logo-text { font-size: 14px; }

  .basemap-dropdown { width: 180px; margin-right: 5px; }

  .modal-content {
    width: 90%; margin: 10% auto; padding: 15px 10px;
  }
  .modal .close-btn { font-size: 20px; top: 8px; right: 10px; }

  #infoBox {
    width: 250px;
    max-width: calc(100vw - 60px - 10px - 10px - 10px);
    right: calc(60px + 10px + 10px);
    top: 60px;
    font-size: 0.9em;
  }
  #infoBox h2, #infoBox h3 { font-size: 13px; }
  #infoBox p { font-size: 9px; }
  #infoBox strong { font-size: 10px; }
  #infoBox span.value, #infoBox a { font-size: 9px; }

  #searchPanel {
    width: calc(100vw - 20px - 60px - 10px);
    left: 10px; top: 10px;
    max-height: 60vh;
    /* font-size: 1rem; /* Ensure base font size for panel is adequate if inputs use em */
  }
  /* Prevent zoom on search input focus */
  #searchPanel input[type="text"] {
    font-size: 16px !important;
    padding: 10px 8px; /* Adjust padding if 16px font makes it too tall */
  }
  #searchResults { max-height: calc(60vh - 100px); } /* Adjust 100px based on actual header/input height */

  .layer-list-panel {
    width: 220px; max-height: 60vh; top: 55px;
  }

  #historicalFiresPanel {
    max-width: 280px; padding: 8px 12px; bottom: 15px;
    /* font-size: 1rem; /* Ensure base font size for panel is adequate */
  }
  /* Prevent zoom on year input focus & adjust related styles */
  #historicalFiresPanel input[type="number"] {
    font-size: 16px !important;
    padding: 8px 6px; /* Adjust padding if 16px font makes it too tall */
    /* width: 100px; /* Retain a reasonable width */
  }
  /* Ensure labels remain readable if panel font-size was small and inputs are now larger */
  #historicalFiresPanel .year-input-container label,
  #historicalFiresPanel .checkbox-container label {
    font-size: 0.9em; /* Or a fixed px value like 14px if preferred */
                    /* This was 0.85em, which might become too small if panel base font is small */
  }

  /* Legend Panel Responsive */
  .legend-panel {
    width: 240px; /* Slightly smaller on tablets */
    max-height: calc(100vh - 85px - 20px); /* Adjust if needed */
  }
}

@media (max-width: 480px) {
  .vertical-toolbar { width: 48px; right: 5px; padding: 5px 0; }
  .vertical-toolbar .toolbar-btn { font-size: 18px; padding: 8px; margin: 5px 0; width: 32px; height: 32px; }
  .vertical-toolbar .toolbar-btn[title]::after { left: -180px; font-size: 12px; }

  .logo-box { padding: 3px 5px; }
  .logo-icon { width: 20px; height: 20px; }
  .logo-text { font-size: 12px; }

  #infoBox {
    width: auto;
    max-width: calc(100vw - 48px - 5px - 5px - 10px);
    right: calc(48px + 5px + 5px);
    top: 50px;
    padding: 8px;
    font-size: 0.85em;
  }
  #infoBox h2, #infoBox h3 { font-size: 12px; margin-bottom: 5px;}
  #infoBox p, #infoBox strong, #infoBox span.value, #infoBox a { font-size: 0.9em; }


  .layer-list-panel {
    top: 40px;
    left: 5px;
    width: calc(100vw - 10px - 48px - 5px - 5px);
    max-height: 40vh;
    padding: 8px;
    font-size: 0.9em;
  }
  .layer-list-panel .panel-header h3 { font-size: 1em; }
  .layer-list-panel .layer-item label { font-size: 13px; }


  #searchPanel {
    top: 5px; left: 5px;
    width: calc(100vw - 10px - 48px - 5px - 5px);
    max-height: 45vh;
    padding: 10px;
    font-size: 0.9em; /* Base for panel, inputs will override */
  }
  #searchPanel h2 { font-size: 1.1em; margin-bottom: 10px; }
  #searchPanel input[type="text"] {
    font-size: 16px !important; /* Crucial for preventing iOS zoom */
    padding: 8px 6px; /* Adjust padding */
    margin-bottom: 8px;
  }
  #searchResults { max-height: calc(45vh - 80px); } /* Adjust 80px based on actual header/input height */


  .basemap-dropdown { width: 160px; margin-right: 5px; padding: 8px; }
  .basemap-dropdown select { font-size: 13px; padding: 6px; }

  .modal-content {
    width: calc(100% - 20px); margin: 5% auto; padding: 10px; font-size: 0.9em;
  }
  .modal-content h2 { font-size: 1.2em; margin-bottom: 10px; }
  .modal .close-btn { font-size: 18px; top: 5px; right: 8px; }
  #shareMapURL { padding: 6px; font-size: 0.85em; margin-bottom: 10px;}
  #copyURLBtn { padding: 6px 10px; font-size: 0.85em; }

  #historicalFiresPanel {
    width: calc(100% - 10px);
    left: 5px; transform: translateX(0);
    bottom: 5px; padding: 8px;
    font-size: 0.9em; /* Increased base font for the panel slightly */
    min-width: 0;
  }
  /* Prevent zoom on year input focus */
  #historicalFiresPanel input[type="number"] {
    font-size: 16px !important; /* Crucial for preventing iOS zoom */
    padding: 6px 4px; /* Adjust padding */
    width: 70px; /* Retain smaller width if desired */
  }
  /* Ensure labels are still readable relative to larger input font */
  #historicalFiresPanel .year-input-container label,
  #historicalFiresPanel .checkbox-container label {
    font-size: 0.9em; /* Relative to panel's font-size (0.9em * 0.9em) or set fixed px */
                     /* Example: font-size: 13px; */
  }
  #historicalFiresPanel .checkbox-container { margin-top: 3px; }

  /* Legend Panel Responsive */
  .legend-toggle-btn {
    bottom: 10px; /* Keep it accessible */
    left: 10px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .legend-panel {
    bottom: 50px; /* 10px btn-bottom + 36px btn-height + 4px spacing */
    left: 5px; /* Align with other elements if they also use 5px */
    width: calc(100vw - 10px); /* Full width minus padding */
    max-width: 260px; /* Cap width */
    max-height: 45vh; /* Limit height on small screens */
    font-size: 0.9em;
  }
  .legend-panel .panel-header h3 {
    font-size: 1em;
  }
  .legend-panel .legend-group li {
    font-size: 12px;
  }
  .legend-panel .legend-color, .legend-panel .legend-icon-img {
    width: 16px;
    height: 16px;
    margin-right: 8px;
  }
}
