/* ===================================================================
   Craze Store Locator — design tokens match the product page theme
   =================================================================== */

/* ── Variables ─────────────────────────────────────────────────── */
.craze-store-locator {
	/* Colours taken directly from the product page */
	--csl-green:        #557565;   /* add-to-cart button bg          */
	--csl-green-dark:   #3a5c3a;   /* active variation border/text   */
	--csl-green-tint:   #f0f5f0;   /* active variation background    */
	--csl-border:       #d0d0d0;   /* inactive variation border      */
	--csl-bg-card:      #ffffff;
	--csl-text:         #333333;   /* body text                      */
	--csl-text-muted:   #888888;
	/* Radii matching the product page */
	--csl-radius:       8px;       /* variation buttons, cards       */
	--csl-radius-btn:   3px;       /* primary CTA (add-to-cart)      */
	--csl-shadow:       0 2px 12px rgba(0,0,0,0.07);
	--csl-transition:   0.18s ease;
	font-family: inherit;
	color: var(--csl-text);
}

/* ── Controls bar ──────────────────────────────────────────────── */
.csl-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.csl-search-wrap {
	display: flex;
	flex: 1;
	min-width: 220px;
	border-radius: var(--csl-radius);
	overflow: hidden;
	box-shadow: var(--csl-shadow);
	position: relative;
}

/* Border overlay sits on top of all children so there's no sub-pixel gap */
.csl-search-wrap::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: var(--csl-radius);
	border: 1.5px solid var(--csl-border);
	pointer-events: none;
	transition: border-color var(--csl-transition);
}

.csl-search-wrap:focus-within::after {
	border-color: var(--csl-green);
}

/* Doubled selector beats theme's `input { border: ...; border-radius: ... }` */
.craze-store-locator .csl-search-input {
	flex: 1;
	padding: 10px 14px;
	border: none;
	border-radius: 0;
	box-shadow: none;
	font-size: 14px;
	color: var(--csl-text);
	background: #fff;
	outline: none;
}

.craze-store-locator .csl-search-input::placeholder {
	color: var(--csl-text-muted);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.csl-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 500;
	border: none;
	cursor: pointer;
	transition: background var(--csl-transition), opacity var(--csl-transition);
	line-height: 1;
	white-space: nowrap;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.csl-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Primary — matches the green add-to-cart button exactly */
.csl-btn--primary {
	background: var(--csl-green);
	color: #fff;
	border-radius: 0;
	border-left: 1px solid rgba(0,0,0,0.1);
}

.csl-btn--primary:hover:not(:disabled) {
	background: var(--csl-green-dark);
}

/* Secondary — matches inactive variation button style */
.csl-btn--secondary {
	background: #fff;
	color: var(--csl-text);
	border: 1.5px solid var(--csl-border);
	border-radius: var(--csl-radius);
	box-shadow: var(--csl-shadow);
}

.csl-btn--secondary:hover:not(:disabled) {
	background: var(--csl-green-tint);
	border-color: var(--csl-green-dark);
	color: var(--csl-green-dark);
}

/* ── Inline message ────────────────────────────────────────────── */
.csl-message {
	padding: 10px 14px;
	margin-bottom: 12px;
	border-radius: var(--csl-radius);
	font-size: 13px;
	font-weight: 500;
}

.csl-message[hidden] {
	display: none;
}

.csl-message--error {
	background: #fef3f2;
	color: #b42318;
	border: 1px solid #fecdca;
}

.csl-message--info {
	background: var(--csl-green-tint);
	color: var(--csl-green-dark);
	border: 1px solid var(--csl-border);
}

/* ── Main layout ───────────────────────────────────────────────── */
.csl-layout {
	display: grid;
	grid-template-columns: 1fr 360px;
	gap: 16px;
	align-items: start;
}

/* ── Map ───────────────────────────────────────────────────────── */
.csl-map-wrap {
	border-radius: var(--csl-radius);
	overflow: hidden;
	border: 1px solid var(--csl-border);
	box-shadow: var(--csl-shadow);
	/* Isolate Leaflet's internal z-indices so the map never overlaps the navbar */
	isolation: isolate;
}

#csl-map {
	width: 100%;
	min-height: 300px;
}

/* ── Location list panel ───────────────────────────────────────── */
.csl-list-wrap {
	position: sticky;
	top: 20px;
	background: var(--csl-bg-card);
	border: 1px solid var(--csl-border);
	border-radius: var(--csl-radius);
	box-shadow: var(--csl-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

/* ── List header ───────────────────────────────────────────────── */
.csl-list-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	background: var(--csl-green-tint);
	border-bottom: 1px solid var(--csl-border);
	flex-shrink: 0;
}

.csl-list-title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--csl-text-muted);
}

