/* css/style.css */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 40;
  background: rgba(255,255,255,0.9);
  padding: 8px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: 80%;
}

.toolbar .toolbar-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar button, .toolbar select, .toolbar input {
  margin: 0;
  padding: 3px 6px;
  font-size: 12px;
}

.toolbar label.basemap-label {
  margin-right: 4px;
  font-weight: bold;
}

.auth-button {
  background-color: #0078D7;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}

.auth-button:hover {
  background-color: #005a9e;
}

.auth-section-upper-right {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
}

#routeTip {
  font-style: italic;
  color: #555;
}

.autocomplete-container {
  position: relative;
  width: 200px;
}

#searchInput {
  width: 100%;
  padding: 3px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.suggestions-list li {
  padding: 5px;
  cursor: pointer;
}

.suggestions-list li:hover {
  background: #f0f0f0;
}

.google-attribution {
  font-size: 10px;
  margin-top: 2px;
  color: #555;
}

.marker {
  background-color: #0078D7;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #fff;
  color: #fff;
  text-align: center;
  line-height: 18px;
  font-size: 10px;
  cursor: pointer;
  user-select: none;
}

.waypoint-marker {
  background-color: #0078D7;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #fff;
  cursor: pointer;
  user-select: none;
}

.place-marker {
  background-color: #FF5733;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #fff;
  cursor: pointer;
  user-select: none;
}

.route-handle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  pointer-events: auto;
  cursor: default !important;
}

.route-dot-handle {
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #0078D7;
  border-radius: 50%;
  cursor: grab;
  pointer-events: auto;
}

.route-dot-handle.grabbing {
  cursor: grabbing !important;
}

.miles-display {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 30;
  background: rgba(255,255,255,0.9);
  padding: 5px;
  border-radius: 4px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  display: none;


  /* make height relative to viewport, scroll when content exceeds */
  max-height: 60vh;   /* e.g. 60% of viewport height */
  overflow-y: auto;

  /* keep the bottom edge fixed so it grows up */
  transform-origin: bottom left;
}

.miles-display thead {
  position: sticky;
  top: 0;
  background: #fff;
}

.floating-dialog {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: #fff;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 10px;
  display: none;
  max-width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.floating-dialog h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.floating-dialog ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.floating-dialog ul li {
  margin: 4px 0;
  padding: 2px 4px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.floating-dialog ul li:hover {
  background: #f0f0f0;
}

.floating-dialog button {
  margin-top: 8px;
  padding: 3px 6px;
  font-size: 12px;
}

.delete-route, .delete-place {
  background: transparent;
  border: none;
  color: red;
  font-weight: bold;
  cursor: pointer;
  margin-left: 10px;
}

.streetview-marker {
  position: relative;
  background-color: #FFFF00;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: grab;
}

.streetview-marker:after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: #FFFF00 transparent transparent transparent;
}

.photo-marker {
  background-color: #FFD700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
}

.photo-popup img {
  max-width: 200px;
  max-height: 200px;
}

.miles-display table {
  width: 100%;
  border-collapse: collapse;
}

.miles-display th, .miles-display td {
  padding: 6px;
  text-align: left;
}

.miles-display th {
  border-bottom: 2px solid #333;
}

.miles-display tr:not(:last-child) td {
  border-bottom: 1px solid #ccc;
}

.miles-display tr.total {
  font-weight: bold;
}

.edit-place-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-place-form label {
  font-size: 12px;
}

.edit-place-form input,
.edit-place-form select,
.edit-place-form textarea {
  font-size: 12px;
  padding: 3px;
}

.edit-place-form textarea {
  resize: vertical;
  height: 60px;
}

/* --- Theme colors --- */
.toolbar-section.route-controls button {
  background-color: #0078D7;
  color: white;
}

.toolbar-section.places-controls button {
  background-color: #28a745;
  color: white;
}

.toolbar-section.photos-controls button {
  background-color: #FFD700;
  color: black;
}

/* Street View icon button */
.streetview-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 8px;
  cursor: pointer;
}

