/* Map Plugin for Elementor – Frontend Styles */

.map-plugin-wrapper {
	position: relative;
	width: 100%;
}

/* ── Map Container ── */
.map-plugin-map-container {
	width: 100%;
	height: 400px;
	z-index: 1;
}

/* ── Search Bar ── */
.map-plugin-search-wrapper {
	padding: 12px;
	background-color: #ffffff;
	z-index: 2;
}

.map-plugin-search-bar {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

.map-plugin-search-input {
	flex: 1 1 0%;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
}

.map-plugin-search-input:focus {
	border-color: #0073aa;
}

/* ── Geolocation Button ── */
/* High specificity to override Elementor/theme button resets */
.map-plugin-wrapper .map-plugin-search-bar button.map-plugin-geolocation-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid #0073aa;
	border-radius: 4px;
	background-color: #0073aa;
	cursor: pointer;
	color: #ffffff;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	transition: opacity 0.2s;
	white-space: nowrap;
	flex-shrink: 0;
	width: auto;
	max-width: none;
	overflow: visible;
	box-sizing: border-box;
}

.map-plugin-geolocation-btn svg {
	flex-shrink: 0;
}

.map-plugin-wrapper .map-plugin-search-bar button.map-plugin-geolocation-btn:hover {
	opacity: 0.85;
}

.map-plugin-geolocation-btn.map-plugin-loading {
	opacity: 0.5;
	pointer-events: none;
}

.map-plugin-geolocation-text {
	display: inline;
}

/* ── Reset Button ── */
.map-plugin-wrapper .map-plugin-search-bar button.map-plugin-reset-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid #666666;
	border-radius: 4px;
	background-color: #666666;
	cursor: pointer;
	color: #ffffff;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	transition: opacity 0.2s;
	white-space: nowrap;
	flex-shrink: 0;
	width: auto;
	max-width: none;
	overflow: visible;
	box-sizing: border-box;
}

.map-plugin-reset-btn svg {
	flex-shrink: 0;
}

.map-plugin-wrapper .map-plugin-search-bar button.map-plugin-reset-btn:hover {
	opacity: 0.85;
}

/* ── Autocomplete Dropdown ── */
.map-plugin-autocomplete-dropdown {
	display: none;
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	background: #fff;
	border: 1px solid #d0d0d0;
	border-top: none;
	border-radius: 0 0 4px 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 10;
	max-height: 240px;
	overflow-y: auto;
}

.map-plugin-autocomplete-item {
	padding: 10px 14px;
	cursor: pointer;
	font-size: 14px;
	border-bottom: 1px solid #f0f0f0;
	transition: background-color 0.15s;
}

.map-plugin-autocomplete-item:last-child {
	border-bottom: none;
}

.map-plugin-autocomplete-item:hover {
	background-color: #f5f5f5;
}

.map-plugin-autocomplete-item strong {
	font-weight: 700;
}

/* ── Nearest Results ── */
.map-plugin-nearest-results {
	display: none;
	margin-top: 10px;
}

.map-plugin-nearest-header {
	font-size: 13px;
	font-weight: 600;
	color: #444;
	margin-bottom: 6px;
}

.map-plugin-nearest-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.map-plugin-nearest-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	border: 1px solid #e8e8e8;
	border-radius: 4px;
	margin-bottom: 4px;
	cursor: pointer;
	font-size: 14px;
	transition: background-color 0.15s;
}

.map-plugin-nearest-item:hover {
	background-color: #f5f5f5;
}

.map-plugin-nearest-item:hover .map-plugin-nearest-distance {
	background-color: #ffffff;
	color: #e8f0fe;
}

.map-plugin-nearest-title {
	font-weight: 500;
}

.map-plugin-nearest-distance {
	font-size: 12px;
	color: #333;
	white-space: nowrap;
	margin-left: 12px;
	background-color: #f0f0f0;
	padding: 2px 14px;
	border-radius: 999px;
	transition: background-color 0.15s, color 0.15s;
}

.map-plugin-nearest-item.map-plugin-nearest-active .map-plugin-nearest-distance {
	background-color: #ffffff;
	color: #e8f0fe;
}

.map-plugin-nearest-item.map-plugin-nearest-hidden {
	display: none;
}

button.map-plugin-nearest-load-more {
	display: block;
	width: auto;
	margin-left: auto;
	margin-right: auto;
	padding: 5px 14px;
	margin-top: 4px;
	border: 1px solid #9C61EF;
	border-radius: 20px;
	background-color: #9C61EF;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	color: #ffffff;
	transition: background-color 0.15s;
}

.map-plugin-nearest-load-more:hover {
	background-color: #8A4FDD;
}

/* ── Info Window (Leaflet popup override) ── */
.map-plugin-info-window {
	min-width: 150px;
	max-width: 280px;
}

.map-plugin-info-title {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 600;
}

.map-plugin-info-text {
	font-size: 13px;
	line-height: 1.5;
}

.map-plugin-info-text p {
	margin: 0 0 6px;
}

.map-plugin-info-text p:last-child {
	margin-bottom: 0;
}

.map-plugin-directions-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 14px;
	padding: 6px 14px;
	font-size: 13px;
	line-height: 1.4;
	text-decoration: none;
	border-radius: 4px;
	cursor: pointer;
	box-sizing: border-box;
	transition: background-color 0.2s, color 0.2s;
}

.map-plugin-directions-btn:hover {
	text-decoration: none;
}

/* ── Info Window Buttons Container ── */
.map-plugin-info-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 14px;
}

.map-plugin-info-buttons .map-plugin-directions-btn {
	margin-top: 0;
}

.map-plugin-secondary-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 14px;
	font-size: 13px;
	line-height: 1.4;
	text-decoration: none;
	border-radius: 4px;
	cursor: pointer;
	box-sizing: border-box;
	transition: background-color 0.2s, color 0.2s;
}

.map-plugin-secondary-btn:hover {
	text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 767px) {
	.map-plugin-search-wrapper {
		padding: 8px;
	}

	.map-plugin-search-input {
		font-size: 13px;
		padding: 8px 10px;
		min-width: 0;
	}

	.map-plugin-search-bar {
		flex-wrap: wrap;
		gap: 6px;
	}

	.map-plugin-search-input {
		flex: 1 1 100%;
	}

	.map-plugin-wrapper .map-plugin-search-bar button.map-plugin-geolocation-btn,
	.map-plugin-wrapper .map-plugin-search-bar button.map-plugin-reset-btn {
		flex: 1 1 0%;
	}

	.map-plugin-nearest-item {
		gap: 6px;
	}

	.map-plugin-nearest-title {
		flex: 1 1 0%;
		min-width: 0;
	}

	.map-plugin-nearest-distance {
		flex-shrink: 0;
	}
}
