.pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(26, 42, 56, 0.2);
}

.pin-land { background: #e8c01a; }
.pin-villa { background: #e23b3b; }
.pin-house { background: #2b78e4; }

.dot-pin-wrap,
.price-pin-wrap,
.cluster-pin-wrap {
  background: none !important;
  border: none !important;
}

.map-rule {
  display: none;
}

.map-stage {
  display: flex;
  flex-direction: column;
}

.map-drawer {
  display: contents;
}

.map-drawer-body {
  display: contents;
}

.filters-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.85rem;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.15;
  order: 3;
}

.filters-clear-fs {
  display: none;
}

.map-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  order: 1;
}

.map-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.85rem;
  line-height: 1.1;
}

.map-filters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0;
  order: 3;
}

@media (min-width: 64rem) {
  .map-stage {
    display: grid;
    grid-template-columns: 15rem 1px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "fhead rule bar"
      "filters rule map"
      "filters rule list";
    column-gap: 0;
    row-gap: 0.85rem;
    align-items: center;
  }

  .filters-heading {
    grid-area: fhead;
    display: flex;
    align-items: center;
    margin: 0;
    padding-right: 1.2rem;
    min-height: 2.5rem;
    line-height: 1.1;
    order: 0;
  }

  .map-bar {
    grid-area: bar;
    align-items: center;
    margin: 0;
    padding-left: 1.2rem;
    min-height: 2.5rem;
    order: 0;
  }

  .map-title {
    margin: 0;
    min-height: 2.5rem;
  }

  .map-rule {
    display: block;
    grid-area: rule;
    background: #e7e5e4;
    align-self: stretch;
    margin: 0 0.15rem;
  }

  #map-wrap {
    grid-area: map;
    margin-left: 1.2rem;
  }

  .map-filters {
    grid-area: filters;
    margin-top: 0;
    padding-right: 1.2rem;
    padding-top: 0.45rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    scrollbar-width: thin;
    gap: 0.7rem;
    align-self: start;
    order: 0;
  }

  .map-filters .filter-toolbar,
  .filter-body .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .map-filters .filter-select select,
  .filter-body .filter-select select {
    min-width: 0;
    width: 100%;
  }

  .map-filters .filter-groups,
  .filter-body .filter-groups {
    flex-direction: column;
    gap: 0.7rem;
  }

  #listing-pane {
    grid-area: list;
    margin-top: 0;
    margin-left: 1.2rem;
  }
}

.price-pin {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  background: #fff;
  color: #1a2a38;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  padding: 0.18rem 0.45rem 0.22rem 0.22rem;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(26, 42, 56, 0.08), 0 6px 14px rgba(26, 42, 56, 0.1);
}

.price-pin-type {
  display: block;
  width: 100%;
  padding: 0.08rem 0.2rem 0.18rem;
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}

