
/* === BASE STYLES === */

/* === GPX TRACK STYLING === */

/* Custom GPX Pin Styling */
.custom-gpx-pin .pin-dot {
  width: 18px;
  height: 18px;
  background: #ff6600;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

/* Track Labels and Popups */
.mapboxgl-popup-content {
  font-size: 14px;
  padding: 6px;
}

/* GPX Track Labels */
.mapboxgl-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* GPX styling now handled by Mapbox GL JS clustering system */





/* === MAP CONTAINER === */

#map {
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: auto;
  z-index: 0;
}

/* Mapbox GL JS specific styles */
.mapboxgl-ctrl-group {
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mapboxgl-ctrl-group button {
  background: white;
  border: none;
  border-bottom: 1px solid #ccc;
  color: #666;
  cursor: pointer;
  display: block;
  font-size: 16px;
  height: 30px;
  padding: 0;
  width: 30px;
  transition: all 0.2s ease;
}

.mapboxgl-ctrl-group button:hover {
  background: #f0f0f0;
  color: #333;
}

.mapboxgl-ctrl-group button:last-child {
  border-bottom: none;
}

.mapboxgl-ctrl-group button.mapboxgl-ctrl-icon {
  background-size: 20px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Custom control button styling */
.mapboxgl-ctrl-group button[title*="Toggle 2D/3D"],
.mapboxgl-ctrl-group button[title*="Go to Default"] {
  font-size: 18px;
  font-weight: bold;
}

/* Mapbox popup styling to match existing theme */
.mapboxgl-popup-content {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-size: 14px;
  padding: 6px;
}

.mapboxgl-popup-tip {
  border-top-color: rgba(255, 255, 255, 0.95);
}

.mapboxgl-popup-close-button {
  color: #666;
  font-size: 16px;
  padding: 4px 8px;
}

.mapboxgl-popup-close-button:hover {
  color: #333;
}

/* Desktop: Adjust map height to account for bottom toolbar */
@media (min-width: 768px) {
  #map {
    height: calc(100vh - 64px);
  }
}

#mapLayersWrapper .dropdown-content button {
  padding: 2px 4px;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  line-height: 12px;
}

/* === TOP SEARCH BAR === */

.top-search-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  background: white;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  padding: 8px 16px;
  gap: 12px;
  z-index: 1001;
}

.top-search-bar input {
  border: none;
  outline: none;
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 999px;
  width: 280px;
}

.top-search-bar .suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  padding: 6px;
  z-index: 1002;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.top-search-bar .suggestion {
  padding: 4px 8px;
  cursor: pointer;
}

.top-search-bar .suggestion:hover {
  background: #f0f0f0;
}

.sidebar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px; /* Unified width for left & right */
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  border-radius: 30px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  transition: all 0.3s ease;
}

.sidebar.left {
  left: 12px;
}

.sidebar.right {
  right: 12px;
}

.sidebar.collapsed {
  width: 28px;
  padding: 10px 2px;
  overflow: hidden;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.sidebar-content button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  flex-direction: column; /* Allows icon + text stack */
  align-items: center;
  justify-content: center;
  border: 1px solid #888;
  background: #f8f8f8;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.2s, box-shadow 0.2s;
  text-align: center;
}

.sidebar-content button:hover {
  background: #e0e0e0;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.sidebar.left .dropdown-content {
  left: 50px; /* match sidebar width */
  right: auto;
}

.sidebar.right .dropdown-content {
  right: 50px;
  left: auto;
}

.sidebar-content button:active {
  transform: scale(0.95);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

#leftSidebar .dropdown:nth-child(2) .dropdown-content {
  width: 240px;     /* adjust to what feels good */
  max-height: 700px;
  overflow-y: auto;
}

/* === POPUPS & LABELS === */



/* === Z-INDEX MANAGEMENT === */



/* === SIDEBAR BUTTONS & DROPDOWNS === */

.species-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* === SPECIES FILTER === */

#speciesFilter {
  font-size: 13px;
}

#speciesFilter span {
  display: block;
  line-height: 1.1;
}

.species-dropdown {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}

#speciesFilter + .dropdown-content {
  width: 90px;
  padding: 4px;
  right: 50px;
  top: 0;
}

/* === JOURNAL MODAL === */

#journalModal {
  width: 90vw !important;      /* scale with screen width */
  max-width: 800px !important; /* cap max width on large screens */
  height: 520px;               /* keep existing height */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Lock journal modal position - prevent dynamic repositioning */
#journalModal.modern-popup {
  position: fixed !important;
  transform: none !important;
  transition: none !important;
}

/* === UNIFIED PIN STYLES === */
.witd-pin { 
  width: 18px; 
  height: 24x; 
  cursor: pointer;
}

.witd-pin-svg { 
  display: block; 
  width: 18px; 
  height: 24px; 
}

/* Match the live on-drop colors */
.witd-pin--orange .pin-body { 
  fill: #ff7a00; 
}

.witd-pin--orange .pin-center { 
  fill: #ffffff; 
}

/* Additional pin color variants */
.witd-pin--red .pin-body { 
  fill: #e74c3c; 
}

.witd-pin--red .pin-center { 
  fill: #c0392b; 
}

.witd-pin--green .pin-body { 
  fill: #27ae60; 
}

.witd-pin--green .pin-center { 
  fill: #2ecc71; 
}

.witd-pin--yellow .pin-body { 
  fill: #f1c40f; 
}

.witd-pin--yellow .pin-center { 
  fill: #f39c12; 
}

.witd-pin--blue .pin-body { 
  fill: #3498db; 
}

.witd-pin--blue .pin-center { 
  fill: #2980b9; 
}

.witd-pin--purple .pin-body { 
  fill: #9b59b6; 
}

.witd-pin--purple .pin-center { 
  fill: #8e44ad; 
}

.witd-pin--brown .pin-body { 
  fill: #8b4513; 
}

.witd-pin--brown .pin-center { 
  fill: #a0522d; 
}

.witd-pin:hover { 
  filter: brightness(1.05); 
}

/* === PIN DROP CONTAINER STYLES === */
.pin-drop-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 16px;
  min-width: 200px;
  max-width: 240px;
  border: 1px solid #e0e0e0;
}

/* === SAVED PIN POPUP STYLES === */
.saved-pin-popup {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 16px;
  min-width: 200px;
  max-width: 240px;
  border: 1px solid #e0e0e0;
}

.saved-pin-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

.saved-pin-icon {
  font-size: 16px;
  color: #ff6600;
}

