/*
 * Store-locator layout for the core Dealer Search / Dealer Map / Dealer List
 * widgets. Loaded only with the Addons "Dealer Finder Layout" setting, and
 * scoped to body.rwdpa-finder-styled. Theme with custom properties, e.g.
 *   body { --rwdpa-finder-accent: #312d41; --rwdpa-finder-label-font: "My Font"; }
 * Selectors carry the body class so they win over the widgets' own
 * Elementor style controls.
 */
:where(body.rwdpa-finder-styled) {
	--rwdpa-finder-accent: #1f2937;
	--rwdpa-finder-accent-text: #ffffff;
	--rwdpa-finder-link: var(--rwdpa-finder-accent);
	--rwdpa-finder-text: #1f2937;
	--rwdpa-finder-muted: #6b7280;
	--rwdpa-finder-line: #dcdde3;
	--rwdpa-finder-panel: #f6f7f8;
	--rwdpa-finder-card: #ffffff;
	--rwdpa-finder-radius: 8px;
	--rwdpa-finder-height: 680px;
}

/* ── Layout: search on top, list | map side by side (desktop) ────────── */
@media (min-width: 1025px) {
	body.rwdpa-finder-styled :is(.e-con, .e-con-inner):has(> .elementor-widget-rwdp_dealer_map):has(> .elementor-widget-rwdp_dealer_list) {
		display: grid !important;
		grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
		grid-template-areas:
			"search search"
			"list map";
		gap: 20px 24px;
		align-items: start;
	}

	body.rwdpa-finder-styled :is(.e-con, .e-con-inner) > .elementor-widget-rwdp_dealer_search {
		grid-area: search;
	}

	body.rwdpa-finder-styled :is(.e-con, .e-con-inner):has(> .elementor-widget-rwdp_dealer_list) > .elementor-widget-rwdp_dealer_map {
		grid-area: map;
		position: sticky;
		top: 24px;
	}

	body.rwdpa-finder-styled :is(.e-con, .e-con-inner):has(> .elementor-widget-rwdp_dealer_map) > .elementor-widget-rwdp_dealer_list {
		grid-area: list;
		max-height: var(--rwdpa-finder-height);
		overflow-y: auto;
		overscroll-behavior: contain;
		padding-right: 6px;
		scrollbar-width: thin;
	}

	body.rwdpa-finder-styled :is(.e-con, .e-con-inner):has(> .elementor-widget-rwdp_dealer_map) > :is(.elementor-widget-rwdp_dealer_map, .elementor-widget-rwdp_dealer_list, .elementor-widget-rwdp_dealer_search) {
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
	}

	body.rwdpa-finder-styled :is(.e-con, .e-con-inner):has(> .elementor-widget-rwdp_dealer_map) .rwdp-results-grid {
		grid-template-columns: minmax(0, 1fr) !important;
		gap: 12px !important;
	}

	body.rwdpa-finder-styled :is(.e-con, .e-con-inner):has(> .elementor-widget-rwdp_dealer_list) #rwdp-map {
		height: var(--rwdpa-finder-height) !important;
	}
}

/* ── Search bar ──────────────────────────────────────────────────────── */
body.rwdpa-finder-styled .rwdp-dealer-finder .rwdp-finder__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 14px;
	background: var(--rwdpa-finder-panel);
	border-radius: var(--rwdpa-finder-radius);
}

body.rwdpa-finder-styled .rwdp-dealer-finder .rwdp-finder__search {
	display: flex;
	flex: 1 1 320px;
	min-width: 0;
	gap: 0;
}

body.rwdpa-finder-styled .rwdp-dealer-finder .rwdp-finder__input {
	flex: 1;
	min-width: 0;
	height: 48px;
	padding: 0 18px;
	border: 1px solid var(--rwdpa-finder-line);
	border-right: 0;
	border-radius: 999px 0 0 999px;
	background: #ffffff;
	font: inherit;
	color: var(--rwdpa-finder-text);
}

body.rwdpa-finder-styled .rwdp-dealer-finder .rwdp-finder__input:focus {
	outline: 2px solid color-mix(in srgb, var(--rwdpa-finder-accent) 30%, transparent);
	outline-offset: 0;
	border-color: var(--rwdpa-finder-accent);
}

body.rwdpa-finder-styled .rwdp-dealer-finder #rwdp-search-btn {
	height: 48px;
	padding: 0 26px;
	border: 0;
	border-radius: 0 999px 999px 0;
	background: var(--rwdpa-finder-accent);
	color: var(--rwdpa-finder-accent-text);
	font-family: var(--rwdpa-finder-label-font, inherit);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	cursor: pointer;
}

body.rwdpa-finder-styled .rwdp-dealer-finder #rwdp-search-btn:hover,
body.rwdpa-finder-styled .rwdp-dealer-finder #rwdp-search-btn:focus-visible {
	opacity: 0.88;
}

body.rwdpa-finder-styled .rwdp-dealer-finder :is(.rwdp-finder__radius, .rwdp-finder__type-filter) select {
	height: 48px;
	padding: 0 34px 0 14px;
	border: 1px solid var(--rwdpa-finder-line);
	border-radius: 999px;
	background-color: #ffffff;
	font: inherit;
	color: var(--rwdpa-finder-text);
	cursor: pointer;
}

