/* Map container takes full viewport height */
#map {
  height: 100vh;
  width: 100%;
}

/* Fullscreen compatibility */
#map:fullscreen,
#map:-webkit-full-screen,
#map:-moz-full-screen {
  width: 100% !important;
  height: 100% !important;
}

/* Popup styles */
.popup-content {
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.popup-title {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 6px;
}

.popup-content img {
  width: 100%;
  max-width: 240px;
  margin-top: 10px;
  border-radius: 8px;
}

/* Legend wrapper for positioning */
#legend-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Right-align toggle button */
}

/* Toggle button styling */
.legend-toggle {
  margin-bottom: 4px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #000;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  font-family: Arial, sans-serif;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.legend-toggle:hover {
  background-color: #f4f4f4;
  border-color: #999;
}

/* Legend styling */
.map-legend {
  background: white;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-family: Arial, sans-serif;
  font-size: 14px;
  user-select: none;
  max-width: 220px;
}

/* Legend items */
.map-legend .legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

.map-legend .legend-item:last-child {
  margin-bottom: 0;
}

.map-legend .legend-item img {
  width: 21px;
  height: 32px;
  margin-right: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.map-legend .legend-item input[type="checkbox"] {
  cursor: pointer;
  flex-shrink: 0;
}

/* Hide Leaflet attribution */
.leaflet-control-attribution {
  display: none !important;
}

/* Search input styling */
.leaflet-control-custom input[type="search"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

.leaflet-control-custom input[type="search"]:focus {
  outline: none;
  border-color: #007BFF;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
  background-color: #fff;
}

/* Dropdown list item hover effect */
.search-dropdown li:hover {
  background-color: #f0f8ff;
}

/* === Report a Data Error Modal Styling === */

/* Modal overlay */
#data-error-modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  /* Flex center the modal content */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px; /* Padding so modal doesn't hug screen edges on small */
  box-sizing: border-box;
}

/* Modal content box */
#data-error-modal > div {
  background: #fff;
  border-radius: 10px;
  max-width: 420px;
  width: 100%;
  padding: 24px 30px 30px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  position: relative;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #222;
}

/* Close button */
#data-error-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease-in-out;
}

#data-error-close:hover {
  color: #000;
}

/* Modal heading */
#data-error-modal h3 {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
  text-align: center;
}

/* Textarea */
#data-error-message {
  width: 100%;
  height: 110px;
  resize: vertical;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1.8px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  color: #444;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
  margin-bottom: 16px; /* Added spacing below the text box */
}

#data-error-message:focus {
  outline: none;
  border-color: #0081E0; /* your blue */
  box-shadow: 0 0 5px rgba(0, 129, 224, 0.6);
}

/* Submit button */
#data-error-submit {
  background-color: #0081E0;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.3s ease;
  box-sizing: border-box;
}

#data-error-submit:hover,
#data-error-submit:focus {
  background-color: #005f9e;
  outline: none;
}

/* Success and error messages */
#data-error-success,
#data-error-error {
  margin-top: 14px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  user-select: none;
}

#data-error-success {
  color: #00AE53; /* green */
}

#data-error-error {
  color: #C62828; /* red */
}

/* Responsive tweaks for modal */
@media (max-width: 480px) {
  #data-error-modal > div {
    padding: 20px 18px 24px;
    max-width: 100%;
  }

  #data-error-message {
    height: 90px;
    font-size: 0.9rem;
  }

  #data-error-submit {
    font-size: 0.95rem;
    padding: 10px 20px;
  }

  #data-error-close {
    top: 10px;
    right: 10px;
    font-size: 26px;
  }
}
