body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

button {
    color: black;
  } 

#toggleDrag {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    padding: 10px 14px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 5; /* Ensure it is above the map */
    top: 80px;
    left: 5px;
    height: 44px;
}

#satnavButton {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 5; /* Ensure it is above the map */
    bottom: 10px;
    left: 10px;
    height: 44px;
}

#find-me {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 5; /* Ensure it is above the map */
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    height: 44px;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

/* Small modal for current street (above Find Me button) */
.street-modal {
  position: fixed;           /* we’ll anchor it via JS */
  display: none;             /* hidden by default */
  z-index: 9999;
  pointer-events: none;      /* so clicks go through to the map/buttons */
}

.street-modal-inner {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  line-height: 1.3;
  color: #111;
  pointer-events: auto;      /* you *can* click inside if needed later */
}

#streetLabel {
  font-weight: 600;
  margin-right: 4px;
  color: #666;
}

#streetName {
  font-weight: 500;
}

#streetViewButton {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 5; /* Ensure it is above the map */
    bottom: 10px;
    right: 10px;
    height: 44px;
}

/*#openRunTextBtn {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 5;
    top: 80px;
    right: 10px;
    height: 44px;
    display: none;
}*/

/* Removes Google default label styling */
.gm-style .gm-style-iw {
    display: none !important;
}

/* CSS for the blue dot */
.blue-dot {
    width: 16px; /* Adjust the size of the dot */
    height: 16px;
    background-color: blue;
    border-radius: 50%;
    border: 2px solid white; /* Optional: Add a white border for contrast */
}

.modal {
    display: none;
    position: fixed;
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 110px);
    background: white;
    border-radius: 5px;
    padding: 5px 5px 5px 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 8000;
    /*min-height: 50px;*/
}

.modal-content {
    position: relative;
    padding: 2px 0px 2px 0px;
}

.modal-content button {
    background-color: white;
    border: none;
}

.modal-run {
    display: none;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 110px);
    background: white;
    border-radius: 5px;
    padding: 5px 5px 5px 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 7000;
    /*min-height: 50px;*/
}

.modal-run-content {
    position: relative;
    padding: 2px 0px 2px 0px;
    display:flex;
    align-items:center; 
    justify-content:space-between;
}

.modal-run-content button {
    background-color: white;
    border: none;
}

/* Native iOS: these controls sit outside #topBar, so they need their own
   status-bar/notch offset. Web and Android keep their existing positions. */
html.native-ios .modal,
html.native-ios .modal-run {
    top: calc(10px + env(safe-area-inset-top, 0px));
}

/* -------------------------Save Run Modal-------------------------------- */
#saveRunModal {
  display: none;
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 110px);
  background-color: transparent;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Modal Content */
#saveRunModalContent {
  background-color: #fff;
  padding: 20px 30px;
  border-radius: 5px;
  width: 90%;
  max-width: 680px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  font-family: Arial, sans-serif;
}

#saveRunModalContent h3 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.5em;
  color: #333;
}

@media (orientation: portrait) {
  #saveRunModal {
    top: 6px;
    left: 0;
    right: 0;
    transform: none;
    width: 100vw;
    padding: 0 6px;
    box-sizing: border-box;
  }

  #saveRunModalContent {
    width: 100%;
    max-width: none;
    padding: 20px 18px;
    box-sizing: border-box;
  }
}

.save-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.save-type-btn {
  background-color: #f3f4f6;
  border: 1px solid #d2d6dc;
  border-radius: 6px;
  color: #333;
  cursor: pointer;
  font-size: 16px;
  padding: 10px 12px;
}

.save-type-btn.active {
  background-color: #007bff;
  border-color: #007bff;
  color: #fff;
}

/* Form Elements */
#saveRunModalContent label {
  display: block;
  margin-bottom: 5px;
  color: #555;
  font-weight: 500;
}

.save-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

#saveRunModalContent .save-folder-row label {
  margin-bottom: 0;
}

#createNewFolderLink {
  color: #111;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

#saveRunModalContent input,
#saveRunModalContent select {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.custom-folder-row {
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

#saveRunModalContent .custom-folder-row input {
  flex: 1 1 0;
  margin-bottom: 0;
  min-width: 0;
  width: auto;
}

