/* ── SCMM City Map — Frontend ─────────────────────────────────────────────────
 * v1.6.0 — UI refresh (original by Wyarej Ali; backup kept at map.css.bak)
 *
 * Colour still comes from the admin settings via the CSS custom properties
 * injected by the shortcode (--scmm-c-primary, --scmm-c-pin, …), so the plugin's
 * colour pickers keep working. Fallbacks are supplied for safety.
 * ─────────────────────────────────────────────────────────────────────────── */

.scmm-map-wrapper {
	/* Local design tokens (kept separate from the admin colour vars). */
	--scmm-radius: 16px;
	--scmm-radius-sm: 10px;
	--scmm-radius-xs: 8px;
	--scmm-sidebar-w: 300px;
	--scmm-border: #e6e9ee;
	--scmm-text: var(--scmm-c-sidebar-text, #334155);
	--scmm-muted: #64748b;
	--scmm-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .10);
	--scmm-ring: color-mix(in srgb, var(--scmm-c-primary, #06aef7) 35%, transparent);

	position: relative;
	display: flex;
	width: 100%;
	overflow: hidden;
	border: 1px solid var(--scmm-border);
	border-radius: var(--scmm-radius);
	box-shadow: var(--scmm-shadow);
	background: #fff;
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.scmm-map-wrapper .scmm-sidebar {
	width: var(--scmm-sidebar-w);
	min-width: var(--scmm-sidebar-w);
	background: var(--scmm-c-sidebar-bg, #fff);
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--scmm-border);
	z-index: 10;
	overflow: hidden;
	transition: width .28s ease, min-width .28s ease;
}

.scmm-map-wrapper .scmm-sidebar.collapsed {
	width: 0;
	min-width: 0;
	border-right-color: transparent;
}

.scmm-map-wrapper .scmm-sidebar-header {
	padding: 18px 18px 16px;
	background: var(--scmm-c-primary, #06aef7);
	color: var(--scmm-c-button-text, #fff);
	flex-shrink: 0;
}

.scmm-map-wrapper .scmm-sidebar-header h3 {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 14px;
	padding: 0;
	font-size: 1.0625rem;
	font-weight: 700;
	letter-spacing: -.01em;
	line-height: 1.2;
	color: var(--scmm-c-button-text, #fff);
}

.scmm-map-wrapper .scmm-sidebar-header h3 i {
	font-size: .95em;
	opacity: .9;
}

/* Location count pill */
.scmm-map-wrapper .scmm-sidebar-header h3 .scmm-count {
	margin-left: auto;
	padding: 2px 9px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .22);
	font-size: .75rem;
	font-weight: 600;
	line-height: 1.5;
}

/* Search field — solid surface instead of a washed-out translucent box. */
.scmm-map-wrapper .scmm-search-wrap {
	display: flex;
	align-items: stretch;
	background: #fff;
	border: 1px solid transparent;
	border-radius: var(--scmm-radius-sm);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
	transition: box-shadow .18s ease;
}

.scmm-map-wrapper .scmm-search-wrap:focus-within {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, .55);
}

.scmm-map-wrapper #scmm-city-search {
	flex: 1;
	min-width: 0;
	margin: 0;
	border: none;
	background: transparent;
	padding: 10px 12px;
	font-size: .875rem;
	line-height: 1.4;
	color: #1f2937;
	outline: none;
	box-shadow: none;
}

.scmm-map-wrapper #scmm-city-search::placeholder {
	color: #9aa4b2;
}

.scmm-map-wrapper #scmm-search-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 0;
	background: var(--scmm-c-primary-dk, #0490cf);
	color: var(--scmm-c-button-text, #fff);
	font-size: .9rem;
	cursor: pointer;
	transition: background .18s ease;
}

.scmm-map-wrapper #scmm-search-btn:hover,
.scmm-map-wrapper #scmm-search-btn:focus-visible {
	background: color-mix(in srgb, var(--scmm-c-primary-dk, #0490cf) 85%, #000);
}

.scmm-map-wrapper #scmm-search-status {
	margin-top: 9px;
	min-height: 16px;
	font-size: .75rem;
	line-height: 1.35;
	color: rgba(255, 255, 255, .85);
}

.scmm-map-wrapper #scmm-search-status.error   { color: #ffd7d2; }
.scmm-map-wrapper #scmm-search-status.success { color: #d6ffe6; }
.scmm-map-wrapper #scmm-search-status.loading { color: rgba(255, 255, 255, .7); }

/* ── City list ────────────────────────────────────────────────────────────── */
.scmm-map-wrapper .scmm-city-list {
	flex: 1;
	margin: 0;
	padding: 6px 0 !important;
	list-style: none;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}

.scmm-map-wrapper .scmm-city-list::-webkit-scrollbar { width: 8px; }
.scmm-map-wrapper .scmm-city-list::-webkit-scrollbar-track { background: transparent; }
.scmm-map-wrapper .scmm-city-list::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border: 2px solid #fff;
	border-radius: 999px;
}
.scmm-map-wrapper .scmm-city-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.scmm-map-wrapper .scmm-city-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 11px 14px 11px 16px;
	border: 0;
	border-bottom: 1px solid #f1f4f8;
	font-size: .9rem;
	line-height: 1.35;
	color: var(--scmm-text);
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.scmm-map-wrapper .scmm-city-item:last-child { border-bottom: 0; }

/* Left accent bar — grows in on hover, solid when active. */
.scmm-map-wrapper .scmm-city-item::before {
	content: "";
	position: absolute;
	left: 0;
	top: 6px;
	bottom: 6px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--scmm-c-primary, #06aef7);
	transform: scaleY(0);
	transform-origin: center;
	transition: transform .18s ease;
}

.scmm-map-wrapper .scmm-city-item:hover {
	background: var(--scmm-c-primary-lt, #e8f4fd);
}

.scmm-map-wrapper .scmm-city-item:hover::before { transform: scaleY(.6); }

.scmm-map-wrapper .scmm-city-item.active {
	background: var(--scmm-c-primary-lt, #e8f4fd);
	color: var(--scmm-c-primary-dk, #0490cf);
	font-weight: 600;
}

.scmm-map-wrapper .scmm-city-item.active::before { transform: scaleY(1); }

.scmm-map-wrapper .scmm-city-item:focus-visible {
	outline: 2px solid var(--scmm-c-primary, #06aef7);
	outline-offset: -2px;
}

.scmm-map-wrapper .scmm-city-item.hidden { display: none; }

/* Search result rows sit visually apart from real service areas. */
.scmm-map-wrapper .scmm-city-item.searched {
	background: #fff8f0;
	color: #9a5b18;
}
.scmm-map-wrapper .scmm-city-item.searched::before {
	background: var(--scmm-c-pin-search, #e67e22);
}
.scmm-map-wrapper .scmm-city-item.searched:hover { background: #fff1e0; }

.scmm-map-wrapper .scmm-pin-icon {
	flex-shrink: 0;
	width: 20px;
	text-align: center;
	font-size: .9rem;
	color: var(--scmm-c-pin, #06aef7);
	opacity: .85;
}

.scmm-map-wrapper .scmm-city-item.searched .scmm-pin-icon { color: var(--scmm-c-pin-search, #e67e22); }
.scmm-map-wrapper .scmm-city-item.active .scmm-pin-icon { opacity: 1; }

.scmm-map-wrapper .scmm-city-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.scmm-map-wrapper .scmm-arrow {
	flex-shrink: 0;
	font-size: .68rem;
	color: currentColor;
	opacity: .3;
	transition: opacity .15s ease, transform .15s ease;
}

.scmm-map-wrapper .scmm-city-item:hover .scmm-arrow,
.scmm-map-wrapper .scmm-city-item.active .scmm-arrow {
	opacity: .9;
	transform: translateX(3px);
}

/* ── Map area ─────────────────────────────────────────────────────────────── */
.scmm-map-wrapper .scmm-map-container {
	position: relative;
	flex: 1;
	min-width: 0;
	background: #eef2f6;
}

.scmm-map-wrapper #scmm-map {
	width: 100%;
	height: 100%;
}

/* Sidebar toggle — top-RIGHT so it never collides with Leaflet's zoom control
   (which sits top-left). High specificity + explicit values so theme/Elementor
   button styles cannot bleed in. */
.scmm-map-wrapper .scmm-sidebar-toggle {
	position: absolute;
	top: 12px;
	right: 12px;
	left: auto;
	z-index: 1000;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(16, 24, 40, .1) !important;
	border-radius: var(--scmm-radius-sm);
	background: #fff !important;
	color: #334155 !important;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(16, 24, 40, .16);
	transition: background .18s ease, color .18s ease, transform .18s ease;
}

.scmm-map-wrapper .scmm-sidebar-toggle:hover {
	background: var(--scmm-c-primary, #06aef7) !important;
	color: var(--scmm-c-button-text, #fff) !important;
}

.scmm-map-wrapper .scmm-sidebar-toggle:focus-visible {
	outline: 3px solid var(--scmm-ring);
	outline-offset: 2px;
}

/* Leaflet native controls, restyled to match. */
.scmm-map-wrapper .leaflet-control-zoom {
	border: none !important;
	border-radius: var(--scmm-radius-sm) !important;
	overflow: hidden;
	box-shadow: 0 2px 6px rgba(16, 24, 40, .16) !important;
}

.scmm-map-wrapper .leaflet-control-zoom a {
	width: 34px;
	height: 34px;
	line-height: 34px;
	border: none !important;
	background: #fff;
	color: #334155;
	font-size: 17px;
	transition: background .15s ease, color .15s ease;
}

.scmm-map-wrapper .leaflet-control-zoom a:hover {
	background: var(--scmm-c-primary-lt, #e8f4fd);
	color: var(--scmm-c-primary-dk, #0490cf);
}

.scmm-map-wrapper .leaflet-control-attribution {
	border-radius: var(--scmm-radius-xs) 0 0 0;
	font-size: 10px;
	background: rgba(255, 255, 255, .85);
}

/* ── Map pins (divIcon) ───────────────────────────────────────────────────── */
.scmm-leaflet-pin {
	position: relative;
	background: transparent !important;
	border: none !important;
}

.scmm-leaflet-pin::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: 28px;
	height: 28px;
	margin-left: -14px;
	background: var(--scmm-c-pin, #06aef7);
	border: 2.5px solid #fff;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	box-shadow: 0 3px 8px rgba(16, 24, 40, .3);
	transition: transform .18s ease;
}

.scmm-leaflet-pin i {
	position: absolute;
	top: 7px;
	left: 0;
	right: 0;
	z-index: 1;
	text-align: center;
	font-size: 12px;
	line-height: 1;
	color: #fff;
	text-shadow: none;
}

.scmm-leaflet-pin:hover::before {
	transform: rotate(-45deg) scale(1.12);
}

.scmm-leaflet-pin.is-search::before {
	background: var(--scmm-c-pin-search, #e67e22);
}

/* ── Popup ────────────────────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
	border-radius: 14px !important;
	box-shadow: 0 8px 28px rgba(16, 24, 40, .22) !important;
	padding: 4px;
}

.leaflet-popup-content {
	margin: 12px 14px;
}

.scmm-popup-inner {
	min-width: 190px;
	text-align: center;
}

.scmm-popup-inner h4 {
	margin: 0 0 9px;
	padding: 0;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.25;
	color: #101828;
}

.scmm-popup-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-bottom: 12px;
	padding: 4px 11px;
	border-radius: 999px;
	background: var(--scmm-c-primary-lt, #e8f4fd);
	color: var(--scmm-c-primary-dk, #0490cf);
	font-size: .7rem;
	font-weight: 600;
	letter-spacing: .01em;
}

.scmm-popup-badge.external {
	background: #fff3e0;
	color: var(--scmm-c-pin-search, #e67e22);
}

.scmm-popup-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin-top: 2px;
	padding: 9px 18px;
	border-radius: var(--scmm-radius-sm);
	background: var(--scmm-c-primary, #06aef7);
	color: var(--scmm-c-button-text, #fff) !important;
	font-size: .82rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	transition: background .18s ease, transform .15s ease, box-shadow .18s ease;
}

.scmm-popup-btn:hover {
	background: var(--scmm-c-primary-dk, #0490cf);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(16, 24, 40, .18);
}

.scmm-popup-btn:focus-visible {
	outline: 3px solid var(--scmm-ring);
	outline-offset: 2px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 782px) {
	.scmm-map-wrapper {
		flex-direction: column;
		border-radius: var(--scmm-radius-sm);
	}

	.scmm-map-wrapper .scmm-sidebar {
		width: 100% !important;
		min-width: 100% !important;
		max-height: 260px;
		border-right: none;
		border-bottom: 1px solid var(--scmm-border);
		transition: max-height .28s ease;
	}

	.scmm-map-wrapper .scmm-sidebar.collapsed {
		max-height: 0;
		border-bottom-color: transparent;
	}

	.scmm-map-wrapper .scmm-sidebar-header { padding: 14px 14px 12px; }
	.scmm-map-wrapper .scmm-map-container { min-height: 380px; }
	.scmm-map-wrapper .scmm-city-item { padding: 13px 14px 13px 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.scmm-map-wrapper *,
	.scmm-leaflet-pin::before {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
	}
}