.saved-pin-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.saved-pin-coords {
  margin-bottom: 16px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.saved-pin-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-pin-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.saved-pin-btn.rename-btn {
  background: #e3f2fd;
  color: #1976d2;
}

.saved-pin-btn.rename-btn:hover {
  background: #bbdefb;
  transform: translateY(-1px);
}

.saved-pin-btn.delete-btn {
  background: #ffebee;
  color: #d32f2f;
}

.saved-pin-btn.delete-btn:hover {
  background: #ffcdd2;
  transform: translateY(-1px);
}

.saved-pin-btn.journal-btn {
  background: #f3e5f5;
  color: #7b1fa2;
}

.saved-pin-btn.journal-btn:hover {
  background: #e1bee7;
  transform: translateY(-1px);
}

/* Hide Mapbox popup background */
.mapboxgl-popup-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.mapboxgl-popup-tip {
  display: none !important;
}

.pin-drop-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

.pin-drop-icon {
  font-size: 16px;
  color: #ff6600;
}

.pin-drop-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.pin-drop-input-container {
  margin-bottom: 16px;
}

.pin-drop-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.pin-drop-input:focus {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.pin-drop-input::placeholder {
  color: #999;
}

.pin-drop-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pin-drop-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pin-drop-cancel {
  background: #f5f5f5;
  color: #666;
}

.pin-drop-cancel:hover {
  background: #e8e8e8;
  color: #333;
}

.pin-drop-save {
  background: #ff6600;
  color: white;
}

.pin-drop-save:hover {
  background: #e55a00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

#journalModal > div:first-child {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#journalForm {
  width: 100%;
}

#journalForm input,
#journalForm textarea {
  box-sizing: border-box;
  width: 100% !important; /* Force full width */
  max-width: none !important; /* Remove max-width constraint */
}

#journalForm button,
#journalModal .close-modal {
  width: 100% !important; /* Force full width */
  max-width: none !important; /* Remove max-width constraint */
}

/* Override all Journal modal form elements with maximum specificity */
#journalModal.modern-popup #journalForm input,
#journalModal.modern-popup #journalForm textarea,
#journalModal.modern-popup #journalForm button,
#journalModal.modern-popup .close-modal {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

#journalList {
  flex: 1 1 auto;
  max-height: 250px;
  overflow-y: auto;
  border-top: 1px solid #ccc;
  padding-top: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
  min-height: 0;
}




/* === WEATHER BOX === */

#weatherWrapper .dropdown-content {
  width: 320px; /* much wider */
  max-height: 700px;
  padding: 16px; /* more space inside */
  background: #ffffff;
  border: 2px solid #007bff; /* bright border */
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  position: absolute;
  top: 0;
  right: 50px; /* or whatever your adjusted offset is */
  overflow-y: auto;
}

#weatherWrapper .dropdown-content h3 {
  margin: 0 0 12px 0;
  color: #007bff;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
}

#weatherWrapper .dropdown-content input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

#weatherWrapper .dropdown-content .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #555;
}

#weatherWrapper .dropdown-content .close-btn:hover {
  color: #007bff;
}

#weatherWrapper .weather-output {
  margin-top: 12px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  line-height: 1.4;
}



.marker-text-box {
  position: relative;
}

.marker-text-box .label-inner {
  position: absolute;
  top: calc(100% + 8px); /* place label 8px below the pin */
  left: 50%;
  transform: translateX(-50%); /* only center horizontally */
  background: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.weather-popup-box {
  background: none !important;
  box-shadow: none !important;
  border: none !important;
}
#weatherWrapper.weather-popup, #weatherWrapper.weather-popup .dropdown-content {
  background: transparent !important;
  box-shadow: none !important;
}

.weather-top-card {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 12px;
}

.weather-content-card {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 12px;
}

#useMyLocationBtn {
  background-color: #007bff;
  color: #fff;
  font-weight: bold;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s ease;
}

#useMyLocationBtn:hover {
  background-color: #0056b3;
}


/* === GPX STYLING === */
/* GPX labels now handled by Mapbox clustering system */

#gpxList {
  width: 100%;
}

.gpx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;   /* bigger touch area */
  margin-bottom: 6px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.gpx-item .file-name {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpx-item .delete-btn {
  margin-left: 12px;
  cursor: pointer;
  color: #c00;
  font-weight: bold;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  pointer-events: auto !important;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: relative;
  z-index: 10;
}

.gpx-item .delete-btn:hover {
  color: #fff;
  background: #dc3545;
  border-color: #dc3545;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
  transform: scale(1.1);
}

.gpx-item .delete-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 2px rgba(220, 53, 69, 0.4);
}

/* === DRAW MODULE === */

#drawTrackBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #666;
  border-radius: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, box-shadow 0.2s;
}

#drawTrackBtn:hover {
  background: #f0f0f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#drawTrackBtn img {
  width: 18px;
  height: 18px;
}

/* === DISCLAIMER MODAL === */

#disclaimerOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#disclaimerOverlay div {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  margin-bottom: 72px; /* leave space for toolbar */
}
@media (max-width: 600px) {
  #disclaimerOverlay div {
    max-width: 98vw;
    max-height: 96vh;
    padding: 10px;
    margin-bottom: 84px; /* extra space for mobile toolbars */
  }
}
@media (max-width: 400px) {
  #disclaimerOverlay div {
    margin-bottom: 100px;
  }
}

#disclaimerOverlay h2 {
  color: #2e7d32;
  font-size: 1.8em;
  margin-bottom: 15px;
}

#disclaimerOverlay p {
  color: #555;
  font-size: 1em;
  margin-bottom: 15px;
}

#disclaimerOverlay a {
  color: #007bff;
  text-decoration: none;
}

#disclaimerOverlay a:hover {
  text-decoration: underline;
}

#disclaimerOverlay button {
  background: #4caf50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
}

#disclaimerOverlay button:hover {
  background: #388e3c;
}

/* === RESPONSIVE TWEAKS === */



/* === LANDING PAGE LAYOUT === */



/* === MISCELLANEOUS === */

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
  font-size: 16px;
  overflow: hidden;
}

/* === CUSTOM CONFIRMATION DIALOG STYLES === */
.custom-confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

/* === UPGRADE MESSAGE STYLES === */
.upgrade-message {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 2px 24px rgba(0,0,0,0.18);
  padding: 38px 32px 32px 32px;
  max-width: 420px;
  width: 90vw;
  border: 3px solid #ffb3b3;
  text-align: center;
  position: relative;
  animation: dialogSlideIn 0.2s ease-out;
}

.upgrade-icon {
  font-size: 48px;
  margin-bottom: 18px;
  display: inline-block;
}

.upgrade-message h3 {
  font-size: 2em;
  font-weight: bold;
  color: #333;
  margin: 0 0 10px 0;
}

.upgrade-message p {
  font-size: 1.1em;
  color: #666;
  line-height: 1.5;
  margin: 0 0 22px 0;
}

/* Button styling to match SSS modal */
.upgrade-message button {
  background: #ff7e7e;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 38px;
  font-size: 1.2em;
  font-weight: bold;
  margin-top: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
}

.upgrade-message button:hover {
  background: #ff6b6b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* === TRACK LABEL STYLES === */
.track-label-container {
  position: relative;
  z-index: 1000;
  display: inline-block;
  max-width: 200px;
}

.track-label-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  transition: all 0.2s ease;
}