/* ── Map ─────────────────────────────────────────────────────────────── */
body.rwdpa-finder-styled .rwdp-finder__map-wrap,
body.rwdpa-finder-styled #rwdp-map {
	border-radius: var(--rwdpa-finder-radius);
	overflow: hidden;
}

/* ── Result list ─────────────────────────────────────────────────────── */
body.rwdpa-finder-styled .rwdp-finder__results .rwdp-finder__hint,
body.rwdpa-finder-styled .rwdp-finder__results .rwdp-finder__no-results {
	margin: 0 0 12px;
	padding: 12px 14px;
	background: var(--rwdpa-finder-panel);
	border-radius: var(--rwdpa-finder-radius);
	color: var(--rwdpa-finder-muted);
	font-size: 0.95rem;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card {
	padding: 16px 16px 14px;
	border: 1px solid var(--rwdpa-finder-line);
	border-radius: var(--rwdpa-finder-radius);
	background: var(--rwdpa-finder-card);
	box-shadow: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card:hover,
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card:focus-within {
	border-color: var(--rwdpa-finder-accent);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Card body: text lines full width, then the buttons side by side.
   The address row and actions wrapper are flattened so their buttons can
   share one row (order keeps the reading order). */
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__body {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px 8px;
	padding: 0;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__body > *,
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__address-row > .rwdp-result-card__address {
	flex: 0 0 100%;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__address-row, .rwdp-result-card__actions) {
	display: contents !important;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__logo-wrap { order: 0; }
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__title { order: 1; }
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__address { order: 2; }
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__phone { order: 3; }
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__website { order: 4; }
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__hours { order: 5; }
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__directions, .rwdp-result-card__more-info, .rwdp-result-card__contact) {
	order: 10;
	flex: 0 0 auto;
	margin-top: 10px !important;
}

/* Title: full width (the "View on Map" button no longer sits on top of it). */
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__title {
	margin: 0 0 4px;
	padding: 0;
	font-family: var(--rwdpa-finder-label-font, inherit);
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--rwdpa-finder-text);
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__address-row {
	display: block;
	margin: 0;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__address, .rwdp-result-card__hours, .rwdp-result-card__website) {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.45;
	color: var(--rwdpa-finder-muted);
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__phone {
	margin: 4px 0 0;
	font-size: 0.95rem;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__phone, .rwdp-result-card__website) a {
	color: var(--rwdpa-finder-link);
	font-weight: 600;
	text-decoration: none;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__phone, .rwdp-result-card__website) a:hover {
	text-decoration: underline;
}

/* Actions: one tidy row — Directions (outline), More Info / Contact, View on map (text). */
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 12px 0 0;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__directions {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__directions, .rwdp-result-card__more-info, .rwdp-result-card__contact) {
	padding: 7px 14px;
	border: 1px solid var(--rwdpa-finder-accent);
	border-radius: 999px;
	background: transparent;
	color: var(--rwdpa-finder-accent);
	font-family: var(--rwdpa-finder-label-font, inherit);
	font-size: 0.82rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: none;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__contact {
	background: var(--rwdpa-finder-accent);
	color: var(--rwdpa-finder-accent-text);
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card :is(.rwdp-result-card__directions, .rwdp-result-card__more-info):hover {
	background: var(--rwdpa-finder-accent);
	color: var(--rwdpa-finder-accent-text);
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__directions * {
	width: 0.9em;
	height: 0.9em;
	color: currentColor !important;
	fill: currentColor !important;
}

/* "View on Map": was absolutely positioned over the title; now a text link
   at the bottom of the card. */
body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__view-on-map {
	position: static;
	order: 2;
	align-self: flex-start;
	margin: 10px 0 0;
	padding: 0;
	border: 0;
	background: none !important;
	box-shadow: none;
	color: var(--rwdpa-finder-link);
	font-family: var(--rwdpa-finder-label-font, inherit);
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

body.rwdpa-finder-styled .rwdp-results-grid .rwdp-result-card .rwdp-result-card__view-on-map::before {
	content: "\25CE\00a0"; /* ◎ target icon */
	text-decoration: none;
}

/* ── Map popup ───────────────────────────────────────────────────────── */
body.rwdpa-finder-styled .rwdp-infowindow__name {
	font-family: var(--rwdpa-finder-label-font, inherit);
	color: var(--rwdpa-finder-text);
}

body.rwdpa-finder-styled .rwdp-infowindow a {
	color: var(--rwdpa-finder-link);
}

/* ── Phones / tablets: stacked, shorter map ──────────────────────────── */
@media (max-width: 1024px) {
	body.rwdpa-finder-styled #rwdp-map {
		height: 380px !important;
	}

	body.rwdpa-finder-styled .rwdp-results-grid {
		grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
		gap: 12px !important;
	}
}

@media (max-width: 600px) {
	body.rwdpa-finder-styled .rwdp-dealer-finder .rwdp-finder__search {
		flex-basis: 100%;
	}

	body.rwdpa-finder-styled .rwdp-dealer-finder :is(.rwdp-finder__radius, .rwdp-finder__type-filter) {
		flex: 1 1 0;
	}

	body.rwdpa-finder-styled .rwdp-dealer-finder :is(.rwdp-finder__radius, .rwdp-finder__type-filter) select {
		width: 100%;
	}

	body.rwdpa-finder-styled .rwdp-results-grid {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}
