.listing-map-lightweight .main-map-wrapper {
  position: relative;
}

.listing-map-legend {
  position: absolute;
  z-index: 500;
  top: 16px;
  left: 16px;
  width: min(320px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(6px);
  color: #17243a;
}

.listing-map-legend button,
.listing-map-legend button:hover,
.listing-map-legend button:focus,
.listing-map-legend button:active {
  transform: none !important;
  box-shadow: none !important;
}

.listing-map-legend__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  background: rgba(255, 255, 255, 0.72);
  color: #17243a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}

.listing-map-legend__toggle-icon,
.listing-map-legend__parent-arrow {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid #9aa4b2;
  border-bottom: 2px solid #9aa4b2;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.listing-map-legend.is-collapsed .listing-map-legend__toggle-icon {
  transform: rotate(-45deg);
}

.listing-map-legend__body {
  max-height: 420px;
  overflow-y: auto;
  padding: 3px 8px 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.listing-map-legend.is-collapsed .listing-map-legend__body {
  display: none;
}

.listing-map-legend__group + .listing-map-legend__group {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.listing-map-legend__parent {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: #1f2937;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
}

.listing-map-legend__parent:disabled {
  cursor: default;
}

.listing-map-legend__parent[aria-expanded="true"] .listing-map-legend__parent-arrow {
  transform: rotate(225deg);
}

.listing-map-legend__pin {
  --legend-color: #b03654;
  display: inline-flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.listing-map-legend__pin .icon-map {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
}

.listing-map-legend__pin svg {
  display: block;
  width: 24px;
  height: 24px;
}

.listing-map-legend__pin .pin-st0,
.listing-map-legend__pin .pin-st1 {
  fill: var(--legend-color);
}

.listing-map-legend__pin .icon-cat {
  position: absolute;
  z-index: 1;
  top: 1.5px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  color: var(--legend-color);
  font-size: 9px;
  line-height: 1;
  transform: translateX(-50%);
}

.listing-map-legend__pin .listing-map-legend__swatch {
  width: 7px;
  height: 7px;
}

.listing-map-legend__children {
  display: grid;
  gap: 3px;
  padding: 0 6px 8px 32px;
}

.listing-map-legend__child {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #475467;
  font-size: 12px;
  line-height: 1.25;
}

.listing-map-legend__term-icon {
  --legend-color: #b03654;
  display: inline-flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  /* background: #f6f7f9; */
  color: var(--legend-color);
  font-size: 15px;
  line-height: 1;
}

.listing-map-legend__term-icon--child {
  flex-basis: 20px;
  width: 20px;
  height: 20px;
  font-size: 18px;
}

.listing-map-legend__term-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.listing-map-legend__parent .listing-map-legend__term-name {
  flex: 1 1 auto;
}

.listing-map-legend__swatch {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--legend-color);
}

.listing-map-legend__term-icon.red,
.listing-map-legend__swatch.red,
.listing-map-legend__pin.red,
.listing-map-legend__term-icon.color-red,
.listing-map-legend__swatch.color-red,
.listing-map-legend__pin.color-red {
  --legend-color: #d03632;
}

.listing-map-legend__term-icon.pink,
.listing-map-legend__swatch.pink,
.listing-map-legend__pin.pink,
.listing-map-legend__term-icon.color-pink,
.listing-map-legend__swatch.color-pink,
.listing-map-legend__pin.color-pink {
  --legend-color: #ff69b4;
}

.listing-map-legend__term-icon.light-pink,
.listing-map-legend__swatch.light-pink,
.listing-map-legend__pin.light-pink,
.listing-map-legend__term-icon.color-light-pink,
.listing-map-legend__swatch.color-light-pink,
.listing-map-legend__pin.color-light-pink {
  --legend-color: #ac70b8;
}

.listing-map-legend__term-icon.orange,
.listing-map-legend__swatch.orange,
.listing-map-legend__pin.orange,
.listing-map-legend__term-icon.color-orange,
.listing-map-legend__swatch.color-orange,
.listing-map-legend__pin.color-orange {
  --legend-color: #fda400;
}

.listing-map-legend__term-icon.yellow,
.listing-map-legend__swatch.yellow,
.listing-map-legend__pin.yellow,
.listing-map-legend__term-icon.color-yellow,
.listing-map-legend__swatch.color-yellow,
.listing-map-legend__pin.color-yellow {
  --legend-color: #f4ec4d;
}

.listing-map-legend__term-icon.green,
.listing-map-legend__swatch.green,
.listing-map-legend__pin.green,
.listing-map-legend__term-icon.color-green,
.listing-map-legend__swatch.color-green,
.listing-map-legend__pin.color-green {
  --legend-color: #64c568;
}

.listing-map-legend__term-icon.blue,
.listing-map-legend__swatch.blue,
.listing-map-legend__pin.blue,
.listing-map-legend__term-icon.color-blue,
.listing-map-legend__swatch.color-blue,
.listing-map-legend__pin.color-blue {
  --legend-color: #26b2ec;
}

.listing-map-legend__term-icon.dark-mint,
.listing-map-legend__swatch.dark-mint,
.listing-map-legend__pin.dark-mint,
.listing-map-legend__term-icon.color-dark-mint,
.listing-map-legend__swatch.color-dark-mint,
.listing-map-legend__pin.color-dark-mint {
  --legend-color: #90d0c4;
}

.listing-map-legend__term-icon.violet,
.listing-map-legend__swatch.violet,
.listing-map-legend__pin.violet,
.listing-map-legend__term-icon.color-violet,
.listing-map-legend__swatch.color-violet,
.listing-map-legend__pin.color-violet {
  --legend-color: #d9ac09;
}

.listing-map-legend__term-icon.navy,
.listing-map-legend__swatch.navy,
.listing-map-legend__pin.navy,
.listing-map-legend__term-icon.color-navy,
.listing-map-legend__swatch.color-navy,
.listing-map-legend__pin.color-navy {
  --legend-color: #23569c;
}

.listing-map-legend__term-icon.purple,
.listing-map-legend__swatch.purple,
.listing-map-legend__pin.purple,
.listing-map-legend__term-icon.color-purple,
.listing-map-legend__swatch.color-purple,
.listing-map-legend__pin.color-purple {
  --legend-color: #9a30d8;
}

.listing-map-legend__term-icon.gray,
.listing-map-legend__swatch.gray,
.listing-map-legend__pin.gray,
.listing-map-legend__term-icon.color-gray,
.listing-map-legend__swatch.color-gray,
.listing-map-legend__pin.color-gray {
  --legend-color: #7b8190;
}

.listing-map-legend__term-icon.black,
.listing-map-legend__swatch.black,
.listing-map-legend__pin.black,
.listing-map-legend__term-icon.color-black,
.listing-map-legend__swatch.color-black,
.listing-map-legend__pin.color-black {
  --legend-color: #071f20;
}

@media (max-width: 767px) {
  .listing-map-legend {
    top: 10px;
    left: 10px;
    width: min(280px, calc(100% - 20px));
  }

  .listing-map-legend__toggle {
    padding: 10px 12px;
    font-size: 14px;
  }

  .listing-map-legend__body {
    max-height: 300px;
  }
}
