/* =========================================================================
   РАСПОЛОЖЕНИЕ ОБЪЕКТА ([yandex_map])
   ========================================================================= */

.location-section {
  --loc-object: #003b7c;
  --loc-shops: #f59e0b;
  --loc-education: #3b82f6;
  --loc-transport: #22a06b;
  --loc-medicine: #e5484d;
  --loc-other: #8b5cf6;

  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
}

.location-section *,
.location-section *::before,
.location-section *::after {
  box-sizing: border-box;
}

.location-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.location-section__title-wrap {
  min-width: 0;
}

.location-section__title {
  color: var(--rs-ink);
  font-size: var(--rs-fs-h2);
  font-weight: 700;
  line-height: 1.15;
}

.location-section__address {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 55%;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--rs-line);
  border-radius: var(--rs-radius-pill);
  background: var(--rs-surface-2);
  color: var(--rs-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.location-section__address-icon {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--rs-brand);
}

.location-section__address > span:last-child {
  min-width: 0;
}

/* ---------- Карта ---------- */
.location-section__map-wrap {
  position: relative;
  width: 100%;
  height: 620px;
  overflow: hidden;
  border-radius: var(--rs-radius-lg);
  background: var(--rs-surface-3);
  isolation: isolate;
}

.location-section__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.location-section__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%) -100% 0 / 60% 100% no-repeat,
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(15, 27, 45, 0.04) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(15, 27, 45, 0.04) 39px 40px),
    var(--rs-surface-3);
  color: var(--rs-muted);
  font-size: 14px;
  animation: rs-map-shimmer 1.8s ease-in-out infinite;
}

@keyframes rs-map-shimmer {
  to {
    background-position: 200% 0, 0 0, 0 0, 0 0;
  }
}

.location-section__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--rs-brand-100);
  border-top-color: var(--rs-brand);
  border-radius: 50%;
  animation: rs-spin 0.9s linear infinite;
}

.location-section.is-error .location-section__spinner {
  display: none;
}

@keyframes rs-spin {
  to {
    transform: rotate(360deg);
  }
}

.location-section__map-overlay {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
}

.location-section__radius {
  position: absolute;
  z-index: 110;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 9px 14px 9px 11px;
  border: 1px solid rgba(15, 27, 45, 0.06);
  border-radius: var(--rs-radius-pill);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: var(--rs-blur);
  backdrop-filter: var(--rs-blur);
  box-shadow: var(--rs-shadow-sm);
  color: var(--rs-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

.location-section__radius-icon {
  display: flex;
  color: var(--rs-brand);
}

/* ---------- Панель «Инфраструктура рядом» ---------- */
.location-section__sidebar {
  position: absolute;
  z-index: 500;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 330px;
  overflow: hidden;
  border: 1px solid rgba(15, 27, 45, 0.06);
  border-radius: var(--rs-radius-lg);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: var(--rs-blur);
  backdrop-filter: var(--rs-blur);
  box-shadow: var(--rs-shadow-lg);
  animation: rs-sidebar-in 0.5s var(--rs-ease-out) both;
}

@keyframes rs-sidebar-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.location-section__sidebar-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.location-section__sidebar-title {
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--rs-line-soft);
  color: var(--rs-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.location-section__categories {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rs-line) transparent;
}

.location-section__category {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--rs-radius);
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: default;
  transition: background-color var(--rs-dur-fast) var(--rs-ease);
}

.location-section__category + .location-section__category {
  margin-top: 2px;
}

.location-section__category.has-results {
  cursor: pointer;
}

.location-section__category.has-results:hover,
.location-section__category.is-active {
  background: var(--rs-surface-2);
}

.location-section__category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.location-section__category-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--rs-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.location-section__category-dot {
  display: block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(15, 27, 45, 0.05);
}

.location-section__category-name > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-section__category-count {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--rs-radius-pill);
  background: var(--rs-surface-3);
  color: var(--rs-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--rs-dur-fast) var(--rs-ease), color var(--rs-dur-fast) var(--rs-ease);
}

.location-section__category.has-results:hover .location-section__category-count,
.location-section__category.is-active .location-section__category-count {
  background: var(--rs-brand);
  color: #fff;
}

.location-section__category-nearest {
  display: block;
  margin-top: 3px;
  padding-left: 20px;
  color: var(--rs-muted);
  font-size: 12px;
  line-height: 1.45;
}

.location-section__category-nearest strong {
  color: var(--rs-ink);
  font-weight: 600;
}

.location-section__category:disabled .location-section__category-name,
.location-section__category:disabled .location-section__category-nearest,
.location-section__category:disabled .location-section__category-count {
  color: var(--rs-subtle);
}

/* ---------- Легенда ---------- */
.location-section__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  width: 100%;
  margin-top: 16px;
}

.location-section__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--rs-muted);
  font-size: 12px;
}

