/**
 * Listing archive layout fixes (location / category / search).
 */

/* ListingPro loading / filter overlays can get stuck and block all clicks */
body.allofbd-listing-archive.aob-overlays-cleared .md-overlay,
body.allofbd-listing-archive.aob-overlays-cleared .outer_all_page_overflow,
body.allofbd-listing-archive.aob-overlays-cleared .lp_all_page_overflow_after {
	display: none !important;
	pointer-events: none !important;
	visibility: hidden !important;
}

/* Keep header/nav above the full-width map listing section */
body.allofbd-listing-archive header.lp-header-full-width,
body.allofbd-listing-archive .lp-menu-bar,
body.allofbd-listing-archive .header-without-topbar {
	position: relative !important;
	z-index: 100002 !important;
}

body.allofbd-listing-archive #location.page-container,
body.allofbd-listing-archive .page-container.listing-with-map.section-fixed {
	position: relative !important;
	z-index: 1 !important;
}

body.allofbd-listing-archive .page-container,
body.allofbd-listing-archive #content,
body.allofbd-listing-archive .content-container {
	max-width: 100%;
	overflow-x: clip;
}

/* Keep filter staging reachable to JS until relocated */
#allofbd-filter-bar-staging {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
}

body.allofbd-listing-archive .allofbd-filter-bar {
	display: flex !important;
	width: 100%;
	max-width: 100%;
	margin: 0 0 16px !important;
	z-index: 2;
	position: relative;
}

/* List + map view: give listing column room */
body.allofbd-listing-archive.listing-skeleton-view-list_view .post-with-map-container .listing-simple {
	min-width: 0;
}

body.allofbd-listing-archive .lp-grid-box-thumb img.aob-thumb-fallback,
body.allofbd-listing-archive .lp-grid-box-thumb img[src*="placeholder"] {
	object-fit: cover;
	background: #f1f5f9;
}

/* List view sometimes renders duplicate thumbs — hide the ghost copy */
body.allofbd-listing-archive.listing-skeleton-view-list_view .lp-grid-box-contianer .lp-grid-box-thumb img + img,
body.allofbd-listing-archive.listing-skeleton-view-list_view .listing-simple .lp-grid-box-thumb img:nth-child(n+2) {
	display: none !important;
}

/* Tidy LP filter chips that leak currency glyphs */
body.allofbd-listing-archive .search-filters .lp-tooltip-outer,
body.allofbd-listing-archive .search-filters li {
	max-width: 100%;
}

body.allofbd-listing-archive .search-filters .lp-tooltip-outer .lp-suggested-search,
body.allofbd-listing-archive .search-filters .lp-tooltip-outer .lp-search-tags {
	white-space: normal;
}

/* Prevent map from crushing listing column on medium screens */
@media (max-width: 1200px) {
	body.allofbd-listing-archive.listing-skeleton-view-list_view .post-with-map-container {
		flex-wrap: wrap;
	}

	body.allofbd-listing-archive.listing-skeleton-view-list_view .post-with-map-container .listing-simple {
		flex: 1 1 100%;
		max-width: 100%;
	}

	body.allofbd-listing-archive.listing-skeleton-view-list_view .post-with-map-container .listingmap {
		flex: 1 1 100%;
		min-height: 320px;
	}
}

@media (max-width: 768px) {
	body.allofbd-listing-archive .allofbd-filter-bar {
		overflow-x: auto;
		flex-wrap: nowrap;
		padding-bottom: 10px;
		-webkit-overflow-scrolling: touch;
	}

	body.allofbd-listing-archive .allofbd-filter-pill {
		flex-shrink: 0;
	}
}