.streetview-button svg {
  width: 20px;
  height: 20px;
  fill: #555;
}

.streetview-marker {
  width: 20px;
  height: 20px;
  cursor: grab;
}

.streetview-marker svg {
  width: 20px;
  height: 20px;
  fill: #555;
}

.streetview-marker.active svg {
  fill: #0078D7;
}

/* Share-route icon button */
.share-route {
  background: transparent;
  border: none;
  cursor: pointer;
  margin-left: 6px;
  font-size: 1.1em;
  color: inherit;
}

.share-route:hover {
  color: #0078D7;
}

.place-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

#addGroupBtn {
  display: block;
  margin-bottom: 8px;
  padding: 2px 6px;
  font-size: 12px;
}

#groupsList li {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
}

#groupsList li:hover {
  background: #f0f0f0;
}

/* Highlight folder on drag-over */
#groupsList li.drag-over {
  background-color: #e0f7fa; /* Light cyan */
}

/* Make place items draggable */
#placesList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px;
  cursor: grab;
}

#placesList li.dragging {
  opacity: 0.4;
}

/* Smaller, tighter place-list items */
#placesList li {
  padding: 2px 4px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
}

#placesList li button {
  font-size: 10px;
  margin-left: 4px;
}

/* Ensure all li-buttons (zoom/edit/delete) are small and inline */
#placesList li > button {
  padding: 0 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
}

#placesList li.selected {
  background-color: #e0e0e0;
  font-weight: bold;
}

@media (pointer: coarse) {
  /* On touch devices: make targets bigger */
  .marker, .waypoint-marker, .place-marker {
    width: 30px;
    height: 30px;
  }
  /* Switch hover tooltips off */
  .toolbar button:hover { /* no-op */ }
}

/* Two-column layout for the My Places dialog */
#placesDialogContent {
  display: flex;
  gap: 12px;
  max-height: calc(80vh - 60px); /* Adjust for header+buttons */
  overflow: hidden;
}

.places-column {
  flex: 2;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid #ddd;
  padding-right: 8px;
}

.groups-column {
  flex: 2;
  max-height: 60vh;
  overflow-y: auto;
}

#addGroupBtn {
  display: block;
  margin-bottom: 8px;
  padding: 2px 6px;
  font-size: 12px;
}

#groupsList li {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  align-items: center;
  padding: 4px;
  cursor: pointer;
}

#groupsList li .folder-icon {
  margin-right: 6px;
  font-size: 1.1em;
}

#groupsList li.drag-over {
  background-color: #e0f7fa;
}

/* Tighter, smaller place-list items */
#placesList li {
  padding: 2px 4px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
}

#placesList li.dragging {
  opacity: 0.4;
}

#placesList li > button {
  padding: 0 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  margin-left: 4px;
}

/* Styles for shared (read-only) groups */
.shared-group {
  opacity: 0.6;
  cursor: default;
}

.shared-group .delete-group,
.shared-group .share-group,
.shared-group .place-actions button {
  display: none;
}

/* Prevent drag-over highlighting for shared groups */
#groupsList li.shared-group.drag-over {
  background-color: inherit; /* Override the drag-over highlight */
}

/* Disable dragging in read-only mode */
#placesList.drag-disabled li {
  cursor: default;
  pointer-events: none;
}

#placesList.drag-disabled li button {
  pointer-events: auto; /* Allow clicking zoom if desired */
}

/* Mobile (pointer:coarse) tweaks */
@media (pointer: coarse) {
  .marker, .waypoint-marker, .place-marker {
    width: 30px;
    height: 30px;
  }
  /* Disable hover effects on mobile */
  button:hover { /* no-op */ }
}

.save-stops {
  background: transparent;
  border: none;
  cursor: pointer;
  margin-left: 6px;
  font-size: 1.1em;
  color: inherit;
}


/* Share-group icon next to each folder */
.share-group {
  background: transparent;
  border: none;
  color: #0078D7;
  font-size: 12px;
  margin-left: 6px;
  cursor: pointer;
  font-size: 10px;
  margin-left: 6px;
}