.price-pin.pin-land .price-pin-type { color: #b45309; }
.price-pin.pin-villa .price-pin-type { color: #c81e1e; }
.price-pin.pin-house .price-pin-type { color: #1d4ed8; }

.price-pin-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.price-pin-photo {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e7e5e4;
}

.price-pin-photo.is-placeholder {
  object-fit: contain;
  padding: 0.35rem;
  background: #e8e8e8;
}

.price-pin::before {
  display: none;
}

.price-pin.pin-land { border-color: #e8c01a; }
.price-pin.pin-villa { border-color: #e23b3b; }
.price-pin.pin-house { border-color: #2b78e4; }

.price-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-right: 1px solid #d6d3d1;
  border-bottom: 1px solid #d6d3d1;
  transform: translateX(-50%) rotate(45deg);
}

.cluster-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1f6fad;
  color: #fff;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 650;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(31, 111, 173, 0.22), 0 4px 12px rgba(26, 42, 56, 0.18);
}

.map-expand {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#map-wrap {
  position: relative;
  height: 23.5rem;
  min-height: 16rem;
  order: 2;
}

#map,
#detail-map,
#pin-map {
  height: 100%;
  width: 100%;
  touch-action: pan-x pan-y;
}

.has-vector-basemap {
  position: relative;
}

.map-basemap {
  position: absolute !important;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-container.is-overlay-map {
  position: relative;
  z-index: 1;
  background: transparent !important;
}

.map-legend {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  z-index: 500;
  display: grid;
  grid-template-columns: 1rem max-content;
  align-items: center;
  column-gap: 0.45rem;
  row-gap: 0.38rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e7e5e4;
  border-radius: 0.65rem;
  box-shadow: 0 6px 16px rgba(26, 42, 56, 0.12);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: #1a2a38;
  pointer-events: none;
}

.map-legend span {
  display: contents;
}

.map-legend svg {
  width: 13px;
  height: 13px;
  overflow: visible;
  justify-self: center;
}

#listing-pane {
  margin-top: 1.75rem;
  order: 4;
}

.detail-map-wrap {
  height: 18rem;
}

#pin-map {
  height: 16rem;
}

.pane-tab {
  display: none;
}

.map-stage.is-fullscreen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  z-index: 100;
  display: block;
  padding: 0;
  margin: 0;
  background: #e7eef2;
}

html.is-map-fullscreen #map-section {
  position: fixed;
  inset: 0;
  z-index: 200;
  max-width: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

.map-stage.is-fullscreen .map-title-text {
  display: none;
}

.map-stage.is-fullscreen .map-bar {
  position: absolute;
  top: max(0.85rem, env(safe-area-inset-top));
  left: max(0.85rem, env(safe-area-inset-left));
  z-index: 1100;
  margin: 0;
  padding: 0;
  min-height: 0;
  opacity: 1;
  transform: none;
}

.map-stage.is-fullscreen .map-legend {
  left: max(0.85rem, env(safe-area-inset-left));
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  gap: 0.42rem;
  padding: 0.72rem 0.9rem;
  font-size: 1.05rem;
  border-radius: 0.8rem;
}

.map-stage.is-fullscreen .map-expand {
  color: #1a2a38;
  background: #fff;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  filter: none;
  box-shadow: 0 6px 20px rgba(26, 42, 56, 0.22);
  text-decoration: none;
  --btn-glow: 0 8px 20px rgba(26, 42, 56, 0.22);
}

.map-stage.is-fullscreen .map-expand:hover,
.map-stage.is-fullscreen .map-expand:focus-visible {
  color: #1a2a38;
  background: #fff;
  text-decoration: none;
  filter: none;
  transform: translateY(-1px);
  box-shadow: var(--btn-glow);
}

.map-stage.is-fullscreen .map-legend svg {
  width: 16px;
  height: 16px;
}

.map-stage.is-fullscreen #map-wrap {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  z-index: 1;
}

.map-stage.is-fullscreen .map-drawer {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(26rem, 92vw);
  z-index: 1200;
  background: #fff;
  border-left: 1px solid #e7e5e4;
  box-shadow: -14px 0 32px rgba(26, 42, 56, 0.16);
  transform: translateX(0);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
}

.map-stage.is-fullscreen .map-drawer-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-stage.is-fullscreen.is-pane-hidden .map-drawer {
  transform: translateX(100%);
}

.map-stage.is-fullscreen .map-rule,
.map-stage.is-fullscreen .filters-heading {
  display: none;
}

.map-stage.is-fullscreen .filters-clear-fs {
  display: inline-flex;
}

.map-stage.is-fullscreen .map-filters {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0.85rem 1.1rem 0.65rem;
  order: 0;
  gap: 0.85rem;
  position: static;
  max-height: 46%;
  overflow: auto;
}

.map-stage.is-fullscreen .filter-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0;
  position: static;
  max-height: none;
  overflow: visible;
}

.map-stage.is-fullscreen .filter-panel {
  grid-template-columns: 1fr;
}

.map-stage.is-fullscreen .filter-range[data-range="price_thb"] {
  grid-column: auto;
}

.map-stage.is-fullscreen .filter-select select {
  min-width: 0;
  width: 100%;
}

.map-stage.is-fullscreen #listing-pane {
  flex: 1;
  margin: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1.1rem 1.25rem;
  order: 0;
}

.map-stage.is-fullscreen #listing-grid {
  grid-template-columns: 1fr;
}

.map-stage.is-fullscreen #listing-pane h2 {
  font-size: 1.5rem;
}

.map-stage.is-fullscreen .pane-tab {
  display: flex;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-100%, -50%);
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 5.75rem;
  padding: 0;
  border: 0;
  border-radius: 12px 0 0 12px;
  background: #1f6fad;
  color: #fff;
  box-shadow: -4px 4px 16px rgba(26, 42, 56, 0.22);
  cursor: pointer;
  z-index: 2;
}

.map-stage.is-fullscreen .pane-tab:hover {
  background: #185a8c;
}

