/**
 * Project Map - Frontend Styles
 *
 * @package Project_Map
 */

/* Map Container */
.project-map-container {
	position: relative;
	width: 100%;
	height: 70vh;
	margin: 20px 0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.project-map {
	width: 100%;
	height: 100%;
}

/* Empty State */
.project-map-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	background: #f5f5f5;
	color: #666;
	font-size: 16px;
}

.project-map-empty p {
	margin: 0;
}

/* Popup Styles */
.maplibregl-popup-content {
	padding: 0;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	min-width: 200px;
	max-width: 300px;
}

.project-map-popup {
	padding: 15px;
}

.project-map-popup img {
	width: 100%;
	height: auto;
	display: block;
	margin-top: 10px;
	margin-bottom: 10px;
	border-radius: 4px;
}

.project-map-popup h3 {
	margin: 0 0 10px 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
}

.project-map-popup h3 a {
	color: #333;
	text-decoration: none;
	transition: color 0.2s ease;
}

.project-map-popup h3 a:hover {
	color: #0073aa;
}

.project-map-popup p {
	margin: 0 0 10px 0;
	font-size: 14px;
	line-height: 1.5;
	color: #666;
}

.project-map-popup p.category {
	font-size: 12px;
	color: #999;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin: 5px 0 0 0;
}

.project-map-link {
	display: inline-block;
	color: #0073aa;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: color 0.2s ease;
}

.project-map-link:hover {
	color: #005177;
}

/* Popup Close Button */
.maplibregl-popup-close-button {
	font-size: 20px;
	padding: 5px 10px;
	color: #999;
	transition: color 0.2s ease;
}

.maplibregl-popup-close-button:hover {
	color: #333;
	background: transparent;
}

/* Map Controls */
.maplibregl-ctrl-top-right {
	top: auto;
	bottom: 50px;
	right: 10px;
}

.maplibregl-ctrl-group {
	border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.maplibregl-ctrl-group button {
	width: 30px;
	height: 30px;
}

/* Marker Labels */
.maplibregl-canvas-container {
	cursor: default;
}

/* Text labels are rendered on canvas with white halo effect via MapLibre paint properties */

/* Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
	/* Tablet */
	.project-map-container {
		height: 60vh;
	}
}

@media (max-width: 768px) {
	/* Mobile */
	.project-map-container {
		height: 80vh;
		margin: 15px 0;
	}

	.maplibregl-popup-content {
		max-width: 250px;
	}

	.project-map-popup {
		padding: 12px;
	}

	.project-map-popup h3 {
		font-size: 14px;
	}

	.project-map-popup p {
		font-size: 13px;
	}
}

/* Loading State */
.project-map-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	background: #f5f5f5;
}

.project-map-loading::after {
	content: '';
	width: 40px;
	height: 40px;
	border: 4px solid #ddd;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: project-map-spin 0.8s linear infinite;
}

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

/* Cluster Styling */
.maplibregl-marker {
	cursor: pointer;
}

/* Attribution */
.maplibregl-ctrl-attrib {
	font-size: 11px;
	background-color: rgba(255, 255, 255, 0.8);
}

.maplibregl-ctrl-attrib a {
	color: #0073aa;
}

/* Tiny Map Preview */
.project-map-tiny-wrapper {
	display: inline-block;
	position: relative;
}

.project-map-tiny {
	position: relative;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	cursor: pointer;
}

.project-map-tiny:hover {
	transform: scale(1.02);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
	cursor: pointer;
}

.project-map-expand-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
	padding: 55px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: white;
	font-size: 14px;
	font-weight: 500;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
	cursor: pointer;
}

.project-map-tiny:hover .project-map-expand-overlay {
	opacity: 1;
}

.project-map-expand-icon {
	font-size: 20px;
}

/* Modal */
.project-map-modal {
	display: none;
	position: fixed;
	z-index: 9999999;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background-color: rgba(0, 0, 0, 0.8);
	align-items: center;
	justify-content: center;
	padding: 20px;
	animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.project-map-modal-content {
	position: relative;
	width: 100%;
	max-width: 1200px;
	max-height: 90vh;
	background: white;
	border-radius: 8px;
	overflow: show;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	animation: slideIn 0.3s ease;
}

@keyframes slideIn {
	from {
		transform: translateY(-50px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.project-map-modal-close {
	position: absolute;
	top: -50px;
	right: 0;
	z-index: 1000000;
	background: white;
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	font-size: 32px;
	line-height: 40px;
	cursor: pointer;
	color: #666;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	font-family: Arial, sans-serif;
}

.project-map-modal-close:hover {
	background: #f5f5f5;
	color: #333;
	transform: scale(1.1);
}

.project-map-modal-map {
	height: 80vh !important;
	max-height: 800px;
	margin: 0;
	border-radius: 8px;
}

/* Tiny map has fixed height */
.project-map-tiny {
	height: 300px !important;
}

/* Responsive Modal */
@media (max-width: 768px) {
	.project-map-modal {
		padding: 10px;
	}
	
	.project-map-modal-content {
		max-height: 95vh;
	}
	
	.project-map-modal-map {
		height: 70vh !important;
	}
	
	.project-map-tiny {
		width: 100% !important;
		max-width: 370px;
	}
}