/* ================================================================
   Store Locator By Buraqsys Studio — Frontend Styles v1.1.0
   Theme colour: red. Font: inherited from the active theme.
   ================================================================ */

:root {
	--slbs-primary:       #c00000;
	--slbs-primary-dark:  #a00000;
	--slbs-primary-light: #ff3333;
	--slbs-accent:        #ff6666;
	--slbs-white:         #ffffff;
	--slbs-bg:            #f8f8f8;
	--slbs-bg-card:       #ffffff;
	--slbs-border:        #e5e5e5;
	--slbs-border-dark:   #ccc;
	--slbs-text:          #222222;
	--slbs-text-muted:    #777777;
	--slbs-text-light:    #999999;
	--slbs-shadow-sm:     0 2px 8px rgba(0,0,0,.08);
	--slbs-shadow-md:     0 4px 20px rgba(0,0,0,.12);
	--slbs-radius:        8px;
	--slbs-radius-sm:     4px;
	--slbs-radius-lg:     12px;
	--slbs-transition:    .2s ease;
}

/* ── Wrapper ─────────────────────────────────────────────────── */

.slbs-wrap {
	font-family: inherit;
	color: var(--slbs-text);
	line-height: 1.5;
	max-width: 100%;
	/* FIX: was 'overflow: visible' but we need clip for border-radius on children
	   while still allowing table to scroll. Keep visible here; handle overflow per-child. */
}

.slbs-wrap *,
.slbs-wrap *::before,
.slbs-wrap *::after {
	box-sizing: border-box;
}

/* ── Alert ─────────────────────────────────────────────────── */

.slbs-alert {
	padding: 12px 18px;
	border-radius: var(--slbs-radius-sm);
	margin-bottom: 0;
	font-size: .9rem;
}

.slbs-alert--warning {
	background: #fff8e1;
	border-left: 4px solid #f59e0b;
	color: #92400e;
}

.slbs-alert--info {
	background: #e8f4fd;
	border-left: 4px solid #3b82f6;
	color: #1e40af;
}

/* ── Control bar ─────────────────────────────────────────────── */

.slbs-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: var(--slbs-primary);
	padding: 14px 20px;
	/* FIX: top corners rounded, bottom flat — map sits flush below */
	border-radius: var(--slbs-radius-lg) var(--slbs-radius-lg) 0 0;
	flex-wrap: wrap;
}

.slbs-controls__left {
	display: flex;
	gap: 10px;
	flex: 1;
	flex-wrap: wrap;
	min-width: 0;
}

.slbs-controls__right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* ── Inputs ──────────────────────────────────────────────────── */

.slbs-search-wrap,
.slbs-select-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.slbs-search-wrap {
	flex: 1;
	min-width: 200px;
}

.slbs-icon-search,
.slbs-icon-pin {
	position: absolute;
	left: 12px;
	width: 16px;
	height: 16px;
	color: var(--slbs-text-muted);
	pointer-events: none;
	flex-shrink: 0;
}

.slbs-icon-pin {
	color: var(--slbs-white);
	opacity: 0.7;
}

.slbs-input,
.slbs-select {
	font-family: inherit;
	font-size: .9rem;
	padding: 9px 12px 9px 36px;
	border: 1.5px solid rgba(255,255,255,.3);
	border-radius: var(--slbs-radius);
	background: rgba(255,255,255,.15);
	color: var(--slbs-white);
	outline: none;
	transition: border-color var(--slbs-transition), background var(--slbs-transition);
	width: 100%;
	backdrop-filter: blur(4px);
}

.slbs-input::placeholder {
	color: rgba(255,255,255,.65);
}

.slbs-input:focus,
.slbs-select:focus {
	border-color: rgba(255,255,255,.7);
	background: rgba(255,255,255,.25);
}

.slbs-select {
	min-width: 170px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,.8)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
	padding-right: 36px;
}

.slbs-select option {
	background: #ffffff;
	color: #222222;
}

.slbs-select option:checked,
.slbs-select option:hover {
	background: #c00000;
	color: #ffffff;
}

/* ── Buttons ────────────────────────────────────────────────── */

.slbs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-family: inherit;
	font-size: .75rem;
	font-weight: 600;
	padding: 6px 10px;
	border-radius: var(--slbs-radius-sm);
	border: 1.5px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: all var(--slbs-transition);
	white-space: nowrap;
	line-height: 1.2;
	height: 32px;
	min-height: 32px;
	flex-shrink: 0;
}

.slbs-btn svg {
	width: 13px;
	height: 13px;
	flex-shrink: 0;
}

