/* Map Search v2 — body.is-mapsearch */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

body.is-mapsearch {
	--mapv2-ink: #1f2430;
	--mapv2-gold: #ffc107;
	--mapv2-muted: #6b7280;
	--mapv2-border: #e5e7eb;
	--mapv2-bg: #ffffff;
	--mapv2-soft: #f5f6f8;
	--mapv2-side: 420px;
	font-family: Tajawal, Cairo, sans-serif !important;
	background: var(--mapv2-soft) !important;
	overflow-x: hidden;
}

body.is-mapsearch .main-content {
	padding: 0 !important;
	background: var(--mapv2-soft) !important;
}

body.is-mapsearch .hv2-footer,
body.is-mapsearch .cookiealert,
body.is-mapsearch #scroll-to-top,
body.is-mapsearch #banner {
	display: none !important;
}

body.is-mapsearch .cv2-page,
body.is-mapsearch .cv2-crumbs,
body.is-mapsearch .cv2-mobile-filters {
	display: none !important;
}

/* Shell: map left | sidebar right (RTL visual) */
.mapv2-page {
	width: 100%;
	height: calc(100vh - 80px);
	min-height: 560px;
	overflow: hidden;
}

.mapv2-shell {
	display: flex;
	flex-direction: row-reverse;
	width: 100%;
	height: 100%;
	background: #fff;
}

/* ========== Map pane ========== */
.mapv2-map {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	background: #2a2e35;
}

.mapv2-map__canvas,
body.is-mapsearch #map {
	width: 100% !important;
	height: 100% !important;
	min-height: 100% !important;
	border-radius: 0 !important;
	overflow: hidden;
}

