/* ============================================
   Карта — табы городов
   ============================================ */

.map-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.map-tab {
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: var(--bg-light);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.map-tab:active {
  transform: scale(0.96);
}

.map-tab:hover { background: var(--bg-light); }

.map-tab.active {
  background: var(--accent);
  color: #fff;
}

/* Оверлей для мобильного скролла — скрыт на десктопе */
.map-touch-overlay {
  display: none;
}

/* ============================================
   Карта — контейнер и слои
   ============================================ */

.map-content {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 32px;
  height: 700px;
}

.map-content__map {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: var(--bg-map);
}

.map-image-wrapper {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

.map-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================
   Карта — анимация загрузки
   ============================================ */


/* ============================================
   Карта — пины
   ============================================ */

.map-pins {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 6px 10px;
  gap: 4px;
  background: #fff;
  box-shadow: var(--shadow-pin);
  border-radius: 12px;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.map-pin::after { display: none; }
.map-pin > * { position: relative; z-index: 1; }

.map-pin:hover {
  transform: translate(-50%, -50%) scale(1.01);
  box-shadow: var(--shadow-pin-hover);
}

.map-pin__icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.map-pin__discount {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  line-height: 18px;
  font-feature-settings: 'pnum' on, 'lnum' on;
  color: #000000;
  white-space: nowrap;
}

.map-pin-dot {
  position: absolute;
  width: 8px; height: 8px;
  background: #000000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

/* ============================================
   Карта — Яндекс Карта
   ============================================ */

.yandex-map {
  width: 100%;
  height: 700px;
  border-radius: 24px;
  overflow: hidden;
}

/* Стилизация тайлов карты в цветах сайта (фиолетовый/серый) */
.yandex-map [class*="ground-pane"] {
  filter: grayscale(1) sepia(0.15) hue-rotate(210deg) brightness(1.04) contrast(0.92);
}

.yandex-map .ymaps-2-1-79-inner-panes,
.yandex-map .ymaps-2-1-79-map {
  height: 100%;
}

.yandex-map ymaps,
.yandex-map [class*="ymaps"] {
  font-family: 'YS Text', sans-serif !important;
}

.yandex-map .ymaps-2-1-79-copyright,
.yandex-map .ymaps-2-1-79-map-copyrights-promo,
.yandex-map .ymaps-2-1-79-controls__toolbar,
.yandex-map .ymaps-2-1-79-float-button,
.yandex-map [class*="copyrights"],
.yandex-map [class*="copyright"],
.yandex-map [class*="promo"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Скрыть hint (label) при наведении на пин */
.yandex-map [class*="hint"] {
  display: none !important;
}

/* Кастомный пин для Яндекс Карты */
.custom-hotel-pin {
  position: relative;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.custom-hotel-pin__content {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 6px 10px;
  gap: 4px;
  width: max-content;
  box-sizing: border-box;
  background: #fff;
  box-shadow: var(--shadow-pin);
  border-radius: 12px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.custom-hotel-pin:hover .custom-hotel-pin__content {
  transform: scale(1.05);
  box-shadow: var(--shadow-pin-hover);
}

.custom-hotel-pin__discount {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  line-height: 18px;
  font-feature-settings: 'pnum' on, 'lnum' on;
  color: #000000;
  white-space: nowrap;
}

.custom-hotel-pin__icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

/* ============================================
   Карта — балуны Яндекс Карты
   ============================================ */

.ymaps-2-1-79-balloon {
  font-family: var(--font-body, 'YS Display', 'Helvetica Neue', Arial, sans-serif);
}

.yandex-map .ymaps-2-1-79-balloon__layout {
  background: #fff;
  border: none;
  outline: none;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  padding: 0;
  overflow: visible;
}

.yandex-map .ymaps-2-1-79-balloon__tail {
  left: 50%;
  transform: translateX(-50%);
}

.ymaps-2-1-79-balloon__content { padding: 16px; }

.ymaps-2-1-79-balloon__close {
  width: 24px; height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 6L6 18M6 6L18 18' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0.6;
}

.ymaps-2-1-79-balloon__close:hover { opacity: 1; }

.yandex-map-hotel-balloon {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.yandex-map-hotel-balloon__title {
  font-family: var(--font-heading, 'YS Display', 'Helvetica Neue', Arial, sans-serif);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text-primary, #000);
}

.yandex-map-hotel-balloon__discount {
  font-family: var(--font-body, 'YS Display', 'Helvetica Neue', Arial, sans-serif);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-primary, #000);
}

/* ============================================
   Карта — сниппеты отелей (справа)
   ============================================ */

.map-content__hotels {
  position: absolute;
  top: 0; right: 0;
  width: 360px;
  display: flex;
  padding: 8px 8px 8px 0;
  flex-direction: column;
  gap: 4px;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 3000;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.map-content__hotels::-webkit-scrollbar { display: none; }

.hotel-snippets-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hotel-snippet {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.hotel-snippet:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.hotel-snippet:active { transform: scale(0.98); }

.hotel-snippet--more {
  cursor: default;
  background: #F5F5F5;
}

.hotel-snippet--more:hover,
.hotel-snippet--more:active {
  box-shadow: none;
  transform: none;
}

.hotel-snippet--more .hotel-snippet__name {
  margin-bottom: 0;
  color: var(--text-primary);
  opacity: 0.8;
}

.hotel-snippet__name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hotel-snippet__badge-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hotel-snippet__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: #000000;
  color: #fff;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.hotel-snippet__discount {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  font-feature-settings: 'pnum' on, 'lnum' on;
}

.hotel-snippet__details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hotel-snippet__price {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-primary);
}

/* Маркеры и кластеры */
.hotel-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: var(--font-ui);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}

.hotel-marker:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hotel-marker__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: #000;
}

.hotel-marker__icon svg { width: 100%; height: 100%; display: block; }

.hotel-marker__discount {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #000000;
}

.hotel-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--accent);
  border-radius: 20px;
  box-shadow: var(--shadow-accent);
  font-family: var(--font-ui);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}

.hotel-cluster:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent-hover);
}

.hotel-cluster__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: #fff;
}

.hotel-cluster__icon svg { width: 100%; height: 100%; display: block; }

.hotel-cluster__count {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

/* ============================================
   Карта — мобильная карусель отелей
   ============================================ */

.map-carousel {
  display: none;
}

/* ============================================
   Карта — адаптация (≤ 760px)
   ============================================ */

@media (max-width: 760px) {
  .map-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .map-tabs::-webkit-scrollbar { display: none; }

  .map-tab {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .map-content {
    height: 70vh;
    max-width: 100%;
    width: 100%;
  }

  .map-content__map {
    width: 100%;
    height: 100%;
    margin-bottom: 0;
    border-radius: 0;
  }

  .map-image { height: 100%; }

  .map-pin {
    padding: 5px 8px;
    gap: 3px;
    z-index: 100;
  }

  .map-pin__icon { width: 12px; height: 12px; }

  .map-pin__discount {
    font-size: 12px;
    line-height: 16px;
  }

  .yandex-map {
    height: 100%;
    border-radius: 0;
    touch-action: pan-y;
  }

  .map-touch-overlay {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2999;
    touch-action: pan-y;
    background: transparent;
  }

  .map-content__hotels { display: none; }

  .hotel-snippet {
    min-width: 240px;
    flex-shrink: 0;
  }

  .hotel-marker { padding: 5px 8px; gap: 4px; }
  .hotel-marker__icon { width: 14px; height: 14px; }
  .hotel-marker__discount { font-size: 12px; }

  .hotel-cluster { padding: 6px 10px; gap: 4px; }
  .hotel-cluster__icon { width: 14px; height: 14px; }
  .hotel-cluster__count { font-size: 12px; }

  /* Мобильная карусель отелей */
  .map-carousel {
    display: flex;
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 8px;
    padding: 12px 16px;
    box-sizing: border-box;
    z-index: 3000;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .map-carousel::-webkit-scrollbar { display: none; }

  .map-carousel:empty { display: none; }

  .map-carousel__card {
    flex: 0 0 calc(100% - 64px);
    scroll-snap-align: center;
    background: #fff;
    border-radius: 20px;
    padding: 14px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    transition: box-shadow 0.2s ease;
  }

  .map-carousel__card--active {
    box-shadow: 0 4px 16px rgba(127, 95, 255, 0.25);
  }

  .map-carousel__name {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-carousel__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .map-carousel__price {
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text-primary);
    font-feature-settings: 'pnum' on, 'lnum' on;
  }

  .map-carousel__discount {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: #000;
    color: #fff;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
  }

  /* Активный пин на карте */
  .custom-hotel-pin--active .custom-hotel-pin__content {
    transform: scale(1.03);
    background: var(--accent);
    box-shadow: 0px 10px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  }

  .custom-hotel-pin--active .custom-hotel-pin__discount {
    color: #fff;
  }

  .custom-hotel-pin--active .custom-hotel-pin__icon {
    filter: brightness(0) invert(1);
  }
}