#addNewFolderBtn,
#cancelNewFolderBtn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 14px;
  padding: 8px 12px;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .custom-folder-row {
    gap: 6px;
  }

  #addNewFolderBtn,
  #cancelNewFolderBtn {
    padding: 8px 10px;
  }
}

#addNewFolderBtn {
  background-color: #007bff;
  color: #fff;
}

#cancelNewFolderBtn {
  background-color: #e0e0e0;
  color: #333;
}

/* Button Container */
.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

/* Buttons */
.modal-buttons button {
  padding: 8px 16px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#confirmSaveRunBtn {
  background-color: #007bff;
  color: white;
}

#confirmSaveRunBtn:hover {
  background-color: #0056b3;
}

.modal-buttons button:last-child {
  background-color: #e0e0e0;
  color: #333;
}

.modal-buttons button:last-child:hover {
  background-color: #c2c2c2;
}

#folderDropdownWrapper {
    box-sizing: border-box;
    position: relative;
    font-family: Arial, sans-serif;
    margin-bottom: 10px;
    max-width: 100%;
}

#selectedFolderDisplay {
    box-sizing: border-box;
    border: 1px solid #ccc;
    padding: 8px 12px;
    background-color: #f9f9f9;
    cursor: pointer;
    border-radius: 4px;
    /*min-height: 36px;*/
    user-select: none;
    transition: background 0.2s;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

#selectedFolderDisplay:hover {
    background-color: #f0f0f0;
}

#selectedFolderDisplay.select-mode {
    background-color: transparent;
    border-color: transparent;
    color: #fff;
    cursor: default;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) 48px;
    padding: 0;
    text-align: center;
    width: 100%;
}

#selectedFolderDisplay.select-mode:hover {
    background-color: transparent;
}

.folder-picker-confirm-btn,
.folder-picker-cancel-btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.2;
    min-height: 36px;
    padding: 6px 10px;
}

.folder-picker-confirm-btn {
    background-color: #007bff;
    color: #fff;
}

.folder-picker-confirm-btn:hover {
    background-color: #0069d9;
}

.folder-picker-cancel-btn {
    background-color: #e0e0e0;
    color: #222;
    font-weight: 700;
}

.folder-picker-cancel-btn:hover {
    background-color: #cfcfcf;
}

.folder-dropdown .folder-picker-action-row {
    background: #f3f4f6;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) 48px;
    margin: 0 0 8px 0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.folder-dropdown .folder-picker-action-row .folder-picker-confirm-btn,
.folder-dropdown .folder-picker-action-row .folder-picker-cancel-btn {
    min-height: 34px;
}

.folder-dropdown .folder-picker-new-folder-row input {
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

.folder-picker-inline-add,
.folder-picker-inline-cancel {
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex: 0 0 auto;
    padding: 7px 10px;
    white-space: nowrap;
}

.folder-picker-inline-add {
    background: #007bff;
    color: #fff;
}

.folder-picker-inline-cancel {
    background: #e0e0e0;
    color: #222;
}

#folderTreeMenu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #cfd6df;
    border-radius: 6px;
    max-height: min(42dvh, 330px);
    overflow-y: auto;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
    z-index: 9999;
    padding: 6px;
    box-sizing: border-box;
}

#folderTreeMenu .folder-children {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#folderTreeMenu .folder-picker-action-row {
    background: #fff;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) 48px;
    margin: -6px -6px 6px -6px;
    padding: 6px;
    position: sticky;
    top: -6px;
    z-index: 3;
}

#folderTreeMenu .folder-depth-0 {
    --folder-bg: linear-gradient(180deg, #f9fafb 0%, #edf0f3 100%);
    --folder-border: #c5ccd5;
    --folder-accent: #111827;
    --folder-hover-border: #111827;
    --folder-hover-shadow: rgba(17, 24, 39, 0.2);
}

