/**
 * RealNest Maps CSS — Phase 5
 * Leaflet map overrides + pin/popup/cluster styling
 */

/* ─── Map containers ────────────────────────────────────────────────────────── */
.rn-archive-map-wrap,
.rn-single-map-wrap {
	position: relative;
	border-radius: var(--rn-radius-lg, 12px);
	overflow: hidden;
	box-shadow: var(--rn-shadow, 0 4px 6px rgba(0,0,0,.07));
	margin-bottom: 24px;
}

#rn-archive-map,
#rn-single-map,
.rn-block-map {
	width: 100%;
	background: #e8edf0;
	border-radius: inherit;
}

/* ─── No-location placeholder (single map) ──────────────────────────────────── */
.rn-map-no-location {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	background: #F8FAFC;
	border: 1px dashed #CBD5E1;
	border-radius: inherit;
	color: #6B7280;
	font-size: 14px;
	text-align: center;
	padding: 24px;
}

/* ─── Price pin marker ──────────────────────────────────────────────────────── */
.rn-map-pin {
	background: none;
	border: none;
}

.rn-map-pin__label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #0F7173;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 5px 10px;
	border-radius: 20px;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0,0,0,.25);
	position: relative;
	cursor: pointer;
	transition: background 150ms, transform 150ms;
	transform-origin: bottom center;
}

.rn-map-pin__label::after {
	content: '';
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: #0F7173;
	border-bottom-width: 0;
}

.rn-map-pin:hover .rn-map-pin__label,
.rn-map-pin.leaflet-marker-icon-hover .rn-map-pin__label {
	background: #1B2A4A;
	transform: scale(1.05);
}

.rn-map-pin.leaflet-marker-icon-hover .rn-map-pin__label::after {
	border-top-color: #1B2A4A;
}

/* ─── Cluster icon ──────────────────────────────────────────────────────────── */
.rn-cluster {
	background: none;
	border: none;
}

.rn-cluster-icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #1B2A4A;
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,.25);
	display: flex;
	align-items: center;
	justify-content: center;
}

.rn-cluster-icon span {
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
}

/* ─── Popup ─────────────────────────────────────────────────────────────────── */
.rn-popup-container .leaflet-popup-content-wrapper {
	border-radius: 10px;
	padding: 0;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0,0,0,.15);
	border: none;
	min-width: 220px;
}

.rn-popup-container .leaflet-popup-content {
	margin: 0;
	width: 240px !important;
}

.rn-popup-container .leaflet-popup-tip-container {
	display: none;
}

.rn-popup-container .leaflet-popup-close-button {
	top: 8px;
	right: 8px;
	color: rgba(255,255,255,.8);
	font-size: 16px;
	z-index: 2;
	font-weight: 700;
}

.rn-map-popup {
	font-family: inherit;
}

.rn-popup__thumb {
	width: 100%;
	height: 130px;
	object-fit: cover;
	display: block;
}

.rn-popup__body {
	padding: 12px 14px 14px;
}

.rn-popup__price {
	font-size: 16px;
	font-weight: 700;
	color: #0F7173;
	margin-bottom: 4px;
}

.rn-popup__title {
	font-size: 13px;
	font-weight: 600;
	color: #1B2A4A;
	margin-bottom: 8px;
	line-height: 1.3;
}

.rn-popup__specs {
	display: flex;
	gap: 10px;
	margin-bottom: 10px;
}

.rn-popup__spec {
	font-size: 12px;
	color: #6B7280;
}

.rn-popup__btn {
	display: block;
	text-align: center;
}

/* ─── Leaflet control overrides ─────────────────────────────────────────────── */
.leaflet-control-zoom a {
	border-radius: 6px !important;
}

.leaflet-bar {
	border-radius: 8px !important;
	box-shadow: 0 2px 8px rgba(0,0,0,.15) !important;
	border: none !important;
}

.leaflet-bar a {
	border-bottom-color: #e2e8f0 !important;
	color: #1B2A4A !important;
}

.leaflet-bar a:hover {
	background: #f0f5ff !important;
}

/* ─── Archive map layout (side-by-side with results) ────────────────────────── */
.rn-archive-halfmap {
	display: grid;
	grid-template-columns: 1fr 400px;
	gap: 24px;
	align-items: start;
}

.rn-archive-halfmap .rn-archive__search { grid-column: 1 / -1; }

.rn-archive-map-wrap--sticky {
	position: sticky;
	top: 80px;
}

@media (max-width: 960px) {
	.rn-archive-halfmap {
		grid-template-columns: 1fr;
	}
	.rn-archive-map-wrap--sticky { position: static; }
}

/* ─── Marker cluster colour tiers ───────────────────────────────────────────── */
.marker-cluster-small  .rn-cluster-icon { background: #0F7173; }
.marker-cluster-medium .rn-cluster-icon { background: #1B2A4A; }
.marker-cluster-large  .rn-cluster-icon { background: #7E2553; }

/* ─── Search-synchronized refresh indicator ─────────────────────────────────── */
.rn-archive-map-wrap--loading::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,.5);
	z-index: 1000;
	pointer-events: none;
}
