/**
 * Карта инфраструктуры — страница /karta
 * Фильтры как у генплана v2 (Figma 7909:2208), иконки (7910:4781).
 */

html:has(.infra-map-page-wrap),
body:has(.infra-map-page-wrap) {
  overflow-x: clip;
}

body:has(.infra-map-page-wrap) .infra-map-page-wrap.first-container,
.infra-map-page-wrap.first-container {
  max-width: none;
  padding: 0;
  width: 100%;
}

.infra-map-page-wrap {
  padding-bottom: 48px;
}

.infra-map.is-editing .infra-map__canvas {
  cursor: crosshair;
}

.infra-map {
  width: 100%;
}

.infra-map__filters {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto 24px;
  padding: 0 24px;
  box-sizing: border-box;
}

.infra-map__filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 24px;
}

.infra-map__all {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 12px 20px;
  border-radius: 41px;
  font-family: "Cera Pro", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 32px;
  color: #765e50;
  cursor: pointer;
}

.infra-map__all.is-active {
  background: #917357;
  color: #fffbf3;
}

.infra-map .infrastructure-toggle {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.infra-map .toggle-label {
  font-family: "Cera Pro", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #765e50;
  cursor: pointer;
}

.infra-map .switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.infra-map .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.infra-map .sliderg {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #d8c7b4;
  border-radius: 28px;
  transition: .2s;
}

.infra-map .sliderg:before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  bottom: 3px;
  background: #fffbf3;
  border-radius: 50%;
  transition: .2s;
}

.infra-map input:checked + .sliderg {
  background: #917357;
}

.infra-map input:checked + .sliderg:before {
  transform: translateX(20px);
}

.infra-map__filters-inner {
  flex-wrap: wrap;
  row-gap: 12px;
}

.infra-map__cats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.infra-map__cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 10px;
  border-radius: 41px;
  border: 0;
  background: #ded3c6;
  cursor: pointer;
  font-family: "Cera Pro", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  color: #765e50;
  white-space: nowrap;
  transition: background .2s, color .2s;
}

.infra-map__cat.is-active {
  background: #917357;
  color: #fffbf3;
}

.infra-map__cat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #917357;
}

.infra-map__cat.is-active .infra-map__cat-icon {
  background: #b3ce7d;
}

.infra-map__cat-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.infra-map__stage {
  position: relative;
  width: 100%;
}

.infra-map__canvas {
  width: 100%;
  height: min(72vh, 820px);
  min-height: 480px;
  background: #e8e4dc;
}

.infra-map__fs {
  position: absolute;
  top: 16px;
  right: 24px;
  z-index: 8;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(145, 115, 87, 0.35);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.infra-map__fs:hover {
  background: #fff;
}

.infra-map__fs svg {
  display: block;
}

body.infra-map-fs-open {
  overflow: hidden;
}

.infra-map__stage.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100%;
  height: 100%;
  background: #e8e4dc;
}

.infra-map__stage.is-fullscreen .infra-map__canvas {
  height: 100%;
  min-height: 0;
}

.infra-map__legend {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 5;
  width: min(320px, calc(100% - 48px));
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(50, 50, 50, 0.88);
  color: #fffbf3;
  backdrop-filter: blur(8px);
}

.infra-map__legend-title {
  margin: 0 0 14px;
  font-family: Merriweather, serif;
  font-size: 18px;
  font-weight: 400;
  color: #fffbf3;
}

.infra-map__legend-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.infra-map__legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Cera Pro", sans-serif;
  font-size: 13px;
  line-height: 1.3;
  color: #fffbf3;
}

.infra-map__legend-dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.infra-map__legend-dot img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.infra-map-pin {
  position: relative;
  width: 44px;
  height: 52px;
  cursor: pointer;
}

.infra-map-pin.is-selected .infra-map-pin__body {
  box-shadow: 0 0 0 3px #fffbf3, 0 8px 18px rgba(25, 20, 16, 0.28);
}

.infra-map-pin__body {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(25, 20, 16, 0.28);
}

.infra-map-pin__body img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.infra-map-pin__tail {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  transform: rotate(45deg);
  border-radius: 0 0 3px 0;
}

.infra-map__editor {
  position: absolute;
  right: 24px;
  top: 76px;
  z-index: 6;
  width: min(340px, calc(100% - 48px));
  padding: 16px 18px;
  border-radius: 16px;
  background: #fffbf3;
  color: #3c3c3b;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: "Cera Pro", sans-serif;
  font-size: 14px;
}

.infra-map__edit-toggle,
.infra-map__edit-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.infra-map__edit-cat select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d8c7b4;
  background: #fff;
}

.infra-map__edit-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 500;
}

.infra-map__edit-title input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d8c7b4;
  background: #fff;
  font: inherit;
}

.infra-map__edit-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #765e50;
}

.infra-map__edit-list {
  max-height: 180px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.infra-map__edit-empty {
  margin: 0;
  font-size: 12px;
  color: #765e50;
}

.infra-map__edit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: #3c3c3b;
}

.infra-map__edit-item:hover,
.infra-map__edit-item.is-selected {
  background: #f3ebe3;
}

.infra-map__edit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.infra-map__edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.infra-map__delete {
  appearance: none;
  border: 0;
  border-radius: 41px;
  padding: 10px 16px;
  background: #f4cfcf;
  color: #6b3030;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.infra-map__save {
  appearance: none;
  border: 0;
  border-radius: 41px;
  padding: 10px 16px;
  background: #917357;
  color: #fffbf3;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.infra-map__save:hover {
  background: #7a5f48;
}

.infra-map__status {
  min-height: 1.2em;
  font-size: 12px;
  color: #3c7d50;
}

.infra-map__balloon {
  font-family: "Cera Pro", sans-serif;
  min-width: 180px;
}

.infra-map__balloon-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
}

.infra-map__balloon input {
  width: 100%;
  margin: 6px 0 10px;
  padding: 6px 8px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
}

.infra-map__balloon-actions {
  display: flex;
  gap: 8px;
}

.infra-map__balloon-actions button {
  appearance: none;
  border: 0;
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}

.infra-map__balloon-apply {
  background: #917357;
  color: #fff;
}

.infra-map__balloon-del {
  background: #f4cfcf;
  color: #6b3030;
}

@media (max-width: 980px) {
  .infra-map__canvas {
    min-height: 420px;
    height: 62vh;
  }

  .infra-map__legend {
    left: 12px;
    bottom: 12px;
    padding: 14px 16px;
  }

  .infra-map__legend-list {
    grid-template-columns: 1fr;
  }

  .infra-map__editor {
    position: static;
    width: auto;
    margin: 12px 16px 0;
  }

  .infra-map__fs {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
  }

  .infra-map__cat {
    font-size: 14px;
    padding: 6px 12px 6px 8px;
  }

  .infra-map__filters-inner {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .infra-map__cats {
    flex-wrap: nowrap;
  }
}
