/* Simplified Suunto Button System */
.suunto-container {
  position: relative;
  display: inline-block;
}

/* Upload Button (appears when authenticated) */
#suunto-upload-btn {
  /* Positioning */
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  z-index: 1100;
  
  /* Animation */
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

#suunto-upload-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

#suunto-upload-btn.visible {
  opacity: 1;
  transform: translateY(0);
  display: flex !important;
}

/* Main Suunto Button - uses standard control-button styling */
#suunto-main-btn {
  /* No custom overrides - inherits from .control-button */
}

#suunto-main-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Modal Styles */
#modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

#modal-content {
  background: var(--background-color);
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

#modal h3 {
  margin: 0 0 16px 0;
  color: var(--text-color);
  font-size: 1.25rem;
}

#modal input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 16px;
  box-sizing: border-box;
}

#modal button {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 8px;
}

#modal-save {
  background-color: var(--primary-color);
  color: white;
}

#modal-save:hover {
  background-color: var(--primary-hover);
}

#modal-cancel {
  background-color: #f3f4f6;
  color: var(--text-color);
}

#modal-cancel:hover {
  background-color: #e5e7eb;
}

/* Right Controls Stack */
#right-controls {
  position: fixed;
  top: 20px; /* Fixed distance from top instead of relative positioning */
  right: 10px;
  z-index: 1100;
  width: 56px;
}

/* Position buttons within the right controls container */
#right-controls .control-button {
  position: absolute;
  right: 0;
}

#map-style-btn { top: 0; }
#toggle-3d-btn { top: 60px; }
#heatmap-btn { top: 120px; }
#routing-profile-btn { top: 180px; }
#undo-btn { top: 240px; }
#reverse-route-btn { top: 300px; }

/* Control Buttons */
.control-button {
  width: 48px;
  height: 48px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
  touch-action: manipulation; /* Prevent zoom on double-tap */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

.control-button:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.control-button.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.control-button.active img {
  filter: brightness(0) invert(1);
}

/* Exception for 3D toggle button - use different styling for active state */
#toggle-3d-btn.active img {
  filter: none;
  opacity: 1;
}

.control-button.active svg {
  color: white;
}

.control-button img,
.control-button svg {
  width: 28px;
  height: 28px;
  opacity: 0.85;
}

.control-button:hover img,
.control-button:hover svg {
  opacity: 1;
}

/* Bottom container - holds both controls and bottom bar */
#bottom-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

/* MAPBOX LOGO - Position independently on left side above bottom bar header */
.logo-container {
  position: absolute;
  left: 30px; /* Move 5px to the left (was 35px, now 30px) */
  bottom: 31px; /* Move 2px down (was 33px, now 31px) */
  z-index: 1001;
  transition: bottom 0.3s ease;
}

#custom-mapbox-logo {
  display: flex !important;
  align-items: center !important;
  width: 88px !important;
  height: 24px !important;
  cursor: pointer !important;
}

#custom-mapbox-logo img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* BOTTOM CONTROLS - Position relative to bottom bar header */
#bottom-controls {
  position: absolute;
  bottom: 56px; /* Move 4px down (was 60px, now 56px) */
  left: 40px; /* Move entire container 20px to the right (was 20px, now 40px) */
  right: 40px; /* Move entire container 20px from right edge (was 20px, now 40px) */
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  transition: bottom 0.3s ease; /* Smooth transition when moving with bottom bar */
}

/* Desktop: Move controls and logo up when bottom bar is open */
@media (min-width: 769px) {
  body.bottom-bar-open #bottom-controls {
    bottom: 326px !important; /* Move 4px down (was 330px, now 326px) */
  }
  
  body:not(.bottom-bar-open) #bottom-controls {
    bottom: 56px !important; /* Move 4px down (was 60px, now 56px) */
  }
  
  body.bottom-bar-open .logo-container {
    bottom: 303px !important; /* Move 5px down from previous position (was 308px, now 303px) */
  }
  
  body:not(.bottom-bar-open) .logo-container {
    bottom: 33px !important; /* Move 5px down (was 38px, now 33px) */
  }
}

