/* Cargus Mapbox Integration Styles */

/* Hide WooCommerce shipping debug zone notices on checkout 
   These notices show "Customer matched zone" / "Zona corespunzătoare clientului"
   Added class .hide-zone-notice via JS for dynamic hiding */
.woocommerce-checkout .hide-zone-notice,
.woocommerce-checkout .woocommerce-info.hide-zone-notice {
	display: none !important;
}

/* Modal overlay - fullscreen backdrop */

.cargus-mapbox-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.85);
	z-index: 9999;
	display: none;
	justify-content: center;
	align-items: center;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	transition: none !important;
}

.cargus-mapbox-modal[style*="display: flex"] {
	display: flex !important;
	transition: none !important;
}

/* Main container with sidebar + map */
.cargus-mapbox-container {
	display: flex;
	width: 100vw;
	max-width: 1400px;
	height: 90vh;
	max-height: 900px;
	background: white;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	box-sizing: border-box;
	margin: 0;
}

/* Sidebar with search, filters, and list */
.cargus-mapbox-sidebar {
	width: 380px;
	background: #f8f9fa;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-right: 1px solid #dee2e6;
}

/* Search container */
.cargus-search-container {
	padding: 20px;
	background: white;
	border-bottom: 1px solid #dee2e6;
}

/* Fix geocoder input padding and width */
.mapboxgl-ctrl-geocoder {
	width: 100% !important;
	max-width: none !important;
}

.mapboxgl-ctrl-geocoder--input {
	padding-left: 45px !important;
	font-size: 14px;
	height: 42px;
	width: 100% !important;
	padding-right: 26px;
}

.mapboxgl-ctrl-geocoder--icon-search {
	left: 12px !important;
}

/* Remove bullet points from geocoder suggestions */
.mapboxgl-ctrl-geocoder .suggestions li {
	list-style: none !important;
}

.mapboxgl-ctrl-geocoder .suggestions li::marker {
	display: none !important;
	content: '' !important;
}

/* Filter buttons */
.cargus-filter-buttons {
	display: flex;
	gap: 8px;
	padding: 15px 20px;
	background: white;
	border-bottom: 1px solid #dee2e6;
}

.cargus-filter-btn {
	flex: 1;
	padding: 10px 12px;
	border: 2px solid #dee2e6;
	background: white;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s ease;
	color: #495057;
}

.cargus-filter-btn:hover {
	border-color: #1B1F22;
	background: #1B1F22;
	color: white;
	transform: translateY(-1px);
}

.cargus-filter-btn.active {
	border-color: #1B1F22;
	background: #1B1F22;
	color: white;
}

/* Locations list */
.cargus-locations-list {
	flex: 1;
	overflow-y: auto;
	padding: 15px;
}

.cargus-location-item {
	background: white;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	padding: 15px;
	margin-bottom: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.cargus-location-item:hover {
	border-color: #0d6efd;
	box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
	transform: translateX(2px);
}

.cargus-location-item.active {
	border-color: #0d6efd;
	background: #f0f7ff;
}

.cargus-location-name {
	font-weight: 600;
	font-size: 14px;
	color: #212529;
	margin-bottom: 6px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.cargus-location-type {
	display: inline-block;
	padding: 2px 8px;
	background: #e7f3ff;
	color: #0d6efd;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
}

.cargus-location-address {
	font-size: 13px;
	color: #6c757d;
	margin-bottom: 8px;
	line-height: 1.4;
}

.cargus-location-hours {
	font-size: 12px;
	color: #28a745;
	font-weight: 500;
}

.cargus-location-hours.closed {
	color: #dc3545;
}

/* Map container */
#map {
	flex: 1;
	height: 100%;
	width: 100%;
	min-height: 400px;
	position: relative;
	box-sizing: border-box;
	margin: 0;
}

/* Improve canvas rendering for sharpness */
#map canvas {
	image-rendering: auto;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
}

/* Custom marker styles - using brand color #1B1F22 */
.cargus-marker {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 3px solid white;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	transition: none;
	/* Remove transition to prevent animation delay */
	transform: translateZ(0);
	/* Force GPU acceleration */
	backface-visibility: hidden;
	/* Prevent flickering */
	perspective: 1000px;
	/* Enable 3D rendering */
}

.cargus-marker-locker {
	background-color: #1B1F22;
}

.cargus-marker-office {
	background-color: #6c757d;
}

.cargus-marker:hover {
	transform: scale(1.2) translateZ(0);
	z-index: 100;
}

.cargus-marker.active {
	background-color: #dc3545;
	transform: scale(1.3) translateZ(0);
	z-index: 101;
	border-color: #ffc107;
	border-width: 4px;
}