.track-label-pin:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.4));
}

.track-label-popup {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #e0e0e0;
  padding: 8px 12px;
  width: auto;
  min-width: fit-content;
  max-width: 200px;
  animation: trackLabelSlideIn 0.3s ease-out;
  position: relative;
  display: inline-block;
}

.track-label-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-label-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.track-label-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  outline: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: all 0.2s ease;
  cursor: text;
}

.track-label-title:hover {
  background-color: #f8f9fa;
  border-color: #e9ecef;
}

.track-label-title.editing {
  background-color: #fff;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
  cursor: text;
}

.track-minimize-btn {
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  min-width: 24px;
  height: 24px;
  font-size: 12px;
}

.track-minimize-btn:hover {
  background: #218838;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.track-rename-btn {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  min-width: 24px;
  height: 24px;
}

.track-rename-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.track-rename-btn svg {
  width: 10px;
  height: 10px;
}

.track-delete-btn {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  min-width: 24px;
  height: 24px;
}

.track-delete-btn:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.track-delete-btn svg {
  width: 10px;
  height: 10px;
}

@keyframes trackLabelSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-dialog-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  border: 1px solid #e0e0e0;
  animation: dialogSlideIn 0.2s ease-out;
}

@keyframes dialogSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.confirm-dialog-icon {
  font-size: 24px;
}

.confirm-dialog-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.confirm-dialog-message {
  font-size: 16px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 24px;
}

.confirm-dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-dialog-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-dialog-cancel {
  background: #f5f5f5;
  color: #666;
}

.confirm-dialog-cancel:hover {
  background: #e8e8e8;
  color: #333;
}

.confirm-dialog-delete {
  background: #dc3545;
  color: white;
}

.confirm-dialog-delete:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.help-icon {
  font-weight: bold;
  font-size: 20px;
  color: #555;
  cursor: pointer;
}

#gps-button {
  border: none;
  background: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  margin-left: 6px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#gps-button:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

#gps-button:active {
  transform: scale(0.95);
}

/* Search Marker Popup Styling */
.search-marker-popup {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e0e0;
  min-width: 200px;
  max-width: 300px;
}

.search-marker-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.search-marker-text {
  flex: 1;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}

.search-marker-delete {
  border: none;
  background: #f0f0f0;
  border-radius: 4px;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
  font-size: 16px;
  transition: all 0.2s ease;
}

.search-marker-delete:hover {
  background: #dc3545;
  transform: scale(1.1);
}

.search-marker-delete:active {
  transform: scale(0.95);
}

.mapboxgl-popup-content {
  margin: 8px 12px !important;
  font-size: 16px;
}

.mapboxgl-popup-content-wrapper {
  padding: 8px 12px;
  border-radius: 8px;
}

.mapboxgl-popup-tip {
  display: none;
}

.mapboxgl-popup-close-button {
  display: none; /* or style smaller if you want */
}

.dropdown {
  position: relative;
  width: auto;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  padding: 8px;
  z-index: 1002;
  width: 120px;
  top: 0;
  max-height: 200px;
  overflow-y: auto;
}

.dropdown.open .dropdown-content {
  display: block;
}

.dropdown-content button {
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  white-space: nowrap;
}

.today {
  font-size: 16px;
  line-height: 1.4;
}

.today b {
  display: block;
  margin-bottom: 4px;
}

.today br {
  line-height: 1.2;
}

.today .wind-direction {
  font-weight: bold;
}

.mid-label {
  background: white;
  padding: 4px 8px;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 14px;
}

.forecast {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); /* each forecast day is wider */
  gap: 10px;
}

.forecast-day {
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

.forecast-day b {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.start-label,
.finish-label {
  background: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  border: 2px solid #333;
  text-align: center;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.2;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.start-label {
  background-color: #4caf50;
  color: white;
  border-color: #333;
  font-weight: 900;
}

.finish-label {
  background-color: #f44336;
  color: white;
  border-color: #333;
  font-weight: 900;
}

/* Track labels and clustering now handled by Mapbox GL JS */

/* Multi-track control styling */
.mapboxgl-control-multi-track {
  z-index: 1000;
}

/* Modern Login Modal Styles */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(4px);
}

.login-modal-content {
  background: white;
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.login-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

.login-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.login-close:hover {
  background-color: #f5f5f5;
  color: #666;
}

.login-form {
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #0074d9;
  box-shadow: 0 0 0 3px rgba(0, 116, 217, 0.1);
}

.form-group input::placeholder {
  color: #999;
}

.login-submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: #0074d9;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  margin-bottom: 16px;
}

.login-submit-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.login-submit-btn:active {
  transform: translateY(0);
}

.login-links {
  text-align: center;
  margin-bottom: 24px;
}

.forgot-password {
  color: #0074d9;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.forgot-password:hover {
  color: #0056b3;
  text-decoration: underline;
}

.login-separator {
  color: #ccc;
  margin: 0 8px;
}

.signup-link,
.login-link {
  color: #0074d9;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.signup-link:hover,
.login-link:hover {
  color: #0056b3;
  text-decoration: underline;
}

.login-divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
}

.divider-text {
  background: white;
  padding: 0 16px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  display: block;
  margin-bottom: 10px;
}

.divider-line {
  height: 1px;
  background: #e1e5e9;
  width: 100%;
}

.google-login-btn {
  width: 100%;
  padding: 12px 24px;
  background: white;
  color: #333;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.google-login-btn:hover {
  background: #f8f9fa;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.google-login-btn:active {
  transform: translateY(0);
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 480px) {
  .login-modal-content {
    padding: 24px;
    margin: 20px;
    width: calc(100% - 40px);
  }
  
  .login-header h2 {
    font-size: 20px;
  }
  
  .form-group input {
    padding: 10px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .login-submit-btn,
  .google-login-btn {
    padding: 12px 20px;
    font-size: 16px;
  }
}

.mapboxgl-pane.zonesPane path {
  pointer-events: none !important;
}

/* Weather popup centered above bottom toolbar */
#weatherWrapper.weather-popup, #weatherWrapper.weather-popup .dropdown-content {
  display: unset !important;
  pointer-events: auto !important;
}

/* === Modern Popup Styles (Reusable) === */
.modern-popup {
  position: fixed;
  z-index: 3300;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  padding: 16px;
}

.modern-popup .popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  width: 100%;
  margin: 0 auto;
}

/* Horizontal 1x3 layout for tools popup */
.modern-popup .popup-grid-horizontal {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  padding: 4px;
  box-sizing: border-box;
}

/* Ensure buttons in tools popup are uniform */
.modern-popup .popup-grid-horizontal .popup-btn {
  flex: 1;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  font-size: 0.9em;
  line-height: 1.2;
}

/* GPX Modal specific grid styling - 1x2 layout */
#gpxModal .popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

.modern-popup .popup-btn {
  background: #f9f9f9;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  font-size: 0.9em;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 500;
  min-width: 80px;
  min-height: 56px;
  flex: 0 0 auto;
  width: 100px;
  max-width: 100px;
  box-sizing: border-box;
  overflow: hidden;
}

/* GPX Modal container styling to match other modals */
#gpxModal.modern-popup {
  padding: 16px !important;
  box-sizing: border-box;
  min-width: 220px !important;
  max-width: 98vw !important;
}

