/* Search map page — layout + Leaflet popup */

/* Full-viewport map search: header + sidebar/map split */
#main-wrapper.search-map-page,
#main-wrapper.search-map-page .content-container {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#main-wrapper.search-map-page .content-container > .container {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  padding: 0;
}

#main-wrapper.search-map-page .container-fluid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}

#main-wrapper.search-map-page .container-fluid > .row {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

#main-wrapper.search-map-page .sidebar-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-right: 1px solid #ddd;
  min-width: 0;
  overflow: hidden;
  flex: 0 0 33.333333%;
  max-width: 33.333333%;
  width: 33.333333%;
}

#main-wrapper.search-map-page .map-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100%;
  margin-top: 0 !important;
}

#main-wrapper.search-map-page #search-filter-and-sort {
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
  width: 100%;
}

#main-wrapper.search-map-page .map-toolbar-bar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px;
  width: 100%;
}

#main-wrapper.search-map-page .map-toolbar-sort {
  margin-left: auto;
  flex: 0 0 auto;
}

/* Map column: fill remaining width/height under the top bar */
#main-wrapper.search-map-page #main-map {
  flex: 1 1 0% !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 100% !important;
  max-height: 100%;
  padding: 0 !important;
  margin: 0 !important;
  position: relative;
  overflow: hidden;
}

#main-wrapper.search-map-page #map {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  margin-top: 0 !important;
}

#main-wrapper.search-map-page .search-results {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  min-height: 0;
}

#main-wrapper.search-map-page .lp-pagination {
  text-align: left !important;
}

#main-wrapper.search-map-page .lp-pagination-desktop,
#main-wrapper.search-map-page .lp-pagination .pages,
#main-wrapper.search-map-page .lp-pagination .showing-count,
#main-wrapper.search-map-page .lp-pagination .showing-count p {
  text-align: left !important;
  justify-content: flex-start !important;
}

#main-wrapper.search-map-page .lp-pagination .pages ul {
  float: none !important;
  margin: 0 !important;
  justify-content: flex-start !important;
}

#main-wrapper.search-map-page .sortbar-mapview {
  padding: 10px;
  border-bottom: 1px solid #eee;
}

@media (max-width: 767.98px) {
  #main-wrapper.search-map-page,
  #main-wrapper.search-map-page .content-container,
  #main-wrapper.search-map-page .container-fluid {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #main-wrapper.search-map-page .container-fluid > .row {
    flex-direction: column;
    flex-wrap: wrap;
    height: auto;
  }

  #main-wrapper.search-map-page .sidebar-container {
    flex: none;
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  #main-wrapper.search-map-page #main-map {
    flex: none;
    width: 100% !important;
    height: 400px !important;
    position: relative;
  }

  #main-wrapper.search-map-page #map {
    position: absolute !important;
    height: 100% !important;
  }
}

/* Leaflet map + popup */
#main-wrapper.search-map-page .leaflet-container {
  font: inherit;
  z-index: 1;
  background: #e5e3df;
}

#main-wrapper.search-map-page .lp-pin-icon {
  background: transparent;
  border: 0;
}

#main-wrapper.search-map-page .lp-map-popup .leaflet-popup-content-wrapper {
  position: relative;
  border-radius: 4px;
  padding: 0;
  background: #fff;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
  overflow: visible;
}

#main-wrapper.search-map-page .lp-map-popup .leaflet-popup-content {
  position: relative;
  margin: 0;
  min-width: 240px;
  max-width: 265px;
  width: auto !important;
  padding: 32px 12px 12px;
  box-sizing: border-box;
}

#main-wrapper.search-map-page .lp-map-popup .leaflet-popup-tip {
  background: #fff;
  box-shadow: none;
}

/* Hide Leaflet default close (outside white box); custom close lives inside content */
#main-wrapper.search-map-page .lp-map-popup a.leaflet-popup-close-button {
  display: none !important;
}

#main-wrapper.search-map-page .lp-map-popup .lp-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 5;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: #fff;
  color: #666;
  font-size: 20px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}

#main-wrapper.search-map-page .lp-map-popup .lp-popup-close:hover {
  color: #222;
  background: #f3f3f3;
}

#main-wrapper.search-map-page .lp-map-popup .lp-popup-body {
  position: static;
}
