:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --background-color: #ffffff;
  --border-color: #e5e7eb;
  --text-color: #333;
  --text-secondary: #666666;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --bottom-bar-height: 50px; /* Updated to show full toggle button */
  --header-height: 32px;
  --min-bottom-bar-height: 300px; /* Match the default open height */
  --bottom-bar-bg: #fff;
  --bottom-bar-bg: #f5f5f5;
  --custom-crosshair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cstyle%3E.line%7Bstroke:%23000;stroke-width:1.5;%7D%3C/style%3E%3Cline class='line' x1='12' y1='0' x2='12' y2='24'/%3E%3Cline class='line' x1='0' y1='12' x2='24' y2='12'/%3E%3C/svg%3E") 12 12, crosshair;
}

/* Global mobile prevention of content overflow */
* {
  box-sizing: border-box;
}

/* Prevent any element from going out of bounds on mobile */
@media (max-width: 768px) {
  * {
    max-width: 100vw !important;
    max-height: 100vh !important;
  }
}

html, body, #map {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden; /* Prevent page scrolling */
  position: fixed; /* Prevent content from going out of bounds */
  width: 100%;
  max-width: 100vw; /* Ensure content doesn't exceed viewport width */
}

#map {
  position: absolute;
  top: 0;
  bottom: var(--bottom-bar-height);
  width: 100%;
  z-index: 1;
  transition: bottom 0.3s ease;
  cursor: var(--custom-crosshair) !important;
}

/* Logo container styling */
#logo-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#logo-container img {
  max-width: none; /* Allow logos to maintain their aspect ratio */
}

.mapboxgl-canvas {
  cursor: var(--custom-crosshair) !important;
}

#map .mapboxgl-canvas {
  cursor: var(--custom-crosshair) !important;
}

body {
  margin: 0;
  padding: 0;
  touch-action: manipulation; /* Prevent zoom on double-tap */
  -webkit-touch-callout: none; /* Disable callout on iOS */
  -webkit-user-select: none; /* Disable text selection on iOS */
  -moz-user-select: none; /* Disable text selection on Firefox */
  -ms-user-select: none; /* Disable text selection on IE/Edge */
  user-select: none; /* Disable text selection */
}


/* Position controls */
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
  position: fixed !important;
  z-index: 1002 !important;
  margin: 0 !important;
  pointer-events: auto !important;
  transition: bottom 0.3s ease !important;
  bottom: 17px !important;
}

.mapboxgl-ctrl-bottom-left {
  left: 20px !important;
}

.mapboxgl-ctrl-bottom-right {
  right: 5px !important;
}

/* Mapbox attribution styling */
.mapboxgl-ctrl-attrib.mapboxgl-compact {
  min-height: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  background-color: transparent !important;
  position: fixed !important;
  right: 5px !important;
  bottom: 75px !important;
  transition: bottom 0.3s ease !important;
  z-index: 1002 !important;
}

.mapboxgl-ctrl-attrib-inner {
  padding: 2px 4px !important;
  margin: 0 !important;
  background: transparent !important;
  border-radius: 3px !important;
  font-size: 10px !important;
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
}

.mapboxgl-ctrl-attrib-inner a {
  color: rgba(255, 255, 255, 0.9) !important;
  text-decoration: none !important;
}

.mapboxgl-ctrl-attrib-inner a:hover {
  text-decoration: underline !important;
}

/* Bottom controls positioning - REMOVED - handled by components.css */
/* #bottom-controls {
  position: fixed;
  bottom: 17px;
  left: 0;
  right: 0;
  z-index: 1001;
  transition: bottom 0.3s ease;
} */

/* Mobile-specific bottom controls adjustments - REMOVED - handled by components.css */
/* @media (max-width: 768px) {
  #bottom-controls {
    bottom: 17px;
  }
  
  #map {
    bottom: calc(var(--bottom-bar-height) + 60px);
  }
  
  #map:not(.elevation-collapsed) {
    bottom: calc(var(--min-bottom-bar-height) + 60px);
  }
} */

/* Geocoder container - REMOVED - handled by components.css */
/* #geocoder-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  align-items: flex-start !important;
} */

.search-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding-left: 0 !important;
  width: 100% !important;
}

#bottom-right-controls {
  /* Positioning handled by components.css */
}


/* Override any Mapbox default positioning */
.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl-attrib {
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
}

/* When elevation is collapsed, adjust positions */
#map.elevation-collapsed ~ .mapboxgl-ctrl-bottom-left,
#map.elevation-collapsed ~ .mapboxgl-ctrl-bottom-right,
#map.elevation-collapsed ~ .mapboxgl-ctrl-logo,
#map.elevation-collapsed ~ .mapboxgl-ctrl-attrib.mapboxgl-compact {
  bottom: calc(var(--header-height) + 5px) !important;
}

/* When dragging, disable transitions */
.dragging .mapboxgl-ctrl-bottom-left,
.dragging .mapboxgl-ctrl-bottom-right,
.dragging .mapboxgl-ctrl-logo,
.dragging .mapboxgl-ctrl-attrib.mapboxgl-compact {
  transition: none !important;
}

/* Waypoint hover cursor override */
.mapboxgl-marker.waypoint-marker:hover ~ .mapboxgl-canvas,
.mapboxgl-marker.waypoint-marker:hover + .mapboxgl-canvas,
.mapboxgl-marker.waypoint-marker:hover ~ .mapboxgl-canvas-container .mapboxgl-canvas {
  cursor: pointer !important;
}

/* Force pointer cursor when waypoint is hovered */
.mapboxgl-canvas.waypoint-hover {
  cursor: pointer !important;
}

/* Geocoder input styles moved to components.css for collapsible functionality */

/* Mobile-specific fixes to prevent content from going out of bounds */
@media (max-width: 768px) {
  html, body {
    position: fixed !important;
    overflow: hidden !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
  }
  
  #map {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
  }
  
  /* Prevent any element from going out of bounds */
  * {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  
  /* Ensure fixed positioned elements stay within bounds */
  [style*="position: fixed"] {
    max-width: 100vw !important;
    max-height: 100vh !important;
  }
}

/* Progress bar styles for file parsing */
.progress-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  min-width: 300px;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 14px;
  color: var(--text-color);
  font-weight: 500;
}
