/* =========================================================
   Leaflet CPT Map Pro – Front-End Map Styles
   by yoki
   ========================================================= */

/* ── Wrapper ───────────────────────────────────────────── */
.lcpm-wrap {
	width: 100%;
	position: relative;
}

.lcpm-map {
	width: 100%;
	border-radius: 10px;
	overflow: hidden;
	background: #f0ede8;
	box-shadow: 0 4px 32px rgba(0,0,0,.12);
	z-index: 0;
}

/* ── Loading overlay ───────────────────────────────────── */
.lcpm-loading {
	position: absolute;
	inset: 0;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(248,246,242,.92);
	backdrop-filter: blur(6px);
	border-radius: 10px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #6b6560;
	pointer-events: none;
	transition: opacity .35s ease;
}

.lcpm-loading.is-hidden {
	opacity: 0;
}

.lcpm-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #ddd9d3;
	border-top-color: #e63946;
	border-radius: 50%;
	animation: lcpm-spin .7s linear infinite;
}

@keyframes lcpm-spin {
	to { transform: rotate(360deg); }
}

/* ── Error notice ──────────────────────────────────────── */
.lcpm-error {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(248,246,242,.95);
	border-radius: 10px;
	z-index: 1000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 14px;
	color: #c0392b;
	padding: 24px;
	text-align: center;
}

/* ── Leaflet popup overrides ───────────────────────────── */
.leaflet-popup {
	margin-bottom: 20px;
}

.leaflet-popup-content-wrapper {
	border-radius: 8px !important;
	box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
	border: none !important;
	padding: 0 !important;
	overflow: hidden;
	/* Fixed width — wide enough for JetEngine listing content */
	width: 320px !important;
	max-width: 320px !important;
}

.leaflet-popup-content {
	margin: 0 !important;
	/* Override Leaflet's inline width so our wrapper controls it */
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}

/* ── Close button — sits above content, always visible ─── */
.leaflet-popup-close-button {
	position: absolute !important;
	top: 6px !important;
	right: 6px !important;
	z-index: 9999 !important;
	width: 28px !important;
	height: 28px !important;
	background: rgba(0,0,0,.45) !important;
	border-radius: 50% !important;
	color: #fff !important;
	font-size: 18px !important;
	line-height: 28px !important;
	text-align: center !important;
	text-decoration: none !important;
	display: block !important;
	padding: 0 !important;
}

.leaflet-popup-close-button:hover {
	background: rgba(0,0,0,.7) !important;
	color: #fff !important;
}

.leaflet-popup-tip-container {
	margin-top: -1px;
}

/* ── Built-in popup card (fallback) ────────────────────── */
.lcpm-popup-card {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	width: 100%;
}

.lcpm-popup-thumb {
	width: 100%;
	overflow: hidden;
	height: 160px;
	background: #ddd9d3;
}

.lcpm-popup-thumb img {
	width: 100%;
	height: 160px;
	object-fit: cover;
	display: block;
}

.lcpm-popup-body {
	padding: 14px 16px 16px;
}

.lcpm-popup-title {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	padding-right: 20px; /* avoid overlap with close button */
}

.lcpm-popup-title a {
	color: #1a1714;
	text-decoration: none;
}

.lcpm-popup-title a:hover {
	color: #e63946;
}

.lcpm-popup-address {
	margin: 0 0 6px;
	font-size: 12px;
	color: #6b6560;
}

.lcpm-popup-excerpt {
	margin: 0 0 10px;
	font-size: 12px;
	color: #4a4540;
	line-height: 1.5;
}

.lcpm-popup-link {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	color: #e63946;
	text-decoration: none;
	letter-spacing: .02em;
}

.lcpm-popup-link:hover {
	text-decoration: underline;
}

/* ── Popup loading spinner (AJAX) ──────────────────────── */
.lcpm-popup-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	width: 320px;
}

.lcpm-popup-spinner {
	width: 24px;
	height: 24px;
	border: 2px solid #e0ddd8;
	border-top-color: #e63946;
	border-radius: 50%;
	animation: lcpm-spin .7s linear infinite;
}

/* ── JetEngine / Elementor popup content ───────────────── */
/* Constrain Elementor content inside the fixed-width popup */
.lcpm-popup .elementor,
.lcpm-popup .elementor-section-wrap,
.lcpm-popup .e-con,
.lcpm-popup .elementor-container {
	width: 100% !important;
	max-width: 100% !important;
	min-width: unset !important;
}

.lcpm-popup .elementor-section {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Featured image inside JetEngine listing popup */
.lcpm-popup .elementor-widget-jet-listing-dynamic-field img,
.lcpm-popup .elementor-widget-jet-engine-listing-dynamic-link img,
.lcpm-popup img {
	width: 100% !important;
	height: auto !important;
	display: block;
	object-fit: cover;
}

/* ── Marker cluster ────────────────────────────────────────────────────────── */
.lcpm-cluster-wrap {
	background: transparent !important;
	border: none !important;
}

.lcpm-cluster {
	border-radius: 50%;
	background: #4a3f6b;
	border: 3px solid rgba(255,255,255,0.9);
	box-shadow: 0 3px 14px rgba(0,0,0,0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}

.lcpm-cluster:hover {
	transform: scale(1.12);
	box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.lcpm-cluster span {
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	line-height: 1;
	letter-spacing: -0.02em;
}

/* Override default markercluster styles */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
	background: transparent !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
	background: transparent !important;
}