.folder-dropdown .folder-depth-0 {
    --folder-bg: linear-gradient(180deg, #f9fafb 0%, #edf0f3 100%);
    --folder-border: #c5ccd5;
    --folder-accent: #111827;
    --folder-hover-border: #111827;
    --folder-hover-shadow: rgba(17, 24, 39, 0.2);
}

.folder-dropdown .folder-depth-1 {
    --folder-bg: linear-gradient(180deg, #f8fbff 0%, #edf5ff 100%);
    --folder-border: #bdd7f4;
    --folder-accent: #2f80ed;
    --folder-hover-border: #2f80ed;
    --folder-hover-shadow: rgba(47, 128, 237, 0.22);
}

.folder-dropdown .folder-depth-2 {
    --folder-bg: linear-gradient(180deg, #f2fffd 0%, #dcf7f3 100%);
    --folder-border: #9fd8d1;
    --folder-accent: #00a895;
    --folder-hover-border: #00a895;
    --folder-hover-shadow: rgba(0, 168, 149, 0.24);
}

.folder-dropdown .folder-depth-3 {
    --folder-bg: linear-gradient(180deg, #fbfff4 0%, #f0f9df 100%);
    --folder-border: #c9e7a4;
    --folder-accent: #7dbb38;
    --folder-hover-border: #7dbb38;
    --folder-hover-shadow: rgba(125, 187, 56, 0.22);
}

.folder-dropdown .folder-depth-4 {
    --folder-bg: linear-gradient(180deg, #f4f8ff 0%, #e3ebf8 100%);
    --folder-border: #aebfda;
    --folder-accent: #1d3f72;
    --folder-hover-border: #1d3f72;
    --folder-hover-shadow: rgba(29, 63, 114, 0.22);
}

.folder-dropdown .folder-depth-5 {
    --folder-bg: linear-gradient(180deg, #f8f7ff 0%, #eeebff 100%);
    --folder-border: #c9c1f2;
    --folder-accent: #6f5bd6;
    --folder-hover-border: #6f5bd6;
    --folder-hover-shadow: rgba(111, 91, 214, 0.22);
}

#folderTreeMenu .folder-depth-1 {
    --folder-bg: linear-gradient(180deg, #f8fbff 0%, #edf5ff 100%);
    --folder-border: #bdd7f4;
    --folder-accent: #2f80ed;
    --folder-hover-border: #2f80ed;
    --folder-hover-shadow: rgba(47, 128, 237, 0.22);
}

#folderTreeMenu .folder-depth-2 {
    --folder-bg: linear-gradient(180deg, #f2fffd 0%, #dcf7f3 100%);
    --folder-border: #9fd8d1;
    --folder-accent: #00a895;
    --folder-hover-border: #00a895;
    --folder-hover-shadow: rgba(0, 168, 149, 0.24);
}

#folderTreeMenu .folder-depth-3 {
    --folder-bg: linear-gradient(180deg, #fbfff4 0%, #f0f9df 100%);
    --folder-border: #c9e7a4;
    --folder-accent: #7dbb38;
    --folder-hover-border: #7dbb38;
    --folder-hover-shadow: rgba(125, 187, 56, 0.22);
}

#folderTreeMenu .folder-depth-4 {
    --folder-bg: linear-gradient(180deg, #f4f8ff 0%, #e3ebf8 100%);
    --folder-border: #aebfda;
    --folder-accent: #1d3f72;
    --folder-hover-border: #1d3f72;
    --folder-hover-shadow: rgba(29, 63, 114, 0.22);
}

#folderTreeMenu .folder-depth-5 {
    --folder-bg: linear-gradient(180deg, #f8f7ff 0%, #eeebff 100%);
    --folder-border: #c9c1f2;
    --folder-accent: #6f5bd6;
    --folder-hover-border: #6f5bd6;
    --folder-hover-shadow: rgba(111, 91, 214, 0.22);
}

#folderTreeMenu .folder-item {
    --folder-depth: 0;
    --folder-indent: 0px;
    --folder-guide-left: 16px;
    position: relative;
    display: grid;
    grid-template-columns: 16px 22px minmax(0, 1fr);
    align-items: center;
    column-gap: 6px;
    min-height: 34px;
    padding: 5px 8px 5px calc(8px + var(--folder-indent));
    border-radius: 5px;
    color: #111827;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.folder-dropdown .folder-picker-row.resource-folder-tile {
    min-height: 42px;
    margin: 3px 0;
    border: 1px solid var(--folder-border, #d7dde5);
    border-left: 5px solid var(--folder-accent, #9dc4f8);
    border-radius: 7px;
    background: var(--folder-bg, linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    padding: 7px 10px !important;
    box-sizing: border-box;
    color: #111827;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.folder-dropdown .folder-picker-row.resource-folder-tile:hover {
    border-color: var(--folder-hover-border, var(--folder-accent, #9dc4f8));
    border-left-color: var(--folder-accent, #9dc4f8);
    box-shadow: 0 3px 8px var(--folder-hover-shadow, rgba(0, 0, 0, 0.1));
    transform: translateY(-1px);
}

.folder-dropdown .folder-picker-row.resource-folder-tile.selected {
    color: #0f4f95;
    font-weight: bold;
    border-width: 2px;
    border-left-width: 7px;
    border-color: var(--folder-hover-border, var(--folder-accent, #2f80ed));
    border-left-color: var(--folder-accent, #2f80ed);
    box-shadow: 0 0 0 2px rgba(47, 128, 237, 0.16), 0 3px 8px var(--folder-hover-shadow, rgba(47, 128, 237, 0.18));
}

.folder-dropdown .folder-picker-row.root-folder-tile.selected {
    color: #111827;
}

.folder-dropdown .folder-picker-row.pending-folder-tile {
    --folder-bg: linear-gradient(180deg, #f8fafc 0%, #eef1f5 100%);
    --folder-border: #cfd6df;
    --folder-accent: #8b95a1;
    --folder-hover-border: #8b95a1;
    --folder-hover-shadow: rgba(100, 116, 139, 0.18);
    color: #374151;
}

.folder-dropdown .folder-picker-row.pending-folder-tile.selected {
    color: #374151;
    border-color: #b8c0ca;
    border-left-color: #8b95a1;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.14), 0 3px 8px rgba(100, 116, 139, 0.16);
}

.folder-dropdown .folder-picker-row.resource-folder-tile > span:first-child,
.folder-dropdown .folder-picker-row.resource-folder-tile > span:nth-child(2) {
    display: none;
}

.folder-dropdown .folder-picker-row.resource-folder-tile > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 700;
}

.folder-dropdown .folder-picker-children {
    display: flex;
    flex-direction: column;
}

.folder-dropdown .folder-picker-tree {
    background: #f3f4f6;
}

#folderTreeMenu .resource-folder-tile {
    grid-template-columns: minmax(0, 1fr);
    min-height: 42px;
    margin: 3px 0;
    border: 1px solid var(--folder-border, #d7dde5);
    border-left: 5px solid var(--folder-accent, #9dc4f8);
    border-radius: 7px;
    background: var(--folder-bg, linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    padding: 7px 10px;
    box-sizing: border-box;
}

#folderTreeMenu .resource-folder-tile .folder-item-icon {
    display: none;
}

#folderTreeMenu .resource-folder-tile:hover {
    background: var(--folder-bg, linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%));
    border-color: var(--folder-hover-border, var(--folder-accent, #9dc4f8));
    border-left-color: var(--folder-accent, #9dc4f8);
    box-shadow: 0 3px 8px var(--folder-hover-shadow, rgba(0, 0, 0, 0.1));
    transform: translateY(-1px);
}

#folderTreeMenu .folder-item::before {
    content: "";
    position: absolute;
    left: var(--folder-guide-left);
    top: 0;
    bottom: 0;
    width: 1px;
    background: #d9e1ec;
    opacity: 0;
}

#folderTreeMenu .folder-item[data-depth]:not([data-depth="0"])::before {
    opacity: 0;
}

#folderTreeMenu .resource-folder-tile.selected {
    color: #0f4f95;
    font-weight: bold;
    border-width: 2px;
    border-left-width: 7px;
    border-color: var(--folder-hover-border, var(--folder-accent, #2f80ed));
    border-left-color: var(--folder-accent, #2f80ed);
    box-shadow: 0 0 0 2px rgba(47, 128, 237, 0.16), 0 3px 8px var(--folder-hover-shadow, rgba(47, 128, 237, 0.18));
}

#folderTreeMenu .root-folder-tile.selected {
    color: #111827;
}

#folderTreeMenu .pending-folder-tile {
    --folder-bg: linear-gradient(180deg, #f8fafc 0%, #eef1f5 100%);
    --folder-border: #cfd6df;
    --folder-accent: #8b95a1;
    --folder-hover-border: #8b95a1;
    --folder-hover-shadow: rgba(100, 116, 139, 0.18);
    color: #374151;
    font-weight: bold;
}

#folderTreeMenu .resource-folder-tile.pending-folder-tile.selected {
    color: #374151;
    border-width: 2px;
    border-left-width: 7px;
    border-color: #b8c0ca;
    border-left-color: #8b95a1;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.14), 0 3px 8px rgba(100, 116, 139, 0.16);
}

#folderTreeMenu .folder-item.sublevel {
    margin-left: 20px;
}

#folderTreeMenu .folder-item-twisty {
    align-items: center;
    border-radius: 4px;
    color: #64748b;
    display: none;
    font-size: 13px;
    height: 26px;
    justify-content: center;
    text-align: center;
    width: 26px;
}

#folderTreeMenu .folder-item-twisty.has-children {
    cursor: pointer;
}

#folderTreeMenu .folder-item-twisty.has-children:hover {
    background: rgba(15, 23, 42, 0.08);
}

#folderTreeMenu .folder-item-icon {
    width: 22px;
    font-size: 18px;
    line-height: 1;
    filter: saturate(0.95);
}

#folderTreeMenu .folder-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 700;
}

#folderTreeMenu .folder-item:focus-visible {
    outline: 2px solid #2f80ed;
    outline-offset: -2px;
}

/*-----------------------------------Markers----------------------------------------------------*/

#markerName {
    font-family: 'Arial', sans-serif; 
    font-size: 24px; 
    font-weight: bold; 
    color: #333; 
    margin-bottom: 0px; 
    text-align: center;
}

#markerAddress {
    font-family: 'Arial', sans-serif;
    font-size: 16px; 
    color: #555; 
    text-align: center; 
}

#runNameDisplay {
    font-family: 'Arial', sans-serif; 
    font-size: 16px; 
    font-weight: bold; 
    color: #333; 
    margin-bottom: 0px; 
    text-align: center;
}

#modalContent h2,
#modalContent p {
    margin-top: 0px;
    margin-bottom: 0px;
}

#modalContent {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#selectMarkerBtn {
    display: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-top: 5px;
    /*font-size: 24px;*/
  }  

#topBar {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding:
      calc(10px + env(safe-area-inset-top, 0px))
      env(safe-area-inset-right, 0px)
      10px
      env(safe-area-inset-left, 0px);
    box-sizing: border-box;
    background-color: transparent;
    z-index: 10;
}

#searchContainer {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#searchBar {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px; /* For the clear button */
    font-size: 16px;
    border: none;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    outline: none;
    transition: all 0.3s ease;
}