.map-stage.is-fullscreen .pane-tab svg {
  width: 1.35rem;
  height: 1.35rem;
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
}

.map-stage.is-fullscreen.is-pane-hidden .pane-tab svg {
  transform: rotate(180deg);
}

.leaflet-container {
  font-family: "Outfit", system-ui, sans-serif;
  background: #e7eef2;
}

#map .leaflet-control-zoom,
#detail-map .leaflet-control-zoom {
  display: none !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #fff;
  color: #1a2a38;
  border-radius: 10px;
}

.leaflet-popup-content {
  margin: 0.75rem 0.9rem;
  font-size: 0.9rem;
}

.leaflet-popup-content a {
  color: #1f6fad;
}

.leaflet-popup.map-pop .leaflet-popup-content-wrapper {
  width: max-content;
}

.leaflet-popup.map-pop .leaflet-popup-content {
  width: auto !important;
  margin: 0.6rem 0.7rem 0.55rem;
}

.map-pop-top {
  display: flex;
  align-items: stretch;
  width: max-content;
  gap: 0.55rem;
}

.map-pop-photo {
  flex: 0 0 auto;
  align-self: stretch;
  width: max-content;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
}

.map-pop-photo img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: left center;
}

.map-pop-photo.is-empty {
  display: grid;
  place-items: center;
  width: 4.5rem;
  min-height: 5rem;
  background: #e8e8e8;
}

.map-pop-photo.is-empty .photo-fallback {
  width: 100%;
  height: 100%;
  background: transparent;
}

.map-pop-photo.is-empty img {
  width: 62%;
  height: auto;
  max-width: none;
  object-fit: contain;
}

.map-pop-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.22rem;
  flex: 0 0 auto;
  width: max-content;
}

.leaflet-popup-content p {
  margin: 0;
}

.map-pop {
  display: flex;
  flex-direction: column;
  width: max-content;
}

.map-pop-place,
.map-pop-specs li {
  display: grid;
  grid-template-columns: 1rem max-content;
  align-items: center;
  column-gap: 0.3rem;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 650;
  color: #1a2a38;
  white-space: nowrap;
}

.map-pop-place {
  font-size: 0.92rem;
}

.map-pop-place svg,
.map-pop-specs svg {
  width: 1rem;
  height: 1rem;
  overflow: visible;
  justify-self: center;
}

.map-pop-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  column-gap: 0.7rem;
  row-gap: 0.15rem;
  width: 0;
  min-width: 100%;
  margin-top: 0.7rem;
}

.map-pop-price {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.2;
}

.map-pop-open {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.leaflet-popup-content ul {
  margin: 0;
}

.map-pop-specs {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  justify-content: center;
  width: max-content;
  gap: 0.22rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-pop-specs li {
  flex: 0 0 auto;
  float: none !important;
  width: auto !important;
  padding: 0;
  list-style: none;
  color: #44403c;
}

@media (max-width: 768px) {
  .map-stage.is-fullscreen .map-drawer {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: min(86dvh, 52rem);
    overflow: hidden;
    border-left: none;
    border-top: 1px solid #e7e5e4;
    box-shadow: 0 -10px 28px rgba(26, 42, 56, 0.14);
    transform: translateY(0);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .map-stage.is-fullscreen.is-pane-hidden .map-drawer {
    transform: translateY(calc(100% - 3.2rem - env(safe-area-inset-bottom, 0px)));
  }

  .map-stage.is-fullscreen .map-drawer-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .map-stage.is-fullscreen .pane-tab {
    position: relative;
    left: auto;
    top: auto;
    flex-shrink: 0;
    align-self: center;
    width: 5.75rem;
    height: 2.5rem;
    margin: 0.4rem 0 0.15rem;
    border-radius: 999px;
    transform: none;
    box-shadow: 0 4px 14px rgba(26, 42, 56, 0.2);
    z-index: 3;
  }

  .map-stage.is-fullscreen .pane-tab svg {
    transform: rotate(90deg);
  }

  .map-stage.is-fullscreen.is-pane-hidden .pane-tab svg {
    transform: rotate(-90deg);
  }

  .map-stage.is-fullscreen .map-filters {
    max-height: none;
    overflow: visible;
    flex-shrink: 0;
  }

  .map-stage.is-fullscreen #listing-pane {
    overflow: visible;
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-stage.is-fullscreen .map-drawer,
  .map-stage.is-fullscreen .pane-tab svg {
    transition: none;
  }
}