/* GPX Modal buttons now use the same styling as other popups */

.modern-popup .popup-btn:hover {
  background: #ffffff;
  border-color: #d0d0d0;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.modern-popup .popup-btn span {
  margin-top: 3px;
  font-size: 0.85em;
  line-height: 1.2;
  font-weight: 500;
  text-align: center;
  width: 100%;
}

/* Disabled button styling for premium features */
.popup-btn.disabled,
button[data-layer].disabled,
.species-btn.disabled {
  opacity: 0.5;
  cursor: pointer !important; /* Keep clickable for upgrade popup */
  filter: grayscale(0.5);
  transition: opacity 0.2s ease;
}

.popup-btn.disabled:hover,
button[data-layer].disabled:hover,
.species-btn.disabled:hover {
  background-color: inherit;
  box-shadow: none;
}

/* Optional arrow/tail for popup - HIDDEN */
.modern-popup-arrow {
  display: none !important; /* Hide all popup arrows/triangles */
}
.modern-popup-arrow svg {
  display: none !important;
}

/* === Tool Submenu System === */
.tool-submenu {
  position: fixed;
  z-index: 3500;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
  padding: 0;
  width: 300px !important;
  min-width: 300px !important;
  max-width: 90vw;
  max-height: 75vh; /* Reduced height since pin settings removed */
  overflow-y: auto;
  overflow-x: hidden;
  /* Positioning will be handled by JavaScript */
}

.submenu-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: #f8f9fa;
  border-radius: 16px 16px 0 0;
}

.back-btn {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.back-btn:hover {
  background: #5a6268;
}

.submenu-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.submenu-content {
  padding: 12px; /* Restored original padding */
}

.submenu-section {
  margin-bottom: 12px; /* Restored original margin */
}

.submenu-section:last-child {
  margin-bottom: 0;
}

.submenu-section h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Pin Styles Grid */
.pin-styles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px; /* Tighter spacing between buttons */
}

.draw-tools-grid,
.measure-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pin-style-btn,
.draw-tool-btn,
.measure-tool-btn {
  background: #f7f7f7;
  border: 1px solid #dee2e6; /* Match action button border */
  border-radius: 6px; /* Match action button border radius */
  padding: 6px 8px; /* Adjusted padding to center circles vertically */
  cursor: pointer;
  transition: all 0.2s;
  text-align: left; /* Left align for consistent circle positioning */
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Start from left for consistent alignment */
}

.pin-style-btn:hover,
.draw-tool-btn:hover,
.measure-tool-btn:hover {
  background: #eaf4ff;
  border-color: #b3d8ff;
  transform: scale(1.05);
}

.pin-style-btn.active,
.draw-tool-btn.active,
.measure-tool-btn.active {
  background: #007bff;
  color: white;
  border-color: #0056b3;
}

/* Active state for layer buttons */
button[data-layer].active {
  background: #007bff !important;
  color: white !important;
  border-color: #0056b3 !important;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3) !important;
}

.pin-style-btn span,
.draw-tool-btn span,
.measure-tool-btn span {
  font-size: 12px; /* Match Place Pin button text size */
  font-weight: 500;
  vertical-align: middle; /* Align text consistently with circles */
}

.pin-color-preview {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin-right: 6px; /* Space between circle and text */
  flex-shrink: 0; /* Prevent circle from shrinking */
}

/* Action Buttons */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.action-btn {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px; /* Match pin color button text size */
  font-weight: 500; /* Match pin color button text weight */
  transition: all 0.2s;
  text-align: left;
}

.action-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.action-btn:active {
  background: #dee2e6;
}

/* Setting Controls */
.setting-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-controls label {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #555;
  gap: 8px;
}

.setting-controls input[type="range"] {
  width: 100%;
  margin: 2px 0;
}

.setting-controls input[type="color"] {
  width: 32px;
  height: 24px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.setting-controls select {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  background: white;
}

/* Style Controls */
.style-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

/* Mobile Responsive for Submenus */
@media (max-width: 768px) {
  .tool-submenu {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 90vw;
    /* Positioning will be handled by JavaScript */
  }
  
  .pin-styles-grid,
  .draw-tools-grid,
  .measure-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .style-controls {
    grid-template-columns: 1fr;
  }
}



/* Specific: position Tools popup above toolbar - positioning handled by JavaScript */
#toolsDropdown.modern-popup {
  width: auto;
  min-width: 200px;
  max-width: 95vw;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13), 0 1.5px 6px rgba(0,0,0,0.07);
  box-sizing: border-box;
  overflow: hidden;
  z-index: 1002;
}

/* Layers popup spacing to match tools popup */
#layersDropdown.modern-popup,
#mapLayersWrapper.modern-popup,
.modern-popup[data-popup="layers"] {
  padding: 16px !important;
  box-sizing: border-box;
}

/* Uniform spacing for layers popup buttons */
#layersDropdown.modern-popup .popup-grid,
#mapLayersWrapper.modern-popup .popup-grid,
.modern-popup[data-popup="layers"] .popup-grid {
  gap: 12px !important;
} 

@media (max-width: 600px) {
  #toolsDropdown.modern-popup {
    min-width: 180px;
    max-width: 90vw;
    padding: 6px;
  }
  /* Layers popup mobile spacing */
  #layersDropdown.modern-popup,
  #mapLayersWrapper.modern-popup,
  .modern-popup[data-popup="layers"] {
    padding: 12px !important;
  }
  /* Uniform mobile spacing for layers popup buttons */
  #layersDropdown.modern-popup .popup-grid,
  #mapLayersWrapper.modern-popup .popup-grid,
  .modern-popup[data-popup="layers"] .popup-grid {
    gap: 10px !important;
  }
  .modern-popup .popup-grid {
    gap: 10px 8px;
  }
  .modern-popup .popup-grid-horizontal {
    gap: 6px;
    max-width: 240px;
  }
  .modern-popup .popup-btn {
    min-width: 70px;
    width: 80px;
    max-width: 80px;
    padding: 10px 12px;
    font-size: 0.85em;
  }
}