.slbs-btn--detect {
	background: rgba(255,255,255,.18);
	color: var(--slbs-white);
	border: 1.5px solid rgba(255,255,255,.4);
}

.slbs-btn--detect:hover {
	background: rgba(255,255,255,.3);
	border-color: rgba(255,255,255,.7);
	transform: translateY(-1px);
}

.slbs-btn--detect.slbs-loading svg {
	animation: slbs-spin .8s linear infinite;
}

/* FIX: btn--view was transparent which caused white box artifacts on some themes.
   Use a solid white background so it always renders cleanly over any parent bg. */
.slbs-btn--view {
	background: var(--slbs-white);
	color: var(--slbs-primary);
	border: 1.5px solid var(--slbs-primary);
}

.slbs-btn--view:hover {
	background: var(--slbs-primary);
	color: var(--slbs-white);
}

.slbs-btn--dir {
	background: var(--slbs-primary);
	color: var(--slbs-white);
	border: 1.5px solid var(--slbs-primary);
}

.slbs-btn--dir:hover {
	background: var(--slbs-primary-dark);
	border-color: var(--slbs-primary-dark);
	transform: translateY(-1px);
}

/* ── Map container ───────────────────────────────────────────── */

/* FIX: map sits flush between controls (above) and results bar (below).
   No gap, no border-radius on map edges. */
.slbs-map-container {
	position: relative;
	width: 100%;
	background: #e0e0e0;
	/* explicit block so height: Xpx on inline style works in all browsers */
	display: block;
	z-index: 1;
}

#slbs-map {
	width: 100%;
	height: 100%;
	display: block;
}

.slbs-map-loader {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,.92);
	z-index: 10;
	gap: 12px;
	font-size: .9rem;
	color: var(--slbs-text-muted);
	transition: opacity .3s;
}

.slbs-map-loader.slbs-hidden {
	opacity: 0;
	pointer-events: none;
}

.slbs-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid var(--slbs-border);
	border-top-color: var(--slbs-primary);
	border-radius: 50%;
	animation: slbs-spin .8s linear infinite;
}

/* ── Leaflet popup card (mirrors Google infowindow) ──────────── */

.slbs-lf-popup .leaflet-popup-content-wrapper {
	padding: 0;
	border-radius: var(--slbs-radius-sm);
	overflow: hidden;
	box-shadow: var(--slbs-shadow-md);
	min-width: 220px;
	max-width: 280px;
}

.slbs-lf-popup .leaflet-popup-content {
	margin: 0;
	width: auto !important;
}

.slbs-lf-popup .leaflet-popup-tip-container {
	margin-top: -1px;
}

/* ── Leaflet custom marker icon ──────────────────────────────── */

.slbs-leaflet-marker-icon {
	background: none;
	border: none;
}

.slbs-leaflet-user-icon {
	background: none;
	border: none;
}

/* ── Info window / popup card (shared Google & Leaflet) ──────── */

.slbs-infowindow {
	font-family: inherit;
	min-width: 220px;
	max-width: 280px;
}

.slbs-iw-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: var(--slbs-primary);
	color: var(--slbs-white);
	border-radius: 0;
	font-weight: 700;
	font-size: .9rem;
}

.slbs-iw-header svg {
	flex-shrink: 0;
	filter: brightness(0) invert(1);
}

.slbs-iw-body {
	padding: 10px 14px;
	background: var(--slbs-white);
	border: 1px solid var(--slbs-border);
	border-top: none;
}

.slbs-iw-row {
	display: flex;
	gap: 8px;
	padding: 4px 0;
	font-size: .83rem;
	border-bottom: 1px solid #f0f0f0;
	align-items: flex-start;
}

.slbs-iw-row:last-child {
	border-bottom: none;
}

.slbs-iw-label {
	font-weight: 600;
	color: var(--slbs-text-muted);
	min-width: 52px;
	flex-shrink: 0;
}

.slbs-iw-row a {
	color: var(--slbs-primary);
	text-decoration: none;
}

.slbs-iw-footer {
	padding: 10px 14px;
	background: #f9f9f9;
	border: 1px solid var(--slbs-border);
	border-top: none;
	border-radius: 0;
}

.slbs-dir-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--slbs-primary);
	color: var(--slbs-white);
	padding: 9px 16px;
	border-radius: var(--slbs-radius-sm);
	font-size: .82rem;
	font-weight: 600;
	text-decoration: none;
	width: 100%;
	justify-content: center;
	transition: background var(--slbs-transition);
	font-family: inherit;
	min-height: 38px;
}

.slbs-dir-btn:hover {
	background: var(--slbs-primary-dark);
	color: var(--slbs-white);
}