#geocoder-container {
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-10px); /* Move left side buttons 10px to the left */
  /* Ensure consistent positioning with right side */
  position: relative;
  top: 0;
}

#bottom-right-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  transform: translateX(20px); /* Move right side buttons 20px to the right (reduced by 10px) */
}

#geocoder-input {
  height: 48px;
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  padding: 0 18px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

#geocoder-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Bottom Controls */
#bottom-right-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Ensure consistent positioning with left side */
  position: relative;
  top: 0;
}

#distance-display {
  height: 48px;
  background: var(--background-color);
  padding: 0 18px;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  white-space: nowrap;
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border-color);
}

#bottom-bar {
  width: 100%;
}

/* Menu Styles */
.menu-container {
  position: absolute;
  background: var(--background-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  z-index: 1002;
  width: 280px;
  display: block;
  right: 88px;
}

.menu-container.hidden {
  display: none !important;
}

#routing-menu {
  top: 128px;
}

#map-style-menu {
  top: 182px;
}

#heatmap-menu {
  top: 236px;
}

.opacity-control {
  padding: 8px 12px;
  border-top: 1px solid #e0e0e0;
  margin-top: 4px;
}

.opacity-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #666;
}

.opacity-slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e0e0e0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #007cba;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.opacity-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #007cba;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.menu-item {
  padding: 4px 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  min-height: 32px;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background-color: #f8fafc;
}

.menu-item.selected {
  background-color: #eff6ff;
}

.menu-item img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}

.menu-item-text {
  flex-grow: 1;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item-title {
  font-size: 13px;
  font-weight: 500;
}

.menu-item-description {
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.1;
}

/* Special handling for map style menu items */
#map-style-menu .menu-item {
  padding: 8px 12px;
  min-height: 36px;
}

#map-style-menu .menu-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
}

/* Left Side Controls */
#locate-me-btn, #zoom-route-btn, #search-toggle {
  width: 48px;
  height: 48px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

/* Right Side Controls */
#map-style-btn, #toggle-3d-btn, #heatmap-btn, #routing-profile-btn, #undo-btn, #reverse-route-btn {
  position: absolute;
  right: 0;
  width: 48px;
  height: 48px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
  z-index: 1000;
}

#map-style-btn { top: 0; }
#toggle-3d-btn { top: 60px; }
#heatmap-btn { top: 120px; }
#routing-profile-btn { top: 180px; }
#undo-btn { top: 240px; }
#reverse-route-btn { top: 300px; }

/* Left Side Control Button Hover Effects */
#locate-me-btn:hover, #zoom-route-btn:hover, #search-toggle:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Right Side Control Button Hover Effects */
#toggle-3d-btn:hover, #heatmap-btn:hover, #routing-profile-btn:hover, 
#undo-btn:hover, #reverse-route-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Disabled state for control buttons */
.control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.control-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Left Side Control Button Icons */
#locate-me-btn img, #zoom-route-btn img, #search-toggle svg {
  width: 28px;
  height: 28px;
  opacity: 0.85;
}

/* Right Side Control Button Icons */
#toggle-3d-btn img, #heatmap-btn img, #routing-profile-btn img,
#undo-btn img, #reverse-route-btn img {
  width: 28px;
  height: 28px;
  opacity: 0.85;
  border-radius: 50%;
}

/* Special handling for map style button icon */
#map-style-btn img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

/* Special handling for heatmap button icon */
#heatmap-btn img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

/* Special handling for heatmap "None" icon - keep it smaller */
#heatmap-btn img[src*="heatmap-none"] {
  width: 28px;
  height: 28px;
}

/* Language selector styles */
#language-selector {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  height: 24px;
  transition: background-color 0.1s ease;
  min-width: 80px;
}