/* Responsive bottom toolbar */
.bottom-toolbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
  z-index: 3000;
  padding: 8px 0;
  border-top: 1px solid #ddd;
  width: 100vw;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0 4px;
}
.bottom-toolbar button, .toolbar-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  white-space: nowrap;
  min-width: 0;
  font-size: 1.5em;
  padding: 10px 16px;
  max-width: 100vw;
}
.bottom-toolbar .toolbar-btn span {
  display: inline;
  font-size: inherit;
  line-height: 1;
}
@media (max-width: 600px) {
  body, html {
    font-size: 14px;
  }
  
  .top-search-bar {
    padding: 6px 12px;
    gap: 8px;
  }
  
  .top-search-bar input {
    padding: 6px 10px;
    font-size: 14px;
    width: 220px;
  }
  
  #gps-button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .help-icon {
    font-size: 16px;
  }
  
  .search-marker-popup {
    padding: 10px 12px;
    min-width: 180px;
    max-width: 250px;
  }
  
  .search-marker-text {
    font-size: 13px;
  }
  
  .search-marker-delete {
    font-size: 14px;
    padding: 3px 6px;
  }
  
  .mapboxgl-popup-content {
    margin: 6px 10px !important;
    font-size: 14px;
  }
  
  .mapboxgl-popup-content-wrapper {
    padding: 6px 10px;
    border-radius: 6px;
  }
  
  .dropdown-content {
    padding: 6px;
    width: 100px;
    max-height: 180px;
  }
  
  .dropdown-content button {
    padding: 4px 6px;
    margin-bottom: 4px;
    font-size: 12px;
    border-radius: 4px;
  }
  
  .today {
    font-size: 14px;
  }
  
  .mid-label {
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
  }
  
  .forecast-day {
    padding: 8px;
    font-size: 12px;
    border-radius: 6px;
  }
  
  .forecast-day b {
    margin-bottom: 4px;
    font-size: 14px;
  }
  

  
  .bottom-toolbar button, .toolbar-btn {
    font-size: clamp(0.8em, 2vw, 1.1em);
    padding: clamp(2px, 0.7vw, 6px) clamp(4px, 1vw, 10px);
  }
}
@media (max-width: 400px) {
  body, html {
    font-size: 12px;
  }
  
  .top-search-bar {
    padding: 4px 8px;
    gap: 6px;
  }
  
  .top-search-bar input {
    padding: 4px 8px;
    font-size: 12px;
    width: 180px;
  }
  
  #gps-button {
    width: 24px;
    height: 24px;
    font-size: 12px;
    margin-left: 4px;
  }
  
  .help-icon {
    font-size: 14px;
  }
  
  .search-marker-popup {
    padding: 8px 10px;
    min-width: 160px;
    max-width: 220px;
  }
  
  .search-marker-text {
    font-size: 12px;
  }
  
  .search-marker-delete {
    font-size: 12px;
    padding: 2px 5px;
  }
  
  .mapboxgl-popup-content {
    margin: 4px 8px !important;
    font-size: 12px;
  }
  
  .mapboxgl-popup-content-wrapper {
    padding: 4px 8px;
    border-radius: 4px;
  }
  
  .dropdown-content {
    padding: 4px;
    width: 80px;
    max-height: 150px;
  }
  
  .dropdown-content button {
    padding: 3px 4px;
    margin-bottom: 3px;
    font-size: 10px;
    border-radius: 3px;
  }
  
  .today {
    font-size: 12px;
  }
  
  .mid-label {
    padding: 2px 4px;
    font-size: 10px;
    border-radius: 3px;
  }
  
  .forecast-day {
    padding: 6px;
    font-size: 10px;
    border-radius: 4px;
  }
  
  .forecast-day b {
    margin-bottom: 3px;
    font-size: 12px;
  }
  

  
  .bottom-toolbar button, .toolbar-btn {
    font-size: clamp(0.7em, 1.5vw, 1em);
    padding: clamp(1px, 0.5vw, 4px) clamp(2px, 0.5vw, 6px);
  }
}

/* Responsive popups */
.modern-popup {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13), 0 1.5px 6px rgba(0,0,0,0.07);
  padding: 18px 20px 14px 20px;
  min-width: 220px;
  max-width: 98vw;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  z-index: 3201;
  border: none;
  box-sizing: border-box;
}
.modern-popup .popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 600px) {
  .modern-popup {
    min-width: 120px;
    padding: 8px 2px 8px 2px;
    max-width: 99vw;
  }
  .modern-popup .popup-grid {
    gap: 6px 4px;
  }
  /* Journal modal mobile sizing */
  body #journalModal.modern-popup {
    width: 85vw !important;
    max-width: 400px !important;
    height: 480px !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    min-width: 0 !important;
  }
}
@media (max-width: 400px) {
  .modern-popup {
    min-width: 80px;
    padding: 4px 1px 4px 1px;
    max-width: 100vw;
  }
  .modern-popup .popup-grid {
    gap: 4px 2px;
  }
  /* Journal modal small mobile sizing */
  body #journalModal.modern-popup {
    width: 90vw !important;
    max-width: 350px !important;
    height: 450px !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    min-width: 0 !important;
  }
  #toolsDropdown.modern-popup {
    min-width: 160px;
    max-width: 85vw;
    padding: 4px;
  }
  /* Layers popup small mobile spacing */
  #layersDropdown.modern-popup,
  #mapLayersWrapper.modern-popup,
  .modern-popup[data-popup="layers"] {
    padding: 8px !important;
  }
  /* Uniform small mobile spacing for layers popup buttons */
  #layersDropdown.modern-popup .popup-grid,
  #mapLayersWrapper.modern-popup .popup-grid,
  .modern-popup[data-popup="layers"] .popup-grid {
    gap: 8px !important;
  }
  .modern-popup .popup-grid-horizontal {
    gap: 4px;
    max-width: 200px;
  }
  .modern-popup .popup-btn {
    min-width: 60px;
    width: 70px;
    max-width: 70px;
    padding: 8px 10px;
    font-size: 0.8em;
  }
  /* GPX modal small mobile 1x2 layout */
  #gpxModal .popup-grid {
    grid-template-columns: 80px 80px !important;
    gap: 8px !important;
    justify-content: center !important;
  }
  /* GPX modal small mobile padding */
  #gpxModal.modern-popup {
    padding: 8px !important;
    min-width: 80px !important;
    max-width: 100vw !important;
  }
  /* GPX buttons equal width on small mobile */
  #gpxModal .popup-btn {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    flex: none !important;
    margin: 0 !important;
  }
}

#weatherWrapper.modern-popup {
  min-width: 880px !important;
  width: 880px !important;
  max-width: 98vw !important;
  min-height: 520px !important;
  height: 520px !important;
  /* Center horizontally, keep bottom fixed */
  left: 50% !important;
  transform: translateX(-50%) !important;
  right: unset !important;
  flex-direction: column !important;
  padding-bottom: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12), 0 6px 24px rgba(0,0,0,0.13), 0 1.5px 6px rgba(0,0,0,0.07);
}
#weatherWrapper.modern-popup .modern-popup-arrow {
  display: none !important; /* Hide weather popup arrow */
}
#weatherWrapper.modern-popup > div:first-child {
  width: 100%;
  box-sizing: border-box;
}