.slbs-dir-btn svg {
	width: 14px;
	height: 14px;
}

/* ── Results bar ─────────────────────────────────────────────── */

/* FIX: removed margin-top that was creating a gap/misalignment */
.slbs-results-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 20px;
	background: var(--slbs-bg-card);
	/* FIX: border-top was visually cutting into map bottom. Use box-shadow approach
	   and keep a clean top border that sits flush with the map bottom edge. */
	border: 1px solid var(--slbs-border);
	border-top: 3px solid var(--slbs-primary);
	font-size: .85rem;
	flex-wrap: wrap;
	gap: 6px;
}

#slbs-results-count {
	font-weight: 600;
	color: var(--slbs-primary);
}

.slbs-results-bar__hint {
	color: var(--slbs-text-light);
	font-size: .8rem;
}

/* ── Table wrap ──────────────────────────────────────────────── */

/* FIX: removed margin-top: 4px which caused a white gap between results bar and table */
.slbs-table-wrap {
	overflow-x: visible; /* overflow handled per city section */
}

/* ── City section ────────────────────────────────────────────── */

.slbs-city-section {
	margin-bottom: 2px;
	/* FIX: removed overflow:hidden which was blocking horizontal table scroll on mobile.
	   Border-radius is now applied via individual child elements. */
	border-radius: var(--slbs-radius);
	box-shadow: var(--slbs-shadow-sm);
	/* Use clip-path alternative: overflow on the scroll div, not the section */
}

/* Allow horizontal scroll inside city section on mobile */
.slbs-city-section .slbs-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: 0 0 var(--slbs-radius) var(--slbs-radius);
	border: 1px solid var(--slbs-border);
	border-top: none;
}

.slbs-city-heading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 20px;
	background: var(--slbs-primary);
	color: var(--slbs-white);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: .01em;
	border-radius: var(--slbs-radius) var(--slbs-radius) 0 0;
}

.slbs-city-heading svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.slbs-city-count {
	margin-left: auto;
	background: rgba(255,255,255,.22);
	padding: 2px 10px;
	border-radius: 20px;
	font-size: .78rem;
	font-style: normal;
	font-weight: 600;
	/* FIX: ensure badge doesn't get clipped on small screens */
	flex-shrink: 0;
	white-space: nowrap;
}

/* ── Table ───────────────────────────────────────────────────── */

.slbs-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--slbs-bg-card);
	font-size: .87rem;
	table-layout: auto; /* FIX: auto instead of fixed so columns resize naturally */
}

.slbs-table thead th {
	padding: 11px 16px;
	background: #f5f5f5;
	border-bottom: 2px solid var(--slbs-border);
	color: var(--slbs-text-muted);
	font-weight: 700;
	font-size: .78rem;
	text-transform: uppercase;
	letter-spacing: .05em;
	text-align: left;
	white-space: nowrap;
}

.slbs-table tbody tr {
	transition: background var(--slbs-transition);
}

.slbs-table tbody tr:hover {
	background: #fff5f5;
}

.slbs-table tbody tr:nth-child(even) {
	background: #fafafa;
}

.slbs-table tbody tr:nth-child(even):hover {
	background: #fff5f5;
}

.slbs-table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--slbs-border);
	vertical-align: middle;
	/* FIX: removed overflow:hidden + fixed height that was clipping action buttons.
	   Use word-wrap only for text cells. Action cell handled separately. */
	word-break: break-word;
}

.slbs-table tbody tr:last-child td {
	border-bottom: none;
}

/* ── Column widths ───────────────────────────────────────────── */

.slbs-col-sr {
	width: 44px;
	text-align: center;
	white-space: nowrap;
}

.slbs-sr {
	display: inline-flex;
	width: 24px;
	height: 24px;
	align-items: center;
	justify-content: center;
	background: var(--slbs-primary);
	color: var(--slbs-white);
	border-radius: 50%;
	font-size: .7rem;
	font-weight: 700;
}

.slbs-col-name {
	min-width: 160px;
}

.slbs-col-name strong {
	display: block;
	font-weight: 700;
	color: var(--slbs-text);
	margin-bottom: 2px;
	word-break: break-word;
}

.slbs-col-name small {
	color: var(--slbs-text-muted);
	font-size: .78rem;
	display: block;
	word-break: break-word;
}

.slbs-col-location {
	min-width: 180px;
}

.slbs-col-phone {
	white-space: nowrap;
	min-width: 100px;
}

/* FIX: action column — was 'display: flex' on the <td> itself which conflicts with
   table-cell layout, causing white box artifacts. Now just a plain td with min-width.
   Flex is applied only to the inner .slbs-action-btns div. */