#searchBar:focus {
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#clearSearch {
    position: absolute;
    right: 65px; /* move it left so it's inside the input */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    display: none;
    color: #888;
    z-index: 2;
}

/* Search Results Container Positioned Below the Search Bar */
#searchResults {
    position: absolute;
    top: calc(100% - 9px); /*gap from search bar*/
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    /*border: 1px solid #ccc;
    border-top: none;*/
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-family: 'Arial', sans-serif;
  }
  
  /* Individual Result Item */
  .resultItem {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border-bottom: 1px solid #eee;
  }
  
  .resultItem:last-child {
    border-bottom: none;
  }
  
  .resultItem:hover {
    background-color: #007BFF;
    color: #fff;
  }

  .resultItem:hover .resultAddress {
    color: #fff;
}

  .resultAddress {
    color: #777;
}
  
  /* Optional: Message for no results */
  #searchResults.empty {
    padding: 10px;
    text-align: center;
    color: #777;
  }

  /* Street result entries in search — styled differently */
.resultItem.streetResult {
    font-style: italic;
    color: #777;
}

.resultItem.streetResult:hover {
    background-color: #007BFF;
    color: #fff;
  }

  #toggle-markers, #toggle-toolbars {
    padding: 10px 15px;
    margin: 0 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    height: 44px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

 /*--------------------------------------------------------------------------------------*/
 
 #toolbar-right {
    position: absolute;
    top: 80px;
    right: 0px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 10px; /* space between buttons */
    background: transparent;
    padding: 8px 5px;
    border-radius: 10px;
}