/* Style switcher pill */
.mapv2-styles {
	position: absolute;
	top: 16px;
	inset-inline-start: 72px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px;
	background: #fff;
	border-radius: 999px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.mapv2-styles__label {
	padding: 0 10px 0 6px;
	font-size: 13px;
	font-weight: 700;
	color: var(--mapv2-ink);
	white-space: nowrap;
}

.mapv2-styles__btn {
	border: 0;
	background: transparent;
	color: var(--mapv2-ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s, color 0.15s;
}

.mapv2-styles__btn:hover {
	background: #f3f4f6;
}

.mapv2-styles__btn.is-active {
	background: var(--mapv2-ink);
	color: #fff;
}

/* Mapbox controls — white squares top-left */
body.is-mapsearch .mapboxgl-ctrl-top-right,
body.is-mapsearch .mapboxgl-ctrl-bottom-right,
body.is-mapsearch .mapboxgl-ctrl-bottom-left {
	display: none !important;
}

body.is-mapsearch .mapboxgl-ctrl-top-left {
	top: 16px !important;
	left: 16px !important;
	right: auto !important;
}

body.is-mapsearch .mapboxgl-ctrl-group {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	overflow: visible !important;
}

body.is-mapsearch .mapboxgl-ctrl-group + .mapboxgl-ctrl-group {
	margin-top: 8px !important;
}

body.is-mapsearch .mapboxgl-ctrl-group button {
	width: 40px !important;
	height: 40px !important;
	margin: 0 0 8px !important;
	border: 0 !important;
	border-radius: 10px !important;
	background: #fff !important;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12) !important;
}

body.is-mapsearch .mapboxgl-ctrl-group button + button {
	border-top: 0 !important;
}

body.is-mapsearch .mapboxgl-ctrl-icon {
	filter: none !important;
}

/* Price pins */
.mapv2-pin {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 52px;
	height: 32px;
	padding: 0 12px;
	background: var(--mapv2-ink);
	color: #fff;
	font-family: Tajawal, Cairo, sans-serif;
	font-size: 13px;
	font-weight: 800;
	border-radius: 10px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	transform: translateY(-4px);
	white-space: nowrap;
	user-select: none;
}

.mapv2-pin::after {
	content: '';
	position: absolute;
	left: 50%;
	bottom: -6px;
	width: 12px;
	height: 12px;
	background: inherit;
	transform: translateX(-50%) rotate(45deg);
	border-radius: 2px;
	z-index: -1;
}

.mapv2-pin.is-active,
.mapv2-pin:hover {
	background: var(--mapv2-gold);
	color: #fff;
	z-index: 2;
}

.mapboxgl-popup-content {
	padding: 0 !important;
	border-radius: 12px !important;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18) !important;
}

/* ========== Sidebar ========== */
.mapv2-side {
	flex: 0 0 var(--mapv2-side);
	width: var(--mapv2-side);
	max-width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-inline-start: 1px solid var(--mapv2-border);
	box-sizing: border-box;
	overflow: hidden;
}

.mapv2-side__top {
	flex-shrink: 0;
	padding: 18px 18px 12px;
	border-bottom: 1px solid #f0f1f3;
}

.mapv2-side__title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.mapv2-back {
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	color: var(--mapv2-ink);
	background: var(--mapv2-soft);
	text-decoration: none;
	flex-shrink: 0;
}

.mapv2-back:hover {
	background: #e8eaed;
	color: var(--mapv2-ink);
}

.mapv2-side__title {
	margin: 0;
	flex: 1 1 auto;
	font-size: 20px;
	font-weight: 800;
	color: var(--mapv2-ink);
	line-height: 1.3;
}

.mapv2-side__count {
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 500;
	color: var(--mapv2-muted);
	white-space: nowrap;
}

/* Quick filter pills */
.mapv2-quick {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 2px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.mapv2-quick::-webkit-scrollbar {
	display: none;
}

.mapv2-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	height: 38px;
	padding: 0 14px;
	border: 1px solid var(--mapv2-ink);
	border-radius: 999px;
	background: #fff;
	color: var(--mapv2-ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s, color 0.15s;
}

.mapv2-pill i {
	font-size: 12px;
}

.mapv2-pill:hover {
	background: #f8f9fa;
}

.mapv2-pill--dark {
	background: var(--mapv2-ink);
	color: #fff;
	border-color: var(--mapv2-ink);
}

.mapv2-pill--dark:hover {
	background: #2a3140;
	color: #fff;
}

/* Filters drawer */
.mapv2-filters {
	flex-shrink: 0;
	max-height: 42%;
	overflow: auto;
	border-bottom: 1px solid var(--mapv2-border);
	background: #fafbfc;
	padding: 12px 16px 16px;
}

.mapv2-filters[hidden] {
	display: none !important;
}

.mapv2-filters__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.mapv2-filters__head h2 {
	margin: 0;
	flex: 1;
	font-size: 15px;
	font-weight: 800;
	color: var(--mapv2-ink);
	text-align: end;
}

.mapv2-filters__reset {
	font-size: 12px;
	color: var(--mapv2-muted);
	text-decoration: none;
}

.mapv2-filters__close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: #eee;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: var(--mapv2-ink);
}

body.is-mapsearch .mapv2-form .cv2-fgroup {
	margin-bottom: 12px;
}

body.is-mapsearch .mapv2-form .cv2-fgroup__label {
	font-size: 13px;
	font-weight: 700;
	margin-bottom: 6px;
}

body.is-mapsearch .mapv2-form select,
body.is-mapsearch .mapv2-form .form-control,
body.is-mapsearch .mapv2-form input[type="text"] {
	width: 100%;
	border: 1px solid var(--mapv2-border);
	border-radius: 10px;
	height: 40px;
	padding: 0 12px;
	font-family: inherit;
	background: #fff;
}

/* Results list */
.mapv2-results,
body.is-mapsearch #map_results {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 12px 14px;
	background: #fff;
	-webkit-overflow-scrolling: touch;
}

body.is-mapsearch #map_results .alert {
	border-radius: 12px;
	margin: 8px 0;
}

/* Result cards — override legacy clsMapInfo */
body.is-mapsearch #map_results .clsMapInfo.clsRDetail,
body.is-mapsearch #map_results .mapv2-card {
	display: block;
	margin: 0 0 12px;
	padding: 0;
	border: 1px solid var(--mapv2-border);
	border-radius: 14px;
	background: #fff;
	overflow: hidden;
	transition: box-shadow 0.15s, border-color 0.15s;
}

body.is-mapsearch #map_results .clsMapInfo.clsRDetail:hover,
body.is-mapsearch #map_results .mapv2-card:hover,
body.is-mapsearch #map_results .mapv2-card.is-active {
	border-color: #d1d5db;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

body.is-mapsearch #map_results .clsMapInfo.clsRDetail > a,
body.is-mapsearch #map_results .mapv2-card > a {
	display: flex;
	flex-direction: row-reverse;
	align-items: stretch;
	gap: 0;
	text-decoration: none;
	color: inherit;
	min-height: 118px;
}