.share-group:hover {
  color: #0078D7;
}

/* Make the red "delete group" ✕ visible */
.delete-group {
  background: transparent;
  border: none;
  color: red;
  cursor: pointer;
  font-size: 10px;
  margin-left: 6px;
}

/* Style for the "Remove" button on shared groups */
.remove-shared-group {
  background: transparent;
  border: none;
  color: #666; /* Gray to distinguish from the red delete button */
  cursor: pointer;
  font-size: 10px;
  margin-left: 6px;
}

.remove-shared-group:hover {
  color: #333; /* Darker gray on hover */
}

/* Container for sharedWith badges and buttons */
.shared-with-container {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  flex-wrap: wrap;
}

/* Style for sharedWith badges */
.shared-with-badge {
  background-color: #e0e0e0;
  color: #333;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
}

/* Style for unshare buttons */
.unshare-user {
  background: transparent;
  border: none;
  color: #ff4444; /* Same red as delete button */
  cursor: pointer;
  font-size: 10px;
  padding: 0 4px;
}

.unshare-user:hover {
  color: #cc0000;
}

/* Style for Unshare All button */
.unshare-all {
  background: transparent;
  border: none;
  color: #ff4444;
  cursor: pointer;
  font-size: 10px;
  padding: 0 4px;
}

.unshare-all:hover {
  color: #cc0000;
  text-decoration: underline;
}

/* Add to style.css */

/* Widen the dialog */
#savedPlacesDialog {
  width: 600px; /* Increased width to accommodate shared user names */
}

/* Style the unshare button differently */
.unshare-user {
  color: #ff9800; /* Orange color to differentiate from delete (red) */
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  margin-left: 5px;
}

/* Ensure shared-with-container doesn't require horizontal scrolling */
.shared-with-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.shared-with-badge {
  background-color: #e0e0e0;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 12px;
}

/* RIDB Campsites toggle button 
.toolbar-section.ridb-controls button {
  background-color: #1E90FF;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 12px;
}
*/

.mapboxgl-ctrl.route-info ul#stopsList li {
  /* one stop per line, no wrapping */
  /* ensure only your manual “1.” appears */
  list-style: none;
  white-space: nowrap;
}
/* Group checkboxes styling */
#groupSelectControls {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

#groupsList li {
  display: flex;
  align-items: center;
}

#groupsList li input[type="checkbox"] {
  margin-right: 6px;
}
.mapboxgl-ctrl.route-info {
  position: fixed;
  top: 100px;
  right: 10px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: auto;
  resize: both;           /* always show a two-way resize handle */
  box-sizing: border-box; /* include borders/padding in the size so the handle remains clickable */
  min-width: 200px;
  min-height: 120px;     /* enough for ~10 stops + header */
  max-width: 80vw;
  max-height: 80vh;
  background: rgba(255,255,255,0.95);
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: default;
  padding: 0;
}

.mapboxgl-ctrl.route-info .route-info-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Optional: make drag handle clearer */
.mapboxgl-ctrl.route-info:before {
  content: '⇕';
  font-size: 10px;
  color: #999;
  display: block;
  text-align: center;
  margin-bottom: 4px;
  cursor: move;
}
.mapboxgl-ctrl.route-info ul#stopsList {
  flex: 1;          /* fills remaining space */
  min-height: 0;    /* allow flex‐shrink */
  overflow-y: auto; /* always scrollable */
  list-style: none;
  padding-left: 0;
  margin-left: 0;

}

#routeInfoTitle {
  font-size: 14px;
  font-weight: bold;
  padding: 8px;
  background: #f7f7f7;
  cursor: move;
  user-select: none;
}
.streetview-button {
  display: flex;
  align-items: center;
  gap: 4px;
}

.streetview-label {
  font-size: 12px;
  color: #333;
  padding-left: 2px;
}

.streetview-hint {
  font-size: 12px;
  color: #444;
  margin-top: 4px;
  margin-left: 6px;
  font-style: italic;
}