html.native-ios #toolbar-right {
    top: calc(80px + env(safe-area-inset-top, 0px));
}

/* Resources, My Runs and My Bike Lists share this generated modal. Its
   portrait rules use !important, so this more-specific native-iOS rule keeps
   the panel between the status bar/notch and the home indicator. */
html.native-ios body #runsListModal.resources-list-modal {
    top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    max-height: calc(
      100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    ) !important;
}

#toolbar-right button {
    display: flex;              
    align-items: center;          
    justify-content: center;      
    padding: 10px 7px;                
    background: rgba(255,255,255,0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 18px;              
    border-radius: 5px;
    position: relative;
    line-height: 1;               
}

#toolbar-bottom {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    background: transparent;
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    max-width: 100vw;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#toolbar-bottom button {
    padding: 10px 15px;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 16px;
    border-radius: 5px;
    position: relative; 
}

@media (max-width: 600px) {
    #toolbar-bottom {
        left: 0;       
        right: 0;  
        transform: none;        
        margin: auto;
        gap: 5px; /* smaller space between buttons */
        padding: 6px 8px; /* smaller toolbar padding */
    }

    #toolbar-bottom button {
        padding: 10px 12px; /* smaller button padding */
        font-size: 18px; /* smaller text size */
    }
}

#clear-button,
#clear-line-ab-button {
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE10+/Edge */
    pointer-events: auto;
}

