/* Map CSS is shared by search.js and trip.js and is held separately here */
  
/* Search map container Id */
#map {
  flex: 1 0 20vh;
  margin: 0 0.3em 0.3em 0.3em;
}

#mapClusterHint {
  position: absolute;
  left: 50%;
  bottom: 4.2em;
  z-index: 1000;
  max-width: calc(100% - 2em);
  padding: 0.45em 0.8em;
  border-radius: 3px;
  border-radius: var(--borderradius);
  background-color: var(--surface-panel);
  color: var(--text-on-light);
  font-size: 80%;
  font-weight: bold;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, 0.4em);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
#mapClusterHint.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

/* When popups are bound to markers in the search map, className should be set as mapStopInfo */
.leaflet-popup.mapStopInfo .leaflet-popup-content-wrapper {
  background: var(--surface-primary);
  min-width: 300px;
  max-width: 80vw;
  overflow: hidden;
  border-radius: 8px;
}
.leaflet-popup.mapStopInfo .leaflet-popup-content {
  margin: 0px 0px 5px 0px;
  overflow: hidden;
}
.leaflet-popup.mapStopInfo .leaflet-popup-tip {
  background: var(--surface-primary);
}

/* When popups are bound to markers in the trip map, className should be set as mapTripInfo */
.leaflet-popup.mapTripInfo .leaflet-popup-content-wrapper {
  width: auto;
  min-width: 200px;
  max-width: 70vw;
  border-radius: 8px;
  background: var(--surface-primary);
}
.leaflet-popup.mapTripInfo .leaflet-popup-content {
  margin: 0px 0px 5px 0px;
}
.leaflet-popup.mapTripInfo .leaflet-popup-tip {
  background: var(--surface-primary);
}

/* Trip map container Id */
#tripMap {
  flex: 1 1 auto;
}

/* Trip map live vehicle marker */
.tripMapVehicleMarker {
  background: transparent;
  border: 0;
}
  .tripMapVehicleIcon {
    position: relative;
    width: 52px;
    height: 52px;
    cursor: pointer;
  }
    .tripMapVehicleBadge {
      position: absolute;
      left: 8px;
      top: 8px;
      width: 36px;
      height: 36px;
      z-index: 2;
    }
    .tripMapVehicleAge {
      position: absolute;
      top: 2px;
      right: 0;
      min-width: 22px;
      height: 18px;
      padding: 0 4px;
      box-sizing: border-box;
      border: 2px solid var(--accent-soft);
      border-radius: 10px;
      background-color: var(--surface-primary);
      color: var(--text-on-dark);
      font-size: 12px;
      font-weight: bold;
      line-height: 14px;
      text-align: center;
      z-index: 3;
    }
      .tripMapVehicleAge.below {
        top: auto;
        right: 0;
        bottom: 0;
      }
    .tripMapVehicleBearing {
      position: absolute;
      inset: 0;
      transform-origin: center center;
      z-index: 1;
    }
      .tripMapVehicleBearing::before {
        content: "";
        position: absolute;
        left: 20px;
        top: 0;
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-bottom: 11px solid var(--surface-primary);
        filter: drop-shadow(0 0 1px var(--accent-soft));
      }

 /* Popup window settings here, .mapStop is used as the holder in both search and trip, inner content varies */
.mapStop, .mapVehicle {
  padding: 5px 5px 0px 5px;
  position: relative;
  background-color: var(--surface-primary);
  color: var(--text-on-dark);
  border-radius: 0px 3px 3px 3px;
  font-size: 120%;
}
.leaflet-popup.mapStopInfo .mapStop {
  display: flex;
  flex-direction: column;
  max-height: 80vw;
  overflow: hidden;
}
.mapTripInfo .mapStop, .mapVehicle {
  padding: 5px 5px 5px 5px;
}

  /* Popup window header */
  .mapStopName, .mapVehicleType {
    flex: 0 0 auto;
    text-align: center;
    font-weight: bold;
    margin-bottom: 0.5em;
  }

  .mapStationName {
    flex: 0 0 auto;
    color: var(--accent-highlight);
    text-align: center;
    font-weight: bold;
    margin-bottom: 0.5em;
  }

  .mapStopRoutes {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
    scrollbar-width: thin;
  }
    .mapStopRoutes::-webkit-scrollbar {
      width: 5px;
    }
    .mapStopRoutes::-webkit-scrollbar-thumb {
      background-color: rgba(255, 255, 255, 0.35);
      border-radius: 3px;
    }
    .mapStopRoutes::-webkit-scrollbar-track {
      background: transparent;
    }

  /* Used on trip stop/vehicle popup window */
  .mapStopScheduled, .mapStopPredicted {
    text-align: left;
    font-size: 100%;
  }  

  .mapVehicleRow {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.8em;
    margin: 0.1em 0;
    font-size: 90%;
  }

  .mapVehicleLabel {
    flex: 0 0 auto;
  }

  .mapVehicleValue {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .mapVehicleSecondary {
    margin-top: 0.6em;
    padding-top: 0.6em;
    border-top: 1px solid rgba(255, 255, 255, 0.28);
  }

  .mapVehicleSecondary .mapVehicleRow {
    color: rgba(255, 255, 255, 0.85);
    font-size: 90%;
  }
  
  /* Yellow pointer arrow for stop detail at bottom of stop popup window on search page */
  .mapStopDetail {
    position: relative;
    flex: 0 0 auto;
    padding: 15px 0px 5px 0px;
  }
    .pointer {
      text-align: center;
      font-size: 10px;
      font-weight: bold;
      color: var(--surface-primary);
      width: 100px;
      height: 12px;
      position: relative;
      opacity: 0.8;
      background-color: var(--accent-highlight);
      margin: 0px auto;
    }
    .pointer::after {
      content: "";
      position: absolute;
      left: 0px;
      bottom: 0px;
      width: 0px;
      height: 0px;
      border-left: 6px solid #3A4D43;
      /*border-left: 6px solid var(--surface-primary);*/
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
    }
    .pointer::before {
      content: "";
      position: absolute;
      right: -6px;
      bottom: 0;
      width: 0;
      height: 0;
      border-left: 6px solid var(--accent-highlight);
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
    }
