/* ===========================================================================
   Nova Lume Dealer Map
   Branding tokens (taken from the Nova Lume client portal):
     --nl-green:        #259B76
     --nl-green-hover:  #1e8a68
     --nl-green-soft:   #eef7f3
     --nl-green-border: #c8e6da
     --nl-text:         #374151
     --nl-text-soft:    #6b7280
     --nl-text-faint:   #9ca3af
     --nl-bg:           #fafbfc
     --nl-border:       #eef0f2
   =========================================================================== */

.nldm-wrap {
	--nl-green: #259B76;
	--nl-green-hover: #1e8a68;
	--nl-green-soft: #eef7f3;
	--nl-green-border: #c8e6da;
	--nl-text: #374151;
	--nl-text-soft: #6b7280;
	--nl-text-faint: #9ca3af;
	--nl-bg: #fafbfc;
	--nl-border: #eef0f2;
	--nl-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
	--nl-radius: 12px;
	--nl-radius-sm: 8px;

	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--nl-text);
	line-height: 1.5;
	box-sizing: border-box;
	max-width: 100%;
}

.nldm-wrap *,
.nldm-wrap *::before,
.nldm-wrap *::after {
	box-sizing: inherit;
}

/* ----------------------------- Toolbar ---------------------------------- */

.nldm-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	padding: 14px 16px;
	background: #ffffff;
	border: 1px solid var(--nl-border);
	border-bottom: none;
	border-radius: var(--nl-radius) var(--nl-radius) 0 0;
}

.nldm-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nldm-filter-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	background: #ffffff;
	color: var(--nl-text-soft);
	border: 1px solid var(--nl-border);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.2s ease;
}

.nldm-filter-pill:hover {
	background: var(--nl-green-soft);
	color: var(--nl-green);
	border-color: var(--nl-green-border);
}

.nldm-filter-pill.is-active {
	background: var(--nl-green-soft);
	color: var(--nl-green);
	border-color: var(--nl-green-border);
	font-weight: 600;
}

.nldm-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 20px;
	padding: 0 6px;
	background: var(--nl-bg);
	color: var(--nl-text-soft);
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.nldm-filter-pill.is-active .nldm-count {
	background: var(--nl-green);
	color: #ffffff;
}

.nldm-search {
	position: relative;
	display: flex;
	align-items: center;
	min-width: 240px;
	flex: 1 1 240px;
	max-width: 340px;
}

.nldm-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--nl-text-faint);
	pointer-events: none;
	flex-shrink: 0;
}

.nldm-search-input {
	width: 100%;
	padding: 9px 12px 9px 40px;
	background: #ffffff;
	border: 1px solid var(--nl-border);
	border-radius: var(--nl-radius-sm);
	font: inherit;
	font-size: 13px;
	color: var(--nl-text);
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nldm-search-input:focus {
	border-color: var(--nl-green-border);
	box-shadow: 0 0 0 3px rgba(37, 155, 118, 0.12);
}

.nldm-search-input::placeholder {
	color: var(--nl-text-faint);
}

/* ----------------------------- Map area --------------------------------- */

.nldm-map-container {
	position: relative;
	width: 100%;
	height: var(--nldm-map-height, 560px);
	background: var(--nl-bg);
	border: 1px solid var(--nl-border);
	border-radius: 0 0 var(--nl-radius) var(--nl-radius);
	overflow: hidden;
	box-shadow: var(--nl-shadow);
}

.nldm-toolbar + .nldm-map-container {
	border-top: 1px solid var(--nl-border);
}

.nldm-wrap > .nldm-map-container:first-child {
	border-radius: var(--nl-radius);
}

.nldm-map {
	width: 100%;
	height: 100%;
	background: #e9eef2;
}

.nldm-empty {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: var(--nl-text-soft);
	text-align: center;
	padding: 32px;
	pointer-events: none;
}

.nldm-empty-icon {
	width: 56px;
	height: 56px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--nl-green-soft);
	color: var(--nl-green);
	border-radius: 50%;
}

.nldm-empty p {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
}

/* ----------------------------- Custom pin ------------------------------- */

.nldm-pin {
	background: transparent !important;
	border: none !important;
}

.nldm-pin-svg {
	display: block;
	filter: drop-shadow(0 4px 8px rgba(37, 155, 118, 0.35));
	transition: transform 0.2s ease;
}

.nldm-pin:hover .nldm-pin-svg {
	transform: translateY(-2px) scale(1.05);
}

/* ----------------------------- Popup ------------------------------------ */

.nldm-wrap .leaflet-popup-content-wrapper {
	background: #ffffff;
	color: var(--nl-text);
	border-radius: var(--nl-radius);
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
	padding: 0;
}

.nldm-wrap .leaflet-popup-content {
	margin: 0;
	font-family: inherit;
	font-size: 13px;
	line-height: 1.5;
	min-width: 240px;
}

.nldm-wrap .leaflet-popup-tip {
	background: #ffffff;
}

.nldm-popup {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--nl-radius);
}

.nldm-popup-thumb {
	display: block;
	width: 100%;
	height: 120px;
	object-fit: cover;
	background: var(--nl-green-soft);
}

.nldm-popup-body {
	padding: 14px 16px 16px;
}