#toolbar-lines {
    display: none;
}

#toolbar-lines button.active,
#toolbar-lines button.selected {
    background: navy !important;
    color: white !important;
    border-color: navy !important;
}

/* Highlight selected button (NAVY BLUE) */
.selected {
    background: navy;
    color: white;
    border-color: navy;
}

#distance-display {
    color: red;
    font-size: 13px !important;
}

#distance-display-2 {
    color: purple;
    font-size: 13px !important;
}

/* ------------------------------------------------------------------------------------ */

/* Make checkbox rows use the same "button face" font */
#pin-filter-menu {
  font-family: Arial, sans-serif;
  font-size: 14px; 
}

#pin-filter-menu label,
#pin-filter-menu input[type="checkbox"] {
  font: inherit;   /* inherit the container’s font family & size */
  color: black;    /* matches your global button color */
}

#pin-filter-menu {
  display: none;
  position: absolute;
  z-index: 9000;
  background: white;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  overflow: hidden;
  width: 200px;
}

#pin-filter-menu label {
  display: flex;                 /* lays out checkbox + text on one row */
  align-items: center;
  gap: 10px;                     /* space between checkbox and text */
  width: 100%;
  padding: 10px 16px;
  background: white;
  border: none;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  line-height: 1.2;
  user-select: none;
}

/* hover like buttons */
#pin-filter-menu label:hover {
  background-color: #f0f0f0;
}

/* remove the last divider */
#pin-filter-menu label:last-of-type {
  border-bottom: none;
}

/* checkbox spacing + optional accent color (supported in modern browsers) */
#pin-filter-menu input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;                     /* let gap handle spacing */
  accent-color: #2b7cff;         /* optional: theme color for the tick */
}

/*------------------------------------------------------------------------------------------------------*/

#toolbar-menu {
    display: none;
    position: absolute;
    z-index: 9999;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    overflow: hidden;
    width: 200px;
}

#toolbar-menu button {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 10px 15px;
    width: 100%;
    background: white;
    border: none;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    text-align: left;
}

#auto-route-button:not(.active) {
    color: #075985;
}

.auto-route-panel {
    position: fixed;
    top: 82px;
    right: 76px;
    z-index: 10020;
    width: min(410px, calc(100vw - 100px));
    box-sizing: border-box;
    padding: 14px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.28);
    font-family: Arial, sans-serif;
}

.auto-route-panel[hidden] {
    display: none;
}

.auto-route-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.auto-route-panel h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.auto-route-panel-body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.auto-route-panel p {
    margin: 0;
}

.auto-route-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.auto-route-close,
.auto-route-minimise {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
}

.auto-route-collapsed-summary {
    display: none;
    color: #334155;
    font-size: 14px;
    white-space: nowrap;
}

.auto-route-panel.collapsed {
    width: auto;
    min-width: 220px;
    padding: 10px 12px;
}

.auto-route-panel.collapsed .auto-route-panel-body,
.auto-route-panel.collapsed .auto-route-close {
    display: none;
}

.auto-route-panel.collapsed .auto-route-collapsed-summary {
    display: block;
}

.auto-route-panel.collapsed .auto-route-panel-header {
    align-items: center;
}

.auto-route-panel.collapsed h2 {
    margin: 0 0 2px;
    font-size: 16px;
}