#weatherWrapper .weather-output, #weatherOutput {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  overflow: visible !important;
  box-sizing: border-box;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* New Weather Forecast Design */
.weather-summary {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 16px 10px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.summary-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.summary-left {
  flex: 1;
}

.feels-like {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.condition {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.summary-right {
  text-align: right;
}

.current-temp {
  font-size: 28px;
  font-weight: bold;
  color: #007bff;
  text-align: right;
  margin-bottom: 12px;
}

.summary-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 13px;
  color: #555;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-icon {
  font-size: 14px;
}

.weather-section {
  margin-bottom: 16px;
}

.weather-section h4 {
  color: #007bff;
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 10px 0;
  padding-bottom: 4px;
  border-bottom: 1.5px solid #e0e6ef;
  letter-spacing: 0.01em;
}

/* Hourly Forecast */
.hourly-forecast {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: #007bff #f1f3f4;
  margin-bottom: 10px;
}

.hourly-forecast::-webkit-scrollbar {
  height: 6px;
}

.hourly-forecast::-webkit-scrollbar-track {
  background: #f1f3f4;
  border-radius: 3px;
}

.hourly-forecast::-webkit-scrollbar-thumb {
  background: #007bff;
  border-radius: 3px;
}

.hourly-card {
  background: white;
  border-radius: 7px;
  padding: 10px 6px;
  min-width: 60px;
  max-width: 60px;
  height: 100px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.hour-time {
  font-size: 11px;
  color: #666;
  margin-bottom: 2px;
}

.hour-icon {
  width: 22px;
  height: 22px;
  margin: 2px 0;
}

.hour-temp {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 1px;
}

.hour-rain {
  font-size: 10px;
  color: #007bff;
}

/* Daily Forecast Grid */
.daily-forecast {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.daily-card {
  background: #fff;
  border-radius: 7px;
  padding: 14px 10px;
  box-shadow: 0 1.5px 5px rgba(0,0,0,0.07);
  border: 1px solid #e9ecef;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.18s, background 0.18s;
}
.daily-card:hover {
  box-shadow: 0 0 0 2px #b3d8ff, 0 2px 8px rgba(0,123,255,0.08);
  background: #f7fbff;
}
.daily-forecast .daily-card:nth-child(even) {
  background: #f7f9fa;
}

.daily-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.daily-date {
  font-size: 13px;
  font-weight: 700;
  color: #333;
}

.daily-icon {
  width: 28px;
  height: 28px;
}

.daily-temps {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}

.daily-max {
  font-size: 16px;
  font-weight: bold;
  color: #e74c3c;
}

.daily-min {
  font-size: 16px;
  font-weight: bold;
  color: #3498db;
}

.daily-details {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #666;
}

.daily-sun {
  font-size: 11px;
  color: #888;
  display: flex;
  gap: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .summary-details {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  
  .current-temp {
    font-size: 22px;
  }
  
  .daily-forecast {
    grid-template-columns: 1fr;
  }
  
  .hourly-card {
    min-width: 48px;
    max-width: 48px;
    height: 90px;
    padding: 7px 3px;
  }
  
  .hour-time {
    font-size: 10px;
  }
  
  .hour-temp {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .weather-summary {
    padding: 8px 6px;
  }
  
  .summary-main {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
  
  .summary-right {
    text-align: center;
  }
  
  .daily-card {
    padding: 8px 4px;
  }
  
  .daily-temps {
    justify-content: center;
  }
  
  .daily-details {
    justify-content: center;
  }
  
  .daily-sun {
    justify-content: center;
  }
}

.weather-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.1);
  padding: 16px 20px;
  margin: 0 0 16px 0;
  border-bottom: none;
}
.weather-scroll-body {
  max-height: 420px;
  overflow-y: auto;
  padding: 20px 24px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 0 0 16px 16px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.weather-scroll-body::-webkit-scrollbar {
  width: 6px;
}
.weather-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}
.weather-scroll-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) #fff;
}
.weather-content-wrapper {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  padding: 24px;
  margin-top: 16px;
  overflow-y: auto;
  max-height: 70vh;
  box-sizing: border-box;
  width: 100%;
}
.weather-inner-container {
  width: 100%;
  max-width: 100%;
  background: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.weather-summary:last-child,
.weather-section:last-child {
  margin-bottom: 0;
}
.current-temp {
  font-size: 28px;
  font-weight: bold;
  color: #007bff;
  text-align: right;
  margin-bottom: 12px;
}
@media (max-width: 600px) {
  .weather-header {
    padding: 12px 8px;
    border-radius: 12px;
    margin-bottom: 10px;
  }
  .weather-scroll-body {
    max-height: 320px;
    padding: 12px 6px;
    border-radius: 0 0 12px 12px;
    gap: 14px;
  }
  .weather-inner-container {
    padding: 0;
    border-radius: 10px;
  }
  .current-temp {
    font-size: 22px;
    margin-bottom: 8px;
  }
  .weather-content-wrapper {
    padding: 12px 6px;
    border-radius: 12px;
    margin-top: 10px;
    max-height: 60vh;
  }
}
.weather-inner-container,
.weather-content-wrapper,
.weather-scroll-body {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.weather-top-card, .weather-content-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.weather-top-card {
  margin-bottom: 0;
  border-radius: 12px 12px 0 0;
  padding-bottom: 12px;
}
.weather-content-card {
  margin-top: 0;
  border-radius: 0 0 12px 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}
#useMyLocationBtn {
  background: #007bff;
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: background 0.18s, box-shadow 0.18s;
  white-space: nowrap;
  outline: none;
  margin-left: 8px;
}
#useMyLocationBtn:hover, #useMyLocationBtn:focus {
  background: #005ecb;
  box-shadow: 0 2px 8px rgba(0,123,255,0.13);
}
@media (max-width: 600px) {
  .weather-top-card, .weather-content-card {
    padding: 12px 6px;
    border-radius: 10px;
  }
  .weather-top-card {
    border-radius: 10px 10px 0 0;
    padding-bottom: 8px;
  }
  .weather-content-card {
    border-radius: 0 0 10px 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  #useMyLocationBtn {
    padding: 8px 10px;
    font-size: 12px;
  }
}
.daily-card:last-child,
.weather-section:last-child {
  margin-bottom: 0;
}

/* Weather Popup Modern Layout */
.weather-fixed-header {
  position: sticky;
  top: 0;
  background: #f7f9fc;
  border-radius: 16px 16px 16px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 18px 18px 10px 18px;
  z-index: 2;
}
.weather-title {
  margin: 0 0 12px 0;
  color: #007bff;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}
.weather-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.weather-search-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}
.weather-search-row button {
  padding: 8px 14px;
  font-size: 13px;
  border: none;
  border-radius: 6px;
  background: #f5faff;
  color: #007bff;
  cursor: pointer;
  transition: background 0.2s;
}
.weather-search-row button:hover {
  background: #e6f0ff;
}

/* Weather Location Confirmation */
.weather-location-confirmation {
  margin: 8px 0;
  padding: 8px 12px;
  background: #e8f4fd;
  border: 1px solid #b3d8ff;
  border-radius: 6px;
  font-size: 0.9em;
  color: #2c5aa0;
  text-align: center;
  display: none;
}

.weather-location-confirmation.show {
  display: block;
}
.weather-forecast-container {
  margin-top: 8px;
  padding: 0 12px 12px 12px;
}
/* Forecast section containers */
.weather-current-container {
  background: #f8fafd;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 14px;
  padding: 14px 12px 10px 12px;
}
.weather-hourly-container {
  background: #f6f7fb;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  margin-bottom: 14px;
  padding: 12px 10px 8px 10px;
}
.weather-daily-container {
  background: #f6f7fb;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  margin-bottom: 0;
  padding: 12px 10px 8px 10px;
}
/* Responsive tweaks */
@media (max-width: 600px) {
  .weather-fixed-header {
    padding: 12px 6px 8px 6px;
  }
  .weather-forecast-container {
    padding: 0 2px 8px 2px;
  }
}

@media (min-width: 900px) {
  #map {
    height: calc(100vh - 48px) !important;
    padding-bottom: 48px !important;
    box-sizing: border-box;
  }
}

@media (min-width: 900px) {
  .bottom-toolbar {
    height: 48px;
    padding: 4px 0;
  }
  .bottom-toolbar .toolbar-btn {
    background: #fafafa;
    border: 1.5px solid #e5e5e5;
    font-size: 1.1em;
    padding: 4px 12px;
    min-width: 80px;
    max-width: 140px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: background 0.2s, border 0.2s;
  }
}

@media (max-width: 900px) {
  .modern-popup-arrow {
    display: none !important;
  }
}

@media (max-width: 900px) {
  #toolsDropdown.modern-popup {
    max-height: 340px; /* or whatever fits your design */
    overflow-y: auto;
    min-height: unset !important;
    height: auto !important;
  }
}

@media (max-width: 900px) {
  .bottom-toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    width: 100vw;
    padding: 12px 0;
    background: #f8f8f8;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: center;   /* was space-evenly */
    align-items: center;
    gap: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .bottom-toolbar .toolbar-btn {
    flex: 0 0 96px;            /* every button same width */
    height: 54px;              /* same height */
    margin: 0 6px;
    border-radius: 14px;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    flex-shrink: 0;
  }

  .bottom-toolbar .toolbar-btn span {
    font-size: 0.95em;
    margin-top: 2px;
  }
}

@media (min-width: 900px) {
  .modern-popup .popup-btn {
    background: #fafafa;
    border: 1.5px solid #e5e5e5;
    border-radius: 10px;
    font-size: 1.1em;
    padding: 8px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    color: #222;
    transition: background 0.2s, border 0.2s;
    margin: 0 4px 8px 4px;
  }
  .modern-popup .popup-btn:active, .modern-popup .popup-btn:focus, .modern-popup .popup-btn:hover {
    background: #f0f8ff;
    border-color: #b3d8ff;
  }
  
  /* Ensure GPX buttons match layers buttons on desktop */
  #gpxModal .popup-grid {
    grid-template-columns: 120px 120px !important;
    gap: 12px !important;
    justify-content: center !important;
  }
  #gpxModal .popup-btn {
    background: #fafafa !important;
    border: 1.5px solid #e5e5e5 !important;
    border-radius: 10px !important;
    font-size: 1.1em !important;
    padding: 8px 0 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
    color: #222 !important;
    transition: background 0.2s, border 0.2s !important;
    margin: 0 !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    flex: none !important;
  }
  #gpxModal .popup-btn:active, #gpxModal .popup-btn:focus, #gpxModal .popup-btn:hover {
    background: #f0f8ff;
    border-color: #b3d8ff;
  }
}