.nldm-popup-type {
	display: inline-block;
	margin-bottom: 6px;
	padding: 2px 8px;
	background: var(--nl-green-soft);
	color: var(--nl-green);
	border-radius: 999px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.nldm-popup-title {
	margin: 0 0 6px;
	color: var(--nl-text);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
}

.nldm-popup-address {
	margin: 0 0 12px;
	color: var(--nl-text-soft);
	font-size: 13px;
}

.nldm-popup-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--nl-green);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: color 0.2s ease;
}

.nldm-popup-link:hover {
	color: var(--nl-green-hover);
}

.nldm-popup-link svg {
	width: 14px;
	height: 14px;
}

/* ----------------------------- Cluster ---------------------------------- */

.nldm-wrap .marker-cluster {
	background: rgba(37, 155, 118, 0.18);
}

.nldm-wrap .marker-cluster div {
	background: var(--nl-green);
	color: #ffffff;
	font-family: inherit;
	font-weight: 700;
	font-size: 12px;
	box-shadow: 0 4px 10px rgba(37, 155, 118, 0.3);
}

.nldm-wrap .marker-cluster span {
	line-height: 30px;
}

/* ----------------------------- Zoom controls ---------------------------- */

.nldm-wrap .leaflet-control-zoom a {
	background: #ffffff;
	color: var(--nl-text);
	border: 1px solid var(--nl-border);
	border-radius: 8px !important;
	width: 32px;
	height: 32px;
	line-height: 32px;
	font-size: 16px;
	font-weight: 600;
	transition: all 0.2s ease;
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.nldm-wrap .leaflet-control-zoom a + a {
	margin-top: 4px;
}

.nldm-wrap .leaflet-control-zoom a:hover {
	background: var(--nl-green-soft);
	color: var(--nl-green);
	border-color: var(--nl-green-border);
}

.nldm-wrap .leaflet-bar {
	border: none;
	box-shadow: none;
}

.nldm-wrap .leaflet-control-attribution {
	background: rgba(255, 255, 255, 0.85);
	font-size: 10px;
	color: var(--nl-text-soft);
	padding: 2px 6px;
	border-radius: 6px 0 0 0;
}

.nldm-wrap .leaflet-control-attribution a {
	color: var(--nl-green);
}

/* ----------------------------- Responsive ------------------------------- */

/* Tablet and below — clamp the map to a comfortable height regardless of
   whatever px value the shortcode passed in. */
@media (max-width: 768px) {
	.nldm-map-container {
		height: min( var( --nldm-map-height, 560px ), 460px );
		border-radius: 10px;
	}

	.nldm-toolbar {
		border-radius: 10px 10px 0 0;
	}

	.nldm-toolbar + .nldm-map-container {
		border-radius: 0 0 10px 10px;
	}

	/* Larger touch target on mobile (44px+ recommended) */
	.nldm-pin-svg {
		width: 38px;
		height: 50px;
	}

	.nldm-wrap .leaflet-control-zoom a {
		width: 36px;
		height: 36px;
		line-height: 36px;
		font-size: 18px;
	}

	.nldm-wrap .leaflet-popup-content {
		min-width: 200px;
	}

	.nldm-popup-thumb {
		height: 110px;
	}
}

/* Phones — stack toolbar, scroll pills horizontally, full-width search. */
@media (max-width: 640px) {
	.nldm-wrap {
		--nl-radius: 10px;
	}

	.nldm-toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
		padding: 10px 10px;
	}

	.nldm-search {
		max-width: none;
		min-width: 0;
		flex: none;
		width: 100%;
		order: 2;
	}

	.nldm-filter {
		order: 1;
		overflow-x: auto;
		flex-wrap: nowrap;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		margin: 0 -10px;
		padding: 2px 10px 6px;
		scroll-snap-type: x proximity;
	}

	.nldm-filter::-webkit-scrollbar {
		display: none;
	}

	.nldm-filter-pill {
		flex-shrink: 0;
		scroll-snap-align: start;
		padding: 9px 14px;
		font-size: 13px;
	}

	.nldm-map-container {
		height: min( var( --nldm-map-height, 560px ), 60vh );
		min-height: 360px;
	}

	/* Make the popup feel native on phone screens */
	.nldm-wrap .leaflet-popup-content-wrapper {
		border-radius: 12px;
	}

	.nldm-wrap .leaflet-popup-content {
		min-width: 0;
		width: calc( 100vw - 80px );
		max-width: 280px;
	}

	.nldm-popup-thumb {
		height: 100px;
	}

	.nldm-popup-body {
		padding: 12px 14px 14px;
	}

	.nldm-popup-title {
		font-size: 14px;
	}

	.nldm-popup-address,
	.nldm-popup-link {
		font-size: 12.5px;
	}

	.nldm-empty {
		padding: 20px;
	}

	/* Compact attribution so it doesn't crowd the corner on tiny screens */
	.nldm-wrap .leaflet-control-attribution {
		font-size: 9px;
		padding: 2px 5px;
	}

	.nldm-wrap .leaflet-control-zoom {
		margin-right: 8px !important;
		margin-bottom: 8px !important;
	}
}

/* Very small phones — kill empty whitespace and shrink touch targets a hair */
@media (max-width: 380px) {
	.nldm-map-container {
		min-height: 320px;
	}

	.nldm-filter-pill {
		padding: 8px 12px;
	}

	.nldm-search-input {
		font-size: 16px; /* prevents iOS zoom-on-focus */
	}
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.nldm-pin-svg,
	.nldm-filter-pill,
	.nldm-search-input,
	.nldm-popup-link,
	.nldm-wrap .leaflet-control-zoom a {
		transition: none !important;
	}
}