.auto-route-actions button {
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-weight: 600;
}

.auto-route-vias {
    margin-top: 8px;
}

.auto-route-vias-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

#autoRouteAddVia {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-weight: 600;
}

#autoRouteAddVia .material-symbols-outlined {
    font-size: 19px;
}

#autoRouteAddVia.selected {
    border-color: #c2410c;
    background: #fff7ed;
    color: #9a3412;
}

.auto-route-via-empty {
    margin-top: 7px !important;
    color: #64748b;
    font-size: 13px;
    line-height: 1.3;
}

.auto-route-via-list {
    display: grid;
    gap: 5px;
    margin: 7px 0 0;
    padding: 0;
    list-style: none;
}

.auto-route-via-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 32px;
    padding: 3px 4px 3px 8px;
    border-radius: 7px;
    background: #fff7ed;
    color: #7c2d12;
    font-size: 14px;
    font-weight: 600;
}

.auto-route-via-list button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #9a3412;
    cursor: pointer;
    font-size: 19px;
}

.auto-route-clear-vias {
    margin-top: 6px;
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: #9a3412;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

.via-point-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    box-sizing: border-box;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #ea580c;
    color: #fff;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.42);
    font: 700 13px/1 Arial, sans-serif;
}

.maplibregl-canvas.placing-via-point {
    cursor: crosshair;
}

.auto-route-correction {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.auto-route-correction [hidden] {
    display: none !important;
}

.auto-route-correction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

#autoRouteCorrectSection {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    cursor: pointer;
    font-weight: 700;
}

#autoRouteCorrectSection .material-symbols-outlined {
    font-size: 19px;
}

.auto-route-correction-help {
    margin-top: 7px !important;
    color: #64748b;
    font-size: 13px;
    line-height: 1.3;
}

.auto-route-correction-drawing-actions,
.auto-route-correction-editor-actions,
.auto-route-saved-correction,
.auto-route-applied-correction {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.auto-route-correction-drawing-actions button,
.auto-route-correction-editor-actions button,
.auto-route-saved-correction button,
.auto-route-applied-correction button {
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

#autoRouteCorrectionApply,
#autoRouteUseSavedCorrection {
    border-color: #166534;
    background: #166534;
    color: #fff;
}

.auto-route-correction-editor {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px 8px;
    align-items: center;
    margin-top: 9px;
    padding: 9px;
    border-radius: 8px;
    background: #fffbeb;
    font-size: 13px;
}

.auto-route-correction-editor input[type="text"],
.auto-route-correction-editor select {
    min-width: 0;
    min-height: 32px;
    box-sizing: border-box;
    padding: 5px 7px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    font: inherit;
}

.auto-route-remember-correction,
.auto-route-correction-editor-actions {
    grid-column: 1 / -1;
}

.auto-route-remember-correction {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.3;
}

.auto-route-saved-correction,
.auto-route-applied-correction {
    padding: 7px;
    border-radius: 7px;
    background: #ecfdf5;
    color: #14532d;
    font-size: 12px;
    font-weight: 700;
}

.maplibregl-canvas.drawing-taxi-correction {
    cursor: crosshair;
}

.taxi-correction-point-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    box-sizing: border-box;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #f59e0b;
    color: #422006;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.48);
    font: 800 13px/1 Arial, sans-serif;
}

.taxi-correction-point-marker.start {
    background: #16a34a;
    color: #fff;
}

.taxi-correction-point-marker.end {
    background: #dc2626;
    color: #fff;
}

.auto-route-status {
    margin-top: 10px !important;
    color: #334155;
    font-size: 14px;
    line-height: 1.35;
}

.auto-route-status:empty {
    display: none;
}

.auto-route-status.error {
    color: #b91c1c;
}

.auto-route-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

#autoRouteUse {
    border-color: #166534;
    background: #166534;
    color: #fff;
}

#autoRouteUse:disabled {
    cursor: wait;
    opacity: 0.5;
}

@media (max-width: 700px) {
    .auto-route-panel {
        top: auto;
        right: 10px;
        left: 10px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .auto-route-panel-body {
        max-height: min(62vh, 520px);
    }

    .auto-route-panel.collapsed {
        left: auto;
        min-width: min(230px, calc(100vw - 20px));
    }

    .auto-route-actions button {
        font-size: 13px;
    }

    .auto-route-via-list {
        max-height: 110px;
        overflow-y: auto;
    }
}

#toolbar-menu button[hidden],
#toggleDrag[hidden] {
    display: none !important;
}