.csl-list-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 7px;
	border-radius: 100px;
	background: var(--csl-green);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

/* ── Scrollable list ───────────────────────────────────────────── */
.csl-location-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	scrollbar-width: thin;
	scrollbar-color: var(--csl-border) var(--csl-green-tint);
}

.csl-location-list::-webkit-scrollbar { width: 5px; }
.csl-location-list::-webkit-scrollbar-track { background: var(--csl-green-tint); }
.csl-location-list::-webkit-scrollbar-thumb { background: var(--csl-border); border-radius: 3px; }

/* ── Cards — mirror inactive variation button style ────────────── */
.csl-location-card {
	background: var(--csl-bg-card);
	border-bottom: 1px solid var(--csl-border);
	border-left: 3px solid transparent;
	cursor: pointer;
	transition: background var(--csl-transition), border-left-color var(--csl-transition);
}

.csl-location-card:last-child {
	border-bottom: none;
}

/* hover — mirrors variation button hover */
.csl-location-card:hover {
	background: var(--csl-green-tint);
	border-left-color: var(--csl-green);
}

/* active — mirrors selected variation button */
.csl-location-card.is-active {
	background: var(--csl-green-tint);
	border-left-color: var(--csl-green-dark);
}

.csl-card-inner {
	display: flex;
	align-items: center;
	padding: 11px 14px 11px 12px;
	gap: 10px;
}

.csl-card-icon {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--csl-green-tint);
	border: 1px solid var(--csl-border);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--csl-green);
	transition: background var(--csl-transition), border-color var(--csl-transition), color var(--csl-transition);
}

.csl-location-card:hover .csl-card-icon,
.csl-location-card.is-active .csl-card-icon {
	background: var(--csl-green);
	border-color: var(--csl-green);
	color: #fff;
}

.csl-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}

.csl-card-name {
	font-size: 14px;
	font-weight: 600;
	color: var(--csl-text);
	line-height: 1.3;
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 5px;
}

.csl-retailer-tag {
	display: inline-block;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--csl-text-muted);
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: 1px 5px;
	line-height: 1.5;
	white-space: nowrap;
	flex-shrink: 0;
}

.csl-card-address {
	font-size: 12px;
	color: var(--csl-text-muted);
	line-height: 1.4;
}

.csl-card-route {
	display: inline-block;
	margin-top: 4px;
	font-size: 11px;
	font-weight: 600;
	color: var(--csl-green);
	text-decoration: none;
	transition: color var(--csl-transition);
}

.csl-card-route:hover {
	color: var(--csl-green-dark);
	text-decoration: underline;
}

/* ── Distance badge ────────────────────────────────────────────── */
.csl-distance-badge {
	display: inline-block;
	flex-shrink: 0;
	padding: 3px 8px;
	border-radius: 100px;
	background: var(--csl-green-tint);
	color: var(--csl-green-dark);
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
	border: 1px solid var(--csl-border);
}

.csl-distance-badge:empty { display: none; }

/* ── Empty state ───────────────────────────────────────────────── */
.csl-empty {
	color: var(--csl-text-muted);
	font-style: italic;
	padding: 24px 16px;
	text-align: center;
	font-size: 14px;
}

/* ── User location marker ──────────────────────────────────────── */
.csl-user-marker {
	filter: drop-shadow(0 1px 4px rgba(37,99,235,0.4));
}

/* ── Leaflet popup ─────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
	border-radius: var(--csl-radius) !important;
	box-shadow: 0 4px 20px rgba(0,0,0,0.12) !important;
	border: 1px solid var(--csl-border) !important;
}

.leaflet-popup-content {
	font-family: inherit;
	font-size: 13px;
	line-height: 1.55;
	color: var(--csl-text);
	margin: 12px 16px !important;
}

.leaflet-popup-content strong {
	color: var(--csl-green-dark);
	font-size: 14px;
	font-weight: 600;
	display: block;
	margin-bottom: 2px;
}

.csl-popup-route {
	display: inline-block;
	margin-top: 6px;
	font-size: 12px;
	font-weight: 600;
	color: var(--csl-green);
	text-decoration: none;
}

.csl-popup-route:hover {
	color: var(--csl-green-dark);
	text-decoration: underline;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 860px) {
	.csl-layout {
		grid-template-columns: 1fr;
	}

	.csl-list-wrap {
		position: static;
	}

	.csl-location-list {
		max-height: 320px;
	}
}

@media (max-width: 600px) {
	.csl-controls {
		flex-direction: column;
		align-items: stretch;
	}

	.csl-search-wrap { min-width: 0; }

	.csl-btn--secondary { justify-content: center; }
}
