/**
 * Maps Pin - Frontend Public Stylesheet
 * Responsive, Lightweight, Interactive SVG Vector Map with Popup & Hyperlink
 * Author: Mico Kelana (https://www.kelanasolution.com)
 */

.maps-pin-container {
	position: relative;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	margin: 20px auto;
	user-select: none;
}

.maps-pin-canvas-wrapper {
	position: relative;
	width: 100%;
	background-color: #f8fafc;
	border-radius: 16px;
	overflow: visible;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.maps-pin-svg {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: auto;
	border-radius: 16px;
	overflow: hidden;
}

/* ==========================================================================
   Interactive SVG District Polygons
   ========================================================================== */
.mp-district-polygon {
	cursor: pointer;
	transition: filter 0.25s ease, opacity 0.25s ease, stroke 0.25s ease, stroke-width 0.25s ease;
}

.mp-district-polygon:hover,
.mp-district-polygon.is-highlighted {
	filter: brightness(1.08) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.12));
	stroke: #2563eb !important;
	stroke-width: 3.5px !important;
}

/* ==========================================================================
   Overlay Pins & Markers
   ========================================================================== */
.maps-pin-markers-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.mp-pin-marker {
	position: absolute;
	transform: translate(-50%, -100%);
	pointer-events: auto;
	cursor: pointer;
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), z-index 0.1s ease;
}

.mp-pin-marker:hover,
.mp-pin-marker.is-active {
	z-index: 30;
	transform: translate(-50%, -108%);
}

.mp-pin-icon-wrap {
	position: relative;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

.mp-pin-svg-icon {
	width: 32px;
	height: 32px;
	display: block;
	position: relative;
	z-index: 2;
}

/* Pulse animation circle behind pin */
.mp-pin-pulse {
	position: absolute;
	bottom: 2px;
	left: 50%;
	transform: translateX(-50%);
	width: 12px;
	height: 6px;
	border-radius: 50%;
	background: rgba(234, 67, 53, 0.4);
	animation: mpPinPulseAnim 2.2s infinite ease-out;
	z-index: 1;
}

@keyframes mpPinPulseAnim {
	0% {
		transform: translateX(-50%) scale(1);
		opacity: 0.8;
	}
	70% {
		transform: translateX(-50%) scale(2.8);
		opacity: 0;
	}
	100% {
		transform: translateX(-50%) scale(3.2);
		opacity: 0;
	}
}

/* Label Pill matching Reference Image */
.mp-pin-pill-label {
	margin-top: 4px;
	background: #ffffff;
	padding: 4px 10px;
	border-radius: 9999px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08);
	border: 1px solid rgba(0, 0, 0, 0.04);
	white-space: nowrap;
	pointer-events: auto;
	transition: all 0.2s ease;
}

.mp-pin-pill-title {
	font-size: 11px;
	font-weight: 700;
	color: #1e293b;
	letter-spacing: -0.01em;
}

.mp-pin-marker:hover .mp-pin-pill-label {
	background: #2563eb;
	color: #ffffff;
	transform: translateY(2px);
}

.mp-pin-marker:hover .mp-pin-pill-title {
	color: #ffffff;
}

/* ==========================================================================
   Interactive Floating Popup Card
   ========================================================================== */
.mp-pin-popup-card {
	position: absolute;
	bottom: calc(100% + 14px);
	left: 50%;
	transform: translateX(-50%) scale(0.92);
	background: #ffffff;
	border-radius: 12px;
	padding: 16px;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.18), 0 10px 10px -5px rgba(0, 0, 0, 0.06);
	border: 1px solid #e2e8f0;
	width: 250px;
	max-width: min(280px, calc(100vw - 32px));
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 100;
}

/* Triangle pointing down to pin (default when popup is above pin) */
.mp-pin-popup-card::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-width: 7px;
	border-style: solid;
	border-color: #ffffff transparent transparent transparent;
}

/* Popup opens BELOW pin when pin is in top section (e.g. Serpong Utara, Ciputat Timur) */
.mp-pin-marker.mp-pos-bottom .mp-pin-popup-card {
	bottom: auto;
	top: calc(100% + 14px);
}

/* Triangle pointing UP to pin */
.mp-pin-marker.mp-pos-bottom .mp-pin-popup-card::after {
	top: auto;
	bottom: 100%;
	border-color: transparent transparent #ffffff transparent;
}

.mp-pin-marker.is-active {
	z-index: 110;
}

.mp-pin-marker.is-active .mp-pin-popup-card {
	opacity: 1;
	pointer-events: auto;
	transform: translateX(-50%) scale(1);
}

.mp-pin-popup-header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.mp-pin-popup-badge-icon {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.mp-pin-popup-title {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
	margin: 0;
	flex-grow: 1;
}

.mp-pin-popup-close {
	background: transparent;
	border: none;
	font-size: 18px;
	line-height: 1;
	color: #94a3b8;
	cursor: pointer;
	padding: 0;
}

.mp-pin-popup-close:hover {
	color: #0f172a;
}

.mp-pin-popup-sub {
	font-size: 11px;
	color: #64748b;
	margin-bottom: 8px;
	font-weight: 500;
}

.mp-pin-popup-body {
	font-size: 12px;
	line-height: 1.5;
	color: #334155;
	margin-bottom: 12px;
}

.mp-pin-popup-footer {
	margin-top: 8px;
}

.mp-pin-popup-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 8px 12px;
	background: #2563eb;
	color: #ffffff;
	text-decoration: none;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	transition: background 0.2s ease;
	box-sizing: border-box;
}

.mp-pin-popup-btn:hover {
	background: #1d4ed8;
	color: #ffffff;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 640px) {
	.mp-pin-pill-title {
		font-size: 9px;
	}
	.mp-pin-pill-label {
		padding: 2px 6px;
	}
	.mp-pin-icon-wrap {
		width: 24px;
		height: 24px;
	}
	.mp-pin-svg-icon {
		width: 24px;
		height: 24px;
	}
	.mp-pin-popup-card {
		width: 200px;
	}
}