#toolbar-menu button:hover {
    background-color: #f0f0f0;
}

#runInfoModal {
  user-select: none; /* Disable text selection */
  -webkit-user-select: none; /* For Safari */
  -ms-user-select: none; /* For IE/Edge */
}

#runTextTitle {
    cursor: pointer;
}

#runTextTitle::-webkit-scrollbar {
            display: none;
        }

#runTextInput {
  overflow: auto;                /* make it the scroller */
  max-height: calc(100% - 56px); /* leave room for your sticky header; tweak 56px */
}

.run-text-close {
  position: relative;
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  touch-action: manipulation;
}

.native-run-text-print-preview {
  position: fixed;
  inset: 0;
  z-index: 30000;
  box-sizing: border-box;
  overflow: auto;
  padding: 12px;
  background: #fff;
  color: #111;
  font: 16pt Arial, sans-serif;
  -webkit-overflow-scrolling: touch;
}

.native-print-actions {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -12px -12px 18px;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid #d8dee8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.native-print-actions button {
  min-width: 108px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid #b8c5d8;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font: 600 18px Arial, sans-serif;
  touch-action: manipulation;
}

.native-print-actions .native-print-now {
  background: #126b37;
  border-color: #126b37;
  color: #fff;
}

.native-print-header {
  margin: 0 0 8mm;
  text-align: center;
  font-size: 18pt;
  font-weight: 600;
}

.native-print-content {
  line-height: 1;
}

.native-print-content .row {
  display: table;
  width: 100%;
  table-layout: fixed;
  margin-bottom: 2mm;
  break-inside: avoid;
  page-break-inside: avoid;
}

.native-print-content .cell {
  display: table-cell;
  vertical-align: top;
  padding: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  text-transform: none !important;
}

.native-print-content .cell:first-child {
  width: 35%;
  padding-right: 4mm;
}

.native-print-content .cell:last-child {
  width: 65%;
}

.native-print-content .italic-cell {
  font-style: italic;
}

@media print {
  body.native-print-preview-open > *:not(#nativeRunTextPrintPreview) {
    display: none !important;
  }

  body.native-print-preview-open #nativeRunTextPrintPreview {
    position: static;
    inset: auto;
    overflow: visible;
    padding: 0;
  }

  body.native-print-preview-open .native-print-actions {
    display: none !important;
  }
}

/*------------------------------coach marks tour----------------------------------------------*/

.coach-tour {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: auto;
    font-family: Arial, sans-serif;
}

.coach-tour-spotlight {
    position: fixed;
    top: var(--coach-top, 16px);
    left: var(--coach-left, 16px);
    width: var(--coach-width, 80px);
    height: var(--coach-height, 52px);
    border: 3px solid #0d7cff;
    border-radius: 14px;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.58),
        0 0 22px rgba(13, 124, 255, 0.7);
    pointer-events: none;
    transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.coach-tour-card {
    position: fixed;
    left: 50%;
    top: var(--coach-card-top, 120px);
    transform: translateX(-50%);
    width: min(430px, calc(100vw - 28px));
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(21, 42, 60, 0.12);
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
    color: #18324a;
    padding: 16px;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
}

.coach-tour-card h2 {
    font-size: 22px;
    margin: 0 0 8px;
}

.coach-tour-card p {
    color: #51677b;
    font-size: 15px;
    line-height: 1.45;
    margin: 0;
}

.coach-tour-progress {
    color: #6b7f91;
    font-size: 13px;
    font-weight: 700;
    margin-top: 12px;
}

.coach-tour-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px;
}

.coach-tour-actions button {
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    min-height: 38px;
    padding: 9px 13px;
}

.coach-tour-button-primary {
    background: #007bff;
    color: white;
}

.coach-tour-button-secondary {
    background: #eef3f8;
    color: #18324a;
}

.coach-tour-button-ghost {
    background: transparent;
    color: #51677b;
}

@media (max-width: 560px) {
    .coach-tour-actions {
        justify-content: stretch;
    }

    .coach-tour-actions button {
        flex: 1 1 auto;
    }
}