.slbs-col-action {
	min-width: 180px;
	white-space: nowrap;
}

/* The inner wrapper gets the flex layout */
.slbs-action-btns {
	display: flex;
	gap: 6px;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-start;
}

.slbs-tel {
	color: var(--slbs-primary);
	text-decoration: none;
	font-weight: 600;
	transition: color var(--slbs-transition);
}

.slbs-tel:hover {
	color: var(--slbs-primary-dark);
	text-decoration: underline;
}

.slbs-na {
	color: var(--slbs-text-light);
}

.slbs-no-location {
	font-size: .78rem;
	color: var(--slbs-text-light);
	font-style: italic;
}

/* ── Empty state ─────────────────────────────────────────────── */

.slbs-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 48px 24px;
	gap: 12px;
	color: var(--slbs-text-muted);
	background: var(--slbs-bg-card);
	border: 1px solid var(--slbs-border);
	border-radius: var(--slbs-radius);
}

.slbs-empty svg {
	width: 48px;
	height: 48px;
	opacity: .3;
}

/* ── Nearest dealer highlight ────────────────────────────────── */

.slbs-nearest-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #22c55e;
	color: #fff;
	font-size: .68rem;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 12px;
	margin-bottom: 5px;
	vertical-align: middle;
	white-space: nowrap;
}

.slbs-table-row.slbs-is-nearest {
	background: #f0fdf4 !important;
	outline: 2px solid #22c55e;
	outline-offset: -2px;
}

/* ── Animations ──────────────────────────────────────────────── */

@keyframes slbs-spin {
	to { transform: rotate(360deg); }
}

/* ── Responsive — tablet ─────────────────────────────────────── */

@media (max-width: 767px) {
	.slbs-controls {
		padding: 12px;
		gap: 8px;
	}

	.slbs-controls__left {
		flex-direction: column;
		width: 100%;
	}

	.slbs-search-wrap {
		min-width: 100%;
	}

	.slbs-select {
		width: 100%;
		min-width: 0;
	}

	.slbs-controls__right {
		width: 100%;
	}

	.slbs-btn--detect {
		width: 100%;
		justify-content: center;
	}

	.slbs-results-bar__hint {
		display: none;
	}

	.slbs-city-heading {
		font-size: .9rem;
		padding: 10px 14px;
	}

	/* On narrow screens, present each dealer as stacked fields instead of
	   forcing a wide table that requires horizontal scrolling. */
	.slbs-city-section {
		overflow-x: visible;
		-webkit-overflow-scrolling: touch;
	}

	.slbs-city-section .slbs-table-scroll {
		overflow-x: visible;
	}

	.slbs-table {
		display: block;
		width: 100%;
		min-width: 0;
	}

	.slbs-table thead {
		display: none;
	}

	.slbs-table tbody {
		display: block;
	}

	.slbs-table tbody tr,
	.slbs-table tbody tr:nth-child(even),
	.slbs-table tbody tr:hover,
	.slbs-table tbody tr:nth-child(even):hover {
		display: block;
		padding: 12px 14px;
		border-bottom: 1px solid var(--slbs-border);
		background: var(--slbs-bg-card);
	}

	.slbs-table tbody tr:last-child {
		border-bottom: none;
	}

	.slbs-table td {
		display: block;
		width: 100%;
		padding: 0;
		border-bottom: none;
	}

	.slbs-col-sr {
		display: none !important;
	}

	.slbs-col-name,
	.slbs-col-location,
	.slbs-col-phone,
	.slbs-col-action {
		min-width: 0;
		white-space: normal;
	}

	.slbs-col-location,
	.slbs-col-phone,
	.slbs-col-action {
		margin-top: 8px;
	}

	.slbs-col-action {
		min-width: 0;
	}

	.slbs-action-btns {
		flex-wrap: wrap;
	}
}

/* ── Responsive — mobile ─────────────────────────────────────── */

@media (max-width: 480px) {
	.slbs-map-container {
		height: 300px !important;
	}

	.slbs-table thead th,
	.slbs-table td {
		padding: 8px 10px;
		font-size: .8rem;
	}

	.slbs-btn {
		font-size: .72rem;
		padding: 5px 8px;
		height: 30px;
		min-height: 30px;
	}

	.slbs-action-btns {
		gap: 4px;
	}

	.slbs-action-btns {
		flex-direction: row;
		align-items: center;
	}

	.slbs-col-action {
		min-width: 0;
	}

	.slbs-results-bar {
		padding: 8px 12px;
		font-size: .8rem;
	}
}