@media (max-width: 900px) {
  #journalModal.modern-popup,
  #sssModal.modern-popup {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  #journalModal.modern-popup .popup-btn,
  #sssModal.modern-popup .popup-btn {
    width: 100%;
    box-sizing: border-box;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  #journalModal.modern-popup .journal-entry-list {
    padding-left: 4px;
    padding-right: 4px;
  }
  #journalModal.modern-popup .journal-empty-message {
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
  }
  #sssModal.modern-popup > div,
  #gpxModal.modern-popup > div {
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
  }
  #gpxModal.modern-popup {
    min-width: 120px !important;
    max-width: 95vw !important;
  }
  /* GPX modal mobile 1x2 layout */
  #gpxModal .popup-grid {
    grid-template-columns: 100px 100px !important;
    gap: 10px !important;
    justify-content: center !important;
    width: 220px !important;
    margin: 0 auto !important;
  }
  /* GPX modal mobile padding */
  #gpxModal.modern-popup {
    padding: 12px !important;
  }
  /* GPX buttons equal width on mobile */
  #gpxModal .popup-btn {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    flex: none !important;
    margin: 0 !important;
    padding: 12px 8px !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }
}

@media (max-width: 900px) {
  #weatherWrapper.modern-popup,
  #journalModal.modern-popup {
    width: auto !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    margin-bottom: 0 !important;
    transform: none !important;
    border-radius: 16px !important;
  }
  #disclaimerOverlay > div {
    width: auto !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    border-radius: 16px !important;
  }
}

/* Ensure Mapbox attribution is positioned like popups - Maximum specificity approach */
.mapboxgl-control-attribution,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-attrib.mapboxgl-ctrl,
.mapboxgl-ctrl.mapboxgl-ctrl-attrib,
div.mapboxgl-ctrl-attrib,
div.mapboxgl-control-attribution {
  bottom: 22px !important; /* Lowered by 10px */
  margin-bottom: 0 !important; /* Remove margin */
  z-index: 5000 !important; /* optional, to be sure it's above map tiles */
  transform: none !important; /* Remove transform */
  position: absolute !important; /* Force absolute positioning */
  top: auto !important; /* Override any top positioning */
  left: auto !important; /* Override any left positioning */
  right: 0 !important; /* Keep right alignment */
  white-space: nowrap !important; /* Force single line */
  width: auto !important; /* Allow natural width */
  max-width: none !important; /* Remove width constraints */
  display: inline-block !important; /* Inline display */
  line-height: 1.2 !important; /* Compact line height */
}

/* Move Mapbox scale control a bit above the attribution - Maximum specificity */
.mapboxgl-ctrl-scale,
.mapboxgl-ctrl-scale.mapboxgl-ctrl,
.mapboxgl-ctrl.mapboxgl-ctrl-scale,
div.mapboxgl-ctrl-scale {
  bottom: 40px !important; /* Lowered by 10px */
  margin-bottom: 0 !important; /* Remove margin */
  z-index: 5000 !important;
  position: absolute !important; /* Force absolute positioning */
  top: auto !important; /* Override any top positioning */
  left: auto !important; /* Override any left positioning */
  right: 0 !important; /* Keep right alignment */
}

