/* OpenStreetMap (MapLibre GL JS) */
.osm-map {
  width: 100%;
  height: 300px;
  background-color: rgb(0 0 0 / 3%);
  border-radius: 12px;
  overflow: hidden;
}
.osm-map-sm {
  height: 190px;
}
.osm-autocomplete {
  position: absolute;
  z-index: 1000;
  display: none;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e1e6eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
}
.osm-autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
}
.osm-autocomplete-item:hover,
.osm-autocomplete-item.active {
  background: #f0f2f5;
}
body.night-mode .osm-autocomplete {
  background: #2d3345;
  border-color: #3a4154;
  box-shadow: 0 4px 16px rgb(0 0 0 / 40%);
}
body.night-mode .osm-autocomplete-item:hover,
body.night-mode .osm-autocomplete-item.active {
  background: #3a4154;
}
body.night-mode .osm-map {
  background-color: rgb(255 255 255 / 6%);
}

/* Скрываем блок атрибуции (копирайт MapLibre / OpenStreetMap)
   на всех картах сайта */
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib {
  display: none !important;
}

/* Google Maps style: two-finger pan on touch devices --------------------- */

/* нужен позиционирующий контекст для абсолютной подсказки */
.osm-map {
  position: relative;
}

/* MapLibre ставит маркеры через transform от (0,0) контейнера и
   в CSS библиотеки задаёт position:absolute. Любой position:relative
   на .maplibregl-marker (inline-стиль или тема) оставляет маркеры
   в потоке — точки и подписи «съезжают» с линии геомаршрута. */
.osm-map .maplibregl-marker {
  position: absolute !important;
  top: 0;
  left: 0;
}

/* скрываем встроенный англоязычный оверлей MapLibre (cooperative
   gestures) — вместо него своя мультиязычная подсказка ниже;
   touch-action: pan-x pan-y при этом остаётся (нативный скролл) */
.osm-map .maplibregl-cooperative-gesture-screen {
  display: none !important;
}

/* плашка «Перемещайте карту двумя пальцами» — в стиле Google Maps */
.osm-map-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 96px);
  padding: 9px 15px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgb(24 26 33 / 88%);
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 35%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.osm-map-hint-show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.osm-map-hint-icon {
  flex-shrink: 0;
  opacity: 0.92;
}

/* Fullscreen: native API (:fullscreen) and CSS fallback for Telegram/iOS */
.osm-map:fullscreen,
.osm-map:-webkit-full-screen,
.osm-map.osm-map-is-fullscreen {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background-color: #e8e8e8;
}
.osm-map.osm-map-is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 2147483646;
}
.osm-map:fullscreen .osm-map-hint,
.osm-map:-webkit-full-screen .osm-map-hint,
.osm-map-is-fullscreen .osm-map-hint {
  display: none !important;
}
.osm-map:fullscreen .maplibregl-ctrl-top-right,
.osm-map:-webkit-full-screen .maplibregl-ctrl-top-right,
.osm-map-is-fullscreen .maplibregl-ctrl-top-right {
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
}
html.osm-map-fullscreen-open,
body.osm-map-fullscreen-open {
  overflow: hidden !important;
}