/* Image on the right (RTL) */
body.is-mapsearch #map_results .clsMapInfo .col-xs-3,
body.is-mapsearch #map_results .mapv2-card__media {
	position: relative;
	flex: 0 0 118px;
	width: 118px;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
}

body.is-mapsearch #map_results .clsMapInfo .col-xs-3 .row {
	margin: 0;
	height: 100%;
}

body.is-mapsearch #map_results .clsMapInfo img,
body.is-mapsearch #map_results .mapv2-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 118px;
	object-fit: cover;
	border-radius: 0;
}

body.is-mapsearch #map_results .mapv2-card__urgent {
	position: absolute;
	top: 8px;
	inset-inline-end: 8px;
	z-index: 1;
	padding: 3px 8px;
	border-radius: 6px;
	background: var(--mapv2-gold);
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.04em;
	line-height: 1.2;
}

/* Text body on the left */
body.is-mapsearch #map_results .clsMapInfo .col-xs-9,
body.is-mapsearch #map_results .mapv2-card__body {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	padding: 12px 14px;
	float: none !important;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
}

body.is-mapsearch #map_results .clsMapInfo .col-xs-9 > span:first-child,
body.is-mapsearch #map_results .mapv2-card__title {
	display: block;
	font-size: 14px;
	font-weight: 800;
	color: var(--mapv2-ink);
	line-height: 1.35;
	margin: 0 0 2px;
	/* leave room for heart */
	padding-inline-end: 28px;
}

body.is-mapsearch #map_results .clsMapInfo .col-xs-9 > span:nth-child(2),
body.is-mapsearch #map_results .mapv2-card__price {
	display: block;
	font-size: 16px;
	font-weight: 800;
	color: var(--mapv2-gold) !important;
	margin-top: 4px;
	order: 10;
}

body.is-mapsearch #map_results .mapv2-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	font-size: 12px;
	color: var(--mapv2-muted);
	line-height: 1.4;
}

body.is-mapsearch #map_results .mapv2-card__meta i {
	margin-inline-end: 4px;
	opacity: 0.85;
}

body.is-mapsearch #map_results .mapv2-card__time {
	font-size: 11px;
	color: #9ca3af;
	margin-top: 2px;
}

body.is-mapsearch #map_results .mapv2-card__fav {
	position: absolute;
	top: 10px;
	inset-inline-start: 10px;
	width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #9ca3af;
	font-size: 15px;
	pointer-events: none;
}

body.is-mapsearch #map_results .clearfix {
	display: none !important;
}

/* Pager */
.mapv2-pager,
body.is-mapsearch #map_pager {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 12px 16px;
	border-top: 1px solid var(--mapv2-border);
	background: #fff;
	color: var(--mapv2-ink) !important;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	margin: 0 !important;
}

body.is-mapsearch #map_pager a {
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	background: var(--mapv2-soft);
	color: var(--mapv2-ink) !important;
	text-decoration: none;
}

body.is-mapsearch #map_pager a.disabled {
	opacity: 0.35;
	pointer-events: none;
}

body.is-mapsearch #map_pager a:hover:not(.disabled) {
	background: var(--mapv2-ink);
	color: #fff !important;
}

/* Responsive */
@media (max-width: 1100px) {
	body.is-mapsearch {
		--mapv2-side: 360px;
	}
	.mapv2-styles {
		inset-inline-start: 64px;
		transform: scale(0.92);
		transform-origin: top left;
	}
}

@media (max-width: 900px) {
	.mapv2-page {
		height: auto;
		min-height: 0;
		overflow: visible;
	}
	.mapv2-shell {
		flex-direction: column;
		height: auto;
	}
	.mapv2-map {
		height: 48vh;
		min-height: 280px;
		flex: none;
	}
	.mapv2-side {
		flex: none;
		width: 100%;
		height: auto;
		max-height: none;
		border-inline-start: 0;
		border-top: 1px solid var(--mapv2-border);
	}
	.mapv2-results,
	body.is-mapsearch #map_results {
		max-height: 60vh;
	}
	.mapv2-styles {
		top: 10px;
		inset-inline-start: 10px;
		right: auto;
		max-width: calc(100% - 20px);
		overflow-x: auto;
	}
	body.is-mapsearch .mapboxgl-ctrl-top-left {
		display: none !important;
	}
}