@media (max-width: 600px) {
  .mapboxgl-control-attribution,
  .mapboxgl-ctrl-attrib,
  .mapboxgl-ctrl-attrib.mapboxgl-ctrl,
  .mapboxgl-ctrl.mapboxgl-ctrl-attrib {
    bottom: 30px !important; /* Lowered by 10px on mobile */
    margin-bottom: 0 !important; /* Remove margin */
    right: 8px !important;
    left: auto !important;
    font-size: 11px;
    z-index: 5000;
    transform: none !important; /* Remove transform */
    position: absolute !important; /* Force absolute positioning */
    white-space: nowrap !important; /* Force single line */
    width: auto !important; /* Allow natural width */
    max-width: none !important; /* Remove width constraints */
    display: inline-block !important; /* Inline display */
    line-height: 1.2 !important; /* Compact line height */
  }
  
  .mapboxgl-ctrl-scale,
  .mapboxgl-ctrl-scale.mapboxgl-ctrl,
  .mapboxgl-ctrl.mapboxgl-ctrl-scale {
    bottom: 50px !important; /* Lowered by 10px on mobile */
    margin-bottom: 0 !important; /* Remove margin */
    z-index: 5000 !important;
    position: absolute !important; /* Force absolute positioning */
  }
}
.modern-popup .modern-popup-arrow {
  display: none !important; /* Hide all popup arrows */
}
.modern-popup .popup-grid + .modern-popup-arrow {
  margin-top: 0 !important;
}

.modern-popup {
  position: relative;
  overflow: visible !important; /* Ensure arrow is not clipped */
}

.modern-popup-arrow {
  display: none !important; /* Hide all popup arrows */
}

.modern-popup .popup-grid {
  z-index: 3;
  position: relative;
}

@media (min-width: 900px) {
  #toolsDropdown.modern-popup {
    width: auto !important;
    max-width: 95vw !important;
    min-width: 240px !important;
    height: auto !important;
    min-height: unset !important;
    max-height: unset !important;
    align-items: flex-start !important;
    box-sizing: border-box !important;
  }
  .modern-popup .popup-grid {
    box-sizing: border-box;
  }

  
}

/* SSS Module Styles */
#sssModal.modern-popup {
  min-width: 880px !important;
  width: 880px !important;
  max-width: 98vw !important;
  min-height: 520px !important;
  height: 520px !important;
  /* Center horizontally, keep bottom fixed */
  left: 50% !important;
  transform: translateX(-50%) !important;
  right: unset !important;
  flex-direction: column !important;
  padding-bottom: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12), 0 6px 24px rgba(0,0,0,0.13), 0 1.5px 6px rgba(0,0,0,0.07);
}

#sssModal.modern-popup .modern-popup-arrow {
  display: none !important; /* Hide SSS modal arrow */
}

#sssModal.modern-popup > div:first-child {
  width: 100%;
  box-sizing: border-box;
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#sssInput {
  width: 100%;
  min-height: 80px;
  max-height: 120px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 16px;
  flex-shrink: 0;
}

#sssInput:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

#sssSubmitBtn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 16px;
  flex-shrink: 0;
}

#sssSubmitBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#sssSubmitBtn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#sssLoading {
  color: #666;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  margin: 16px 0;
  flex-shrink: 0;
}

#sssOutput {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  flex-grow: 1;
  overflow-y: auto;
  word-wrap: break-word;
  min-height: 0;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

#sssOutput p {
  margin: 0 0 12px 0;
}

#sssOutput p:last-child {
  margin-bottom: 0;
}

#sssOutput strong {
  color: #333;
}

#sssOutput em {
  color: #666;
}

#sssModal .close-modal {
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
}

/* Mobile responsive styles for SSS */
@media (max-width: 900px) {
  #sssModal.modern-popup {
    min-width: 320px !important;
    max-width: 95vw !important;
    width: auto !important;
    min-height: 400px !important;
    height: auto !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    margin-bottom: 0 !important;
    transform: none !important;
    border-radius: 16px !important;
  }
  
  #sssInput {
    min-height: 80px;
    max-height: 100px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  #sssOutput {
    min-height: 120px;
    font-size: 14px;
  }
  
  #sssSubmitBtn {
    padding: 12px;
    font-size: 16px;
  }
}

@media (max-width: 400px) {
  #sssModal.modern-popup {
    margin-left: 8px !important;
    margin-right: 8px !important;
  }
  
  #sssInput {
    min-height: 80px;
    max-height: 100px;
  }
  
  #sssOutput {
    min-height: 100px;
    padding: 12px;
  }
}

.login-modal.hidden {
  display: none !important;
}

/* ULTRA-AGGRESSIVE MAPBOX CONTROL REPOSITIONING - HIGHEST PRIORITY */
body .mapboxgl-ctrl-attrib,
body .mapboxgl-control-attribution,
body div.mapboxgl-ctrl-attrib,
body div.mapboxgl-control-attribution {
  bottom: 22px !important; /* Lowered by 10px */
  margin-bottom: 0 !important;
  z-index: 9999 !important;
  position: absolute !important;
  top: auto !important;
  left: auto !important;
  right: 0 !important;
  transform: none !important;
  white-space: nowrap !important; /* Force single line */
  width: auto !important; /* Allow natural width */
  max-width: none !important; /* Remove width constraints */
  display: inline-block !important; /* Inline display */
  line-height: 1.2 !important; /* Compact line height */
}

body .mapboxgl-ctrl-scale,
body div.mapboxgl-ctrl-scale {
  bottom: 40px !important; /* Lowered by 10px */
  margin-bottom: 0 !important;
  z-index: 9999 !important;
  position: absolute !important;
  top: auto !important;
  left: auto !important;
  right: 0 !important;
  transform: none !important;
}

/* ULTRA-HIGH SPECIFICITY JOURNAL MODAL WIDTH OVERRIDE - Desktop only */
@media (min-width: 601px) {
  body #journalModal.modern-popup {
    max-width: none !important;
    width: auto !important;
    min-width: 400px !important;
  }
}

body #journalModal.modern-popup #journalForm input,
body #journalModal.modern-popup #journalForm textarea,
body #journalModal.modern-popup #journalForm button,
body #journalModal.modern-popup .close-modal {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Journal modal inner wrapper override */
#journalModal > div[style] {
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;   /* remove forced side padding */
  margin: 0 !important;
  box-sizing: border-box;
}

/* Ensure form elements inside still stretch full width */
#journalModal #journalForm input,
#journalModal #journalForm textarea,
#journalModal #journalForm button,
#journalModal .close-modal {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}