/* Cluster marker styles */
.cargus-cluster-marker {
	transition: none;
	/* Remove transition to prevent scroll delay */
	will-change: auto;
	transform: translateZ(0);
}

.cargus-cluster-marker:hover {
	transform: scale(1.15) translateZ(0);
	transition: transform 0.15s ease;
	/* Only animate on hover */
}

/* Popup styles */
.mapboxgl-popup {
	max-width: 320px !important;
}

.mapboxgl-popup-content {
	padding: 15px;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	max-width: 320px;
	overflow: hidden;
}

.cargus-location-popup .mapboxgl-popup-content {
	max-height: 80vh;
	/* Don't exceed 80% of viewport height */
	overflow-y: auto;
	/* Allow scrolling if content is too tall */
}

.mapboxgl-popup-content h4 {
	margin: 0 0 10px 0;
	font-size: 14px;
	font-weight: 600;
}

.mapboxgl-popup-content p {
	margin: 5px 0;
	font-size: 12px;
	color: #6c757d;
}

/* Close button */
.cargus-mapbox-modal::before {
	content: '✕';
	position: absolute;
	top: 30px;
	right: 30px;
	font-size: 28px;
	color: white;
	cursor: pointer;
	z-index: 10000;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 50%;
	transition: all 0.2s ease;
}

.cargus-mapbox-modal::before:hover {
	background: rgba(0, 0, 0, 0.9);
	transform: rotate(90deg);
}

/* Responsive - Mobile optimized */
@media (max-width: 768px) {
	.cargus-mapbox-modal {
		padding: 0;
		/* Remove padding on mobile for full screen */
	}

	.cargus-mapbox-container {
		flex-direction: column;
		width: 100%;
		height: 100vh;
		max-height: none;
		border-radius: 0;
		/* Full screen on mobile */
	}

	.cargus-mapbox-sidebar {
		width: 100%;
		height: auto;
		/* Auto height to fit content only */
		min-height: auto;
		border-right: none;
		border-bottom: 1px solid #dee2e6;
	}

	/* Keep search visible, only hide location list on mobile */
	.cargus-locations-list {
		display: none !important;
	}

	/* Adjust search container for mobile */
	.cargus-search-container {
		padding: 15px;
	}

	/* Keep filter buttons visible but adjust */
	.cargus-filter-buttons {
		padding: 12px 15px;
		gap: 6px;
	}

	.cargus-filter-btn {
		padding: 8px 10px;
		font-size: 12px;
	}

	/* Map takes remaining space */
	#map {
		flex: 1;
		height: auto;
		/* Let it fill remaining space */
	}

	/* Close button adjustment for mobile */
	.cargus-mapbox-modal::before {
		top: 15px;
		right: 15px;
		font-size: 24px;
		width: 36px;
		height: 36px;
	}
}

/* Override MapboxGeocoder search bar */
.mapboxgl-ctrl-geocoder {
	max-width: 100% !important;
	border-radius: 8px !important;
	box-shadow: none !important;
}

ul.suggestions {
	border: 1px solid #d7d7d7;
}

.pickup-point-info-container {
	padding: 10px;
	background: #fff3cd;
	border: 1px solid #ffda67;
	border-radius: 8px;
	margin: 0;
	margin-bottom: 8px;
	font-size: 12px;
	text-align: center;
}

.mapboxgl-ctrl-geocoder--powered-by {
	width: 100%;
	border-top: 1px solid #d7d7d7;
}

/** Close icon adjustments */
.mapboxgl-ctrl-geocoder--icon-search {
	top: 11px;
}

.mapboxgl-ctrl-geocoder--icon-close {
	width: 20px;
	height: 20px;
	margin-top: 8px;
	margin-right: 3px;
}

.mapboxgl-ctrl-geocoder--button:hover .mapboxgl-ctrl-geocoder--icon-close {
	fill: #757575;
}

.mapboxgl-ctrl-geocoder--button {
	background: transparent;
	top: 10px !important;
}

.mapboxgl-ctrl button:not(:disabled):hover {
	background-color: transparent !important;
}

@media screen and (min-width: 640px) {
	.mapboxgl-ctrl-geocoder--icon-search {
		left: 7px;
		width: 20px;
		height: 20px;
	}

	.mapboxgl-ctrl-geocoder--icon-close {
		width: 16px;
		height: 16px;
		margin-top: 3px;
		margin-right: 0;
	}

	.mapbox-gl-geocoder--error {
		font-size: 12px;
		padding-bottom: 11px;
	}
}