#language-selector:hover {
  background: rgba(255, 255, 255, 1);
}

/* Controls container */
#controls-container {
  position: absolute;
  bottom: calc(var(--bottom-bar-height));
  right: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px;
  transform: translateY(-10px);
  z-index: 1000;
}

#search-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

#search {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 200px;
}

#search-button {
  padding: 8px 16px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#search-button:hover {
  background-color: #357abd;
}

#distance-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 0;
  height: 48px;
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  padding: 0 18px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  opacity: 0;
  overflow: hidden;
}

.search-container.expanded .search-input {
  width: 240px;
  opacity: 1;
}

.search-toggle {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  background: var(--background-color);
  color: var(--text-color);
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  right: 0;
  z-index: 2;
}

.search-container.expanded .search-toggle {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.search-toggle:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
  background: var(--primary-color);
  color: white;
}

.search-toggle svg {
  width: 16px;
  height: 16px;
}

/* MOBILE: Keep controls fixed at bottom */
@media (max-width: 768px) {
  /* Mobile: Smaller buttons for better fit - maintain for all narrower screens */
  .control-button {
    width: 40px !important;
    height: 40px !important;
  }
  
  .control-button img,
  .control-button svg {
    width: 22px !important;
    height: 22px !important;
  }
  
  /* Suunto buttons - smaller on mobile - maintain for all narrower screens */
  #suunto-main-btn img,
  #suunto-upload-btn img {
    width: 18px !important;
    height: 18px !important;
  }
  
  /* Map style button - bigger icon on mobile for better visibility - maintain for all narrower screens */
  #map-style-btn img {
    width: 32px !important;
    height: 32px !important;
  }
  
  /* Fix bottom-right controls positioning on mobile - maintain for all narrower screens */
  #bottom-right-controls {
    transform: translateX(0px) !important; /* Remove right offset on mobile */
  }
  
  /* Mobile: Use same height as desktop for consistency - maintain for all narrower screens */
  #bottom-controls {
    position: fixed !important;
    bottom: 56px !important; /* Move 4px down (was 60px, now 56px) */
    left: 13px !important; /* Move 5px to the right for better symmetry */
    right: 8px !important; /* Move closer to right edge */
    padding: 0 !important;
    transition: none !important; /* No transition on mobile */
  }
  
  /* Mobile: Reduce spacing between right-side control buttons to prevent overflow */
  #map-style-btn { top: -10px; } /* Moved up 10px from 0 */
  #toggle-3d-btn { top: 35px; } /* Moved up 10px from 45px */
  #heatmap-btn { top: 80px; } /* Moved up 10px from 90px */
  #routing-profile-btn { top: 125px; } /* Moved up 10px from 135px */
  #undo-btn { top: 170px; } /* Moved up 10px from 180px */
  #reverse-route-btn { top: 215px; } /* Moved up 10px from 225px */
  
  /* Mobile: Ensure geocoder doesn't overflow and fix positioning */
  #geocoder-container {
    max-width: calc(100vw - 200px) !important; /* Back to original calculation */
    transform: translateX(-6px) !important; /* Adjust for mobile to maintain same distance from edge as desktop */
  }
  
  /* Mobile: Show logo with fixed positioning - maintain for all narrower screens */
  .logo-container {
    position: fixed !important;
    left: 13px !important; /* Match other controls spacing - moved 5px to the right */
    bottom: 33px !important; /* Move 5px down (was 38px, now 33px) */
    transition: none !important; /* No transition on mobile */
  }
  
  /* Mobile: Hide controls and logo when bottom bar is open to prevent overlap */
  body.bottom-bar-open #bottom-controls,
  body.bottom-bar-open .logo-container {
    display: none !important;
  }
  
  /* Mobile: Show controls and logo when bottom bar is closed */
  body:not(.bottom-bar-open) #bottom-controls,
  body:not(.bottom-bar-open) .logo-container {
    display: flex !important;
  }
}

