/**
 * WP Dealership Locator — Frontend Styles
 *
 * All classes prefixed with wpsl- to avoid theme conflicts.
 * Minimal CSS — only styles plugin elements.
 *
 * @package WPDealershipLocator
 */

/* ----------------------------------------------------------------
   Container
   ---------------------------------------------------------------- */
.wpsl-container {
	position: relative;
	width: 100%;
	max-width: 100%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #333;
	box-sizing: border-box;
}

.wpsl-container *,
.wpsl-container *::before,
.wpsl-container *::after {
	box-sizing: border-box;
}

/* ----------------------------------------------------------------
   Search Form
   ---------------------------------------------------------------- */
.wpsl-search-form {
	margin-bottom: 16px;
}

.wpsl-search-inputs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: stretch;
}

.wpsl-search-field {
	flex: 1 1 200px;
	min-width: 180px;
}

.wpsl-search-input {
	width: 100%;
	height: 40px;
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.5;
	background: #fff;
	color: #333;
	outline: none;
	transition: border-color 0.2s;
}

.wpsl-search-input:focus {
	border-color: #0073aa;
	box-shadow: 0 0 0 1px #0073aa;
}

.wpsl-search-radius,
.wpsl-search-category {
	flex: 0 0 auto;
}

.wpsl-radius-select,
.wpsl-category-select {
	height: 40px;
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 14px;
	background: #fff;
	color: #333;
	cursor: pointer;
}

.wpsl-search-actions {
	display: flex;
	gap: 8px;
	flex: 0 0 auto;
}

.wpsl-search-button {
	height: 40px;
	padding: 8px 20px;
	border: none;
	border-radius: 4px;
	background: #0073aa;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.2s;
}

.wpsl-search-button:hover,
.wpsl-search-button:focus {
	background: #005a87;
}

.wpsl-near-me-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 40px;
	padding: 8px 16px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
	color: #333;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
	transition: border-color 0.2s, background 0.2s;
}

.wpsl-near-me-button:hover,
.wpsl-near-me-button:focus {
	border-color: #0073aa;
	background: #f7f7f7;
}

.wpsl-near-me-button svg {
	flex-shrink: 0;
}

/* ----------------------------------------------------------------
   Content / Split Layout
   ---------------------------------------------------------------- */
.wpsl-content {
	display: flex;
	gap: 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
}

.wpsl-map-wrap {
	flex: 1 1 60%;
	min-height: 400px;
}

.wpsl-map {
	width: 100%;
	height: 100%;
	z-index: 1;
}

.wpsl-results-wrap {
	flex: 0 0 340px;
	overflow-y: auto;
	border-left: 1px solid #ddd;
}

/* ----------------------------------------------------------------
   Results Header
   ---------------------------------------------------------------- */
.wpsl-results-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	border-bottom: 1px solid #eee;
	background: #fafafa;
	position: sticky;
	top: 0;
	z-index: 2;
}

.wpsl-results-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
}

.wpsl-results-count {
	font-size: 13px;
	color: #666;
}

/* ----------------------------------------------------------------
   Results List
   ---------------------------------------------------------------- */
.wpsl-results-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpsl-result-item {
	padding: 12px 16px;
	border-bottom: 1px solid #eee;
	cursor: pointer;
	transition: background 0.15s;
}

.wpsl-result-item:last-child {
	border-bottom: none;
}

.wpsl-result-item:hover,
.wpsl-result-item.wpsl-active {
	background: #f0f6fc;
}

.wpsl-result-inner {
	display: flex;
	gap: 12px;
}

.wpsl-result-image {
	flex: 0 0 60px;
}

.wpsl-result-image img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 4px;
}

.wpsl-result-details {
	flex: 1 1 auto;
	min-width: 0;
}

.wpsl-result-title {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

.wpsl-result-title a {
	color: #1e1e1e;
	text-decoration: none;
}

.wpsl-result-title a:hover {
	color: #0073aa;
}

.wpsl-result-address {
	font-style: normal;
	font-size: 13px;
	color: #555;
	margin: 0 0 4px;
	line-height: 1.4;
}

.wpsl-result-phone {
	font-size: 13px;
	margin-bottom: 4px;
}

.wpsl-result-phone a {
	color: #0073aa;
	text-decoration: none;
}

.wpsl-result-distance {
	font-size: 12px;
	color: #888;
	margin-bottom: 6px;
}

.wpsl-result-actions {
	margin-top: 4px;
}

.wpsl-directions-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: #0073aa;
	text-decoration: none;
	font-weight: 500;
}

.wpsl-directions-link:hover {
	text-decoration: underline;
}

/* ----------------------------------------------------------------
   No Results
   ---------------------------------------------------------------- */
.wpsl-no-results {
	padding: 24px 16px;
	text-align: center;
	color: #666;
}

.wpsl-no-results p {
	margin: 0;
}

/* ----------------------------------------------------------------
   Info Window (Leaflet popup)
   ---------------------------------------------------------------- */
.wpsl-info-window {
	max-width: 280px;
	font-size: 13px;
	line-height: 1.5;
}

.wpsl-info-image {
	margin-bottom: 8px;
}

.wpsl-info-image img {
	width: 100%;
	height: 120px;
	object-fit: cover;
	border-radius: 4px;
}

.wpsl-info-title {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.wpsl-info-title a {
	color: #1e1e1e;
	text-decoration: none;
}

.wpsl-info-title a:hover {
	color: #0073aa;
}

.wpsl-info-address {
	font-style: normal;
	color: #555;
	margin: 0 0 6px;
}

.wpsl-info-phone,
.wpsl-info-email,
.wpsl-info-website {
	margin-bottom: 4px;
}

.wpsl-info-phone a,
.wpsl-info-email a,
.wpsl-info-website a {
	color: #0073aa;
	text-decoration: none;
}

.wpsl-info-phone a:hover,
.wpsl-info-email a:hover,
.wpsl-info-website a:hover {
	text-decoration: underline;
}

.wpsl-info-actions {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid #eee;
}

/* Override Leaflet popup styling for consistency. */
.leaflet-popup-content {
	margin: 12px 16px;
}

/* ----------------------------------------------------------------
   Loading State
   ---------------------------------------------------------------- */
.wpsl-loading {
	position: relative;
}

.wpsl-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	z-index: 10;
}

.wpsl-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid #ddd;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: wpsl-spin 0.6s linear infinite;
}

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

/* ----------------------------------------------------------------
   Responsive: Stack on Mobile
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
	.wpsl-content {
		flex-direction: column;
	}

	.wpsl-results-wrap {
		flex: 0 0 auto;
		max-height: 300px !important;
		border-left: none;
		border-top: 1px solid #ddd;
	}

	.wpsl-search-inputs {
		flex-direction: column;
	}

	.wpsl-search-field {
		flex: 1 1 auto;
	}

	.wpsl-search-actions {
		flex-direction: row;
		width: 100%;
	}

	.wpsl-search-button {
		flex: 1;
	}

	.wpsl-near-me-button {
		flex: 0 0 auto;
	}
}

/* ----------------------------------------------------------------
   RTL Support
   ---------------------------------------------------------------- */
[dir="rtl"] .wpsl-content {
	flex-direction: row-reverse;
}

[dir="rtl"] .wpsl-results-wrap {
	border-left: none;
	border-right: 1px solid #ddd;
}

@media (max-width: 768px) {
	[dir="rtl"] .wpsl-content {
		flex-direction: column;
	}

	[dir="rtl"] .wpsl-results-wrap {
		border-right: none;
		border-top: 1px solid #ddd;
	}
}
