/* Bottom-left place search on Leaflet maps (half-width, above 天地图) */

.ch-map-bl {
  position: absolute;
  left: max(8px, env(safe-area-inset-left, 0px));
  /* Leave room for Leaflet attribution 「天地图」 at bottom-left. */
  bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 22px));
  z-index: 9;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  align-items: stretch;
  /* ~half map width on phone; absolute % is relative to map host. */
  width: 50%;
  max-width: 180px;
  min-width: 128px;
  pointer-events: none;
}

.ch-map-bl > * {
  pointer-events: auto;
}

.ch-map-bl .ch-map-near {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
}

.ch-map-search {
  width: 100%;
}

.ch-map-search__form {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(60, 60, 67, 0.18);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}

.ch-map-search__input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 0.86rem;
  color: #1c1c1e;
  outline: none;
}

.ch-map-search__input::placeholder {
  color: #8e8e93;
}

/* Active route: keep a single field; meta lives in title / aria. */
.ch-map-search.has-route .ch-map-search__form {
  border-color: rgba(11, 107, 203, 0.45);
}

.ch-map-search.is-busy .ch-map-search__form {
  opacity: 0.85;
}

.ch-map-search__hits {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 0;
  max-height: 160px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

.ch-map-search__hits li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  cursor: pointer;
}

.ch-map-search__hits li:hover,
.ch-map-search__hits li:focus {
  background: rgba(11, 107, 203, 0.08);
  outline: none;
}

.ch-map-search__hits strong {
  font-size: 0.84rem;
  color: #1c1c1e;
  font-weight: 600;
}

.ch-map-search__hits span {
  font-size: 0.7rem;
  color: #636366;
  line-height: 1.3;
}

.ch-map-search__hits li.is-hist strong::before {
  content: '最近 · ';
  font-weight: 500;
  color: #8e8e93;
}

.ch-map-dest {
  background: transparent;
  border: 0;
}

.ch-map-dest__pin {
  display: block;
  width: 16px;
  height: 16px;
  margin: 4px auto 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #e11d48;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.45);
}

.ch-map-dest__pin::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
}

/* Distance + ETA floating on the drive polyline midpoint */
.ch-map-route-meta {
  background: transparent !important;
  border: 0 !important;
}

.ch-map-route-meta__chip {
  display: inline-block;
  transform: translate(-50%, -120%);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  color: #0b3d6e;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(11, 107, 203, 0.35);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
  pointer-events: none;
}

body.dh-ui--night .ch-map-route-meta__chip {
  color: #dbeafe;
  background: rgba(22, 28, 36, 0.96);
  border-color: rgba(96, 165, 250, 0.4);
}

body.dh-ui--night .ch-map-search__form,
body.dh-ui--night .ch-map-search__hits {
  background: rgba(22, 28, 36, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dh-ui--night .ch-map-search__input {
  color: #f2f4f7;
}

body.dh-ui--night .ch-map-search__hits span,
body.dh-ui--night .ch-map-search__hits li.is-hist strong::before {
  color: #aeb4bc;
}