/* SHORT SCREEN HEIGHT: Prevent overlap between right controls and bottom controls */
@media (max-height: 600px) {
  /* Move bottom-right controls LEFT to avoid overlap with right-side controls */
  #bottom-right-controls {
    transform: translateX(-40px) !important; /* Move left just enough to avoid overlap */
  }
  
  /* Adjust bottom controls container to accommodate the moved controls */
  #bottom-controls {
    right: 40px !important; /* Add space on the right */
  }
}

/* Force attribution text to be always visible - override all Mapbox responsive behavior */
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-attrib.mapboxgl-compact,
.mapboxgl-ctrl-attrib.mapboxgl-compact-show,
.mapboxgl-ctrl-attrib-button,
.mapboxgl-ctrl-attrib-inner,
.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl-attrib {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
  max-width: none !important;
  min-width: auto !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  white-space: nowrap !important;
}

/* Force compact attribution to always show full text */
.mapboxgl-ctrl-attrib.mapboxgl-compact:before,
.mapboxgl-ctrl-attrib.mapboxgl-compact::before {
  display: none !important;
}

/* Override any media query hiding and fix positioning */
@media (max-width: 640px) {
  .mapboxgl-ctrl-attrib,
  .mapboxgl-ctrl-attrib.mapboxgl-compact,
  .mapboxgl-ctrl-attrib-inner {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .mapboxgl-ctrl-attrib.mapboxgl-compact {
    bottom: 35px !important; /* Final adjustment - 2px more down */
  }
}



/* Share Dialog Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal:not(.hidden) {
  display: flex;
}

.modal-content {
  background: var(--background-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.modal-body {
  padding: 0 24px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.875rem;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--background-color);
  color: var(--text-color);
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.link-container {
  display: flex;
  gap: 8px;
}

.link-container input {
  flex: 1;
  background-color: #f8f9fa;
  color: #6c757d;
  cursor: text;
}

.copy-btn {
  padding: 12px 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.copy-btn:hover {
  background-color: var(--primary-hover);
}

.info-text {
  margin: 0;
  color: #6c757d;
  font-size: 0.875rem;
  line-height: 1.4;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px 24px 24px;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
}

.primary-btn {
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.primary-btn:hover {
  background-color: var(--primary-hover);
}

.primary-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.secondary-btn {
  padding: 12px 24px;
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* General hidden class for any element */
.hidden {
  display: none !important;
}

/* Override for flyover button to show pause icon correctly */
#flyover-btn.active img {
  filter: none !important;
}

/* Waypoint hover effects */
.mapboxgl-marker {
  /* Remove transitions to prevent positioning delays */
  cursor: pointer !important;
}

.mapboxgl-marker:hover {
  transform: scale(1.2);
  filter: brightness(1.2);
  cursor: pointer !important;
}

/* Custom waypoint ring markers */
.mapboxgl-marker.waypoint-marker {
  /* Ensure markers are properly anchored to the map */
  /* Remove transform-origin to prevent positioning issues */
}

.mapboxgl-marker.waypoint-marker:hover {
  /* Remove transform scale to prevent positioning issues */
  filter: brightness(1.1);
}

.mapboxgl-marker.waypoint-marker svg {
  /* Remove transitions to prevent positioning delays */
}

.mapboxgl-marker.waypoint-marker:hover svg circle {
  stroke-width: 3;
  stroke: #1d4ed8;
}

/* Waypoint removal hover state */
.mapboxgl-marker.removal-hover {
  transform: scale(var(--custom-scale, 1.3)) !important;
  filter: brightness(1.5) hue-rotate(0deg) saturate(2) !important;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.8) !important;
  cursor: pointer !important;
}

/* Alternative selectors for different marker structures */
.mapboxgl-marker div {
  transition: all 0.2s ease;
  cursor: pointer !important;
}

/* Remove the conflicting div transform that was causing issues */
.mapboxgl-marker.removal-hover div {
  cursor: pointer !important;
}