.location-section__legend-dot {
  display: block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.location-section__legend-dot--object {
  background: var(--loc-object);
}

.location-section__legend-dot--shops {
  background: var(--loc-shops);
}

.location-section__legend-dot--education {
  background: var(--loc-education);
}

.location-section__legend-dot--transport {
  background: var(--loc-transport);
}

.location-section__legend-dot--medicine {
  background: var(--loc-medicine);
}

.location-section__legend-dot--other {
  background: var(--loc-other);
}

/* ---------- Элементы Яндекс.Карт ---------- */
.location-section__map [class*="ymaps-2-1"] {
  box-sizing: content-box;
}

.location-section__map [class*="ymaps-2-1"][class*="-zoom"],
.location-section__map [class*="ymaps-2-1"][class*="-controls__control"] {
  border-radius: 10px !important;
}

.location-section__map [class*="ymaps-2-1"][class*="-zoom"] {
  overflow: hidden;
}

.location-section__map [class*="ymaps-2-1"][class*="-placemark"] {
  cursor: pointer;
}

.location-section [class*="ymaps-2-1"][class*="-balloon"] {
  box-shadow: none !important;
}

.location-section [class*="ymaps-2-1"][class*="-balloon__layout"] {
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 12px 36px rgba(15, 27, 45, 0.18) !important;
}

.location-section [class*="ymaps-2-1"][class*="-balloon__content"],
.location-section [class*="ymaps-2-1"][class*="-balloon__content"] > ymaps {
  margin: 0 !important;
  padding: 0 !important;
}

.location-section [class*="ymaps-2-1"][class*="-balloon__close"] {
  top: 6px !important;
  right: 6px !important;
  width: 30px !important;
  height: 30px !important;
}

.location-section [class*="ymaps-2-1"][class*="-balloon__close-button"] {
  width: 30px !important;
  height: 30px !important;
  opacity: 0.5;
  transition: opacity var(--rs-dur-fast) ease;
}

.location-section [class*="ymaps-2-1"][class*="-balloon__close-button"]:hover {
  opacity: 1;
}

.location-section [class*="ymaps-2-1"][class*="-balloon__tail"]::after {
  background: #fff !important;
}

.location-balloon {
  width: 270px;
  padding: 18px 20px;
  background: #fff;
  font-family: var(--rs-font);
}

.location-balloon__category {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 30px 8px 0;
  color: var(--rs-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: var(--rs-tracking-caps);
  text-transform: uppercase;
}

.location-balloon__dot {
  display: block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.location-balloon__title {
  margin: 0 20px 14px 0;
  color: var(--rs-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.location-balloon__distance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 0;
  border-top: 1px solid var(--rs-line-soft);
  border-bottom: 1px solid var(--rs-line-soft);
  color: var(--rs-muted);
  font-size: 12px;
  line-height: 1.3;
}

.location-balloon__distance strong {
  color: var(--rs-ink);
  font-size: 13px;
  font-weight: 700;
}

.location-balloon__address {
  margin-top: 12px;
  color: var(--rs-text);
  font-size: 12px;
  line-height: 1.5;
}

.location-balloon__address > span {
  display: block;
  margin-bottom: 3px;
  color: var(--rs-subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--rs-tracking-caps);
  text-transform: uppercase;
}

.location-balloon__address > div {
  word-break: break-word;
}

/* ---------- Адаптив ---------- */
@media (max-width: 1199px) {
  .location-section__sidebar {
    width: 300px;
  }

  .location-section__address {
    max-width: 50%;
  }
}

@media (max-width: 991px) {
  .location-section__header {
    display: block;
  }

  .location-section__address {
    display: inline-flex;
    max-width: 100%;
    margin-top: 12px;
  }

  .location-section__map-wrap {
    height: 680px;
  }

  .location-section__sidebar {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: 250px;
  }

  .location-section__radius {
    top: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
  }
}

@media (max-width: 767px) {
  .location-section__address {
    font-size: 12px;
  }

  .location-section__map-wrap {
    height: 600px;
    border-radius: var(--rs-radius);
  }

  .location-section__sidebar {
    right: 8px;
    bottom: 8px;
    left: 8px;
    height: 230px;
    border-radius: var(--rs-radius);
  }

  .location-section__sidebar-title {
    padding: 14px 16px 12px;
    font-size: 15px;
  }

  .location-section__category {
    padding: 10px 12px;
  }

  .location-section__category-name {
    font-size: 13px;
  }

  .location-section__radius {
    top: 8px;
    left: 8px;
    padding: 7px 11px 7px 9px;
    font-size: 11px;
  }

  .location-section__legend {
    gap: 8px 14px;
    margin-top: 12px;
  }

  .location-section__legend-item {
    font-size: 11px;
  }

  .location-balloon {
    width: 230px;
    padding: 16px;
  }

  .location-balloon__title {
    font-size: 14px;
  }
}