/* Ensure waypoint markers always show pointer cursor */
.mapboxgl-marker svg {
  cursor: pointer !important;
}

.mapboxgl-marker * {
  cursor: pointer !important;
}

/* Ensure markers are properly positioned and don't float */
.mapboxgl-marker.waypoint-marker {
  /* Remove position: absolute to let Mapbox GL JS handle positioning */
  /* Remove transform-origin to prevent positioning issues */
  /* Remove will-change to prevent positioning issues */
}

/* Ensure marker elements are properly positioned */
.mapboxgl-marker.waypoint-marker > div {
  position: relative !important;
  /* Remove transform-origin to prevent positioning issues */
}

/* Hide the route reset button to prevent accidental clicks */
#reset-btn {
  display: none !important;
}

/* Suunto Integration Styles */
#suunto-user-info {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: var(--text-color);
}

.suunto-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.suunto-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* Suunto button specific styling */
#suunto-login-btn img,
/* Suunto Logout Confirmation Dialog */
.suunto-confirmation-dialog {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1100;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-width: 280px;
}

.confirmation-content p {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text-color);
  text-align: center;
}

.confirmation-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.confirmation-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.confirm-btn {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.confirm-btn:hover {
  background: #c82333;
  border-color: #bd2130;
}

.cancel-btn {
  background: var(--background-color);
  color: var(--text-color);
}

.cancel-btn:hover {
  background: var(--hover-background-color);
}

#suunto-logout-btn svg,
#suunto-upload-btn img {
  width: 24px;
  height: 24px;
}

/* Upload button in right controls should be smaller */
#right-controls #suunto-upload-btn img {
  width: 20px;
  height: 20px;
}

/* Connected state styling */
.suunto-connected {
  border: 2px solid #00d4aa;
}

.suunto-connected::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #00d4aa;
  border-radius: 50%;
  border: 1px solid white;
}

/* Waypoint Context Menu */
.waypoint-context-menu {
  background: var(--background-color);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  overflow: hidden;
  min-width: 140px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.context-menu-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color);
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
}

.context-menu-item:hover {
  background-color: rgba(59, 130, 246, 0.08);
  color: #2563eb;
}

.context-menu-item:active {
  background-color: rgba(59, 130, 246, 0.12);
  transform: scale(0.98);
}

.context-menu-item[data-action="route-here"] {
  color: #059669;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.context-menu-item[data-action="route-here"]:hover {
  color: #047857;
  background-color: rgba(5, 150, 105, 0.08);
}

.context-menu-item[data-action="delete"] {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.context-menu-item[data-action="delete"]:hover {
  color: #dc2626;
  background-color: rgba(220, 38, 38, 0.08);
}

/* Custom Name Dialog */
.waypoint-name-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.15s ease;
}

.waypoint-name-dialog-content {
  background: var(--background-color);
  border-radius: 16px;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  padding: 24px;
  min-width: 320px;
  max-width: 400px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  animation: slideIn 0.2s ease;
}

.waypoint-name-dialog h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.3;
}

.waypoint-name-dialog input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--background-color);
  color: var(--text-color);
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.waypoint-name-dialog input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.waypoint-name-dialog-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

.waypoint-name-dialog button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
}

.waypoint-name-dialog .btn-cancel {
  background: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.waypoint-name-dialog .btn-cancel:hover {
  background: #f8fafc;
}

.waypoint-name-dialog .btn-save {
  background: #2563eb;
  color: white;
}

.waypoint-name-dialog .btn-save:hover {
  background: #1d4ed8;
}

.waypoint-name-dialog .btn-save:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Waypoint Markers */
.waypoint-marker {
  /* Remove transform transition to prevent positioning issues */
}

.waypoint-marker:hover {
  /* Remove transform scale to prevent positioning issues */
}

.waypoint-marker img {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Waypoint Tooltip */
.waypoint-tooltip {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
}

.waypoint-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
} 

/* Button group styling - removed as no longer needed */ 