/* ============================================================
 * Topro Dealer Locator — front-end styles.
 * Rename to .scss and wrap rules under .topro-dealer-locator
 * if you want SASS nesting; the cascade below is already scoped.
 * ============================================================ */

.topro-dealer-locator {
	--tdl-sidebar-width: 360px;
	--tdl-height: 80vh;
	--tdl-accent: #BA0C2F;
	--tdl-text: #1f2328;
	--tdl-muted: #6b7280;
	--tdl-border: #E6DFD4;
	--tdl-card-bg: #ffffff;
	--tdl-card-shadow: none;
	--tdl-radius: 9.5px;

	display: grid;
	grid-template-columns: var( --tdl-sidebar-width ) 1fr;
	gap: 1rem;
	height: var( --tdl-height );
	min-height: 520px;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc( 50% - 50vw );
	margin-right: calc( 50% - 50vw );
	padding-inline: 80px;
	box-sizing: border-box;
	background: #fff;
	color: var( --tdl-text );
	font-family: inherit;
}

@media ( max-width: 1500px ) {
	.topro-dealer-locator {
		padding-inline: 48px;
	}
}

@media ( max-width: 900px ) {
	.topro-dealer-locator {
		grid-template-columns: 1fr;
		grid-template-rows: 1fr 1fr;
		height: auto;
		padding: 0 24px;
	}
}


/* -------- Sidebar -------- */

.topro-dealer-locator__sidebar {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #fff;
}

.topro-dealer-locator__controls {
	position: sticky;
	top: 0;
	z-index: 2;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.topro-dealer-locator__search {
	position: relative;
	display: block;
}

.topro-dealer-locator__search-label {
	display: block;
	margin: 0 0 8px;
	font-size: 1.125rem;
	color: var( --tdl-text );
}

.topro-dealer-locator__search::before {
	content: '';
	position: absolute;
	left: 12px;
	bottom: 13px;
	width: 16px;
	height: 16px;
	background-image: url( "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>" );
	background-repeat: no-repeat;
	pointer-events: none;
}

.topro-dealer-locator__search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px 10px 36px;
	font-size: 1rem;
	line-height: 1.2;
	padding-left: 2rem !important;
	border: 1px solid #000;
	border-radius: 5px;
	background: #fff;
	color: inherit;
}

.topro-dealer-locator__search-input::placeholder {
	font-family: inherit;
	font-weight: 400;
	font-size: 1rem;
	line-height: 1.2;
}

.topro-dealer-locator__search-input:focus {
	outline: 2px solid var( --tdl-accent );
	outline-offset: 1px;
	border-color: transparent;
}

.topro-dealer-locator__geo-btn {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	align-self: flex-start;
	padding: 10px 20px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: var( --tdl-accent );
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.topro-dealer-locator__geo-btn::before {
	content: '';
	width: 16px;
	height: 16px;
	background-image: url( "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22' fill='%23fff'><path d='M11 0c.55 0 1 .45 1 1v1.06c4.17.46 7.48 3.77 7.94 7.94H21c.55 0 1 .45 1 1s-.45 1-1 1h-1.06c-.46 4.17-3.77 7.48-7.94 7.94V21c0 .55-.45 1-1 1s-1-.45-1-1v-1.06c-4.17-.46-7.48-3.77-7.94-7.94H1c-.55 0-1-.45-1-1s.45-1 1-1h1.06C2.52 6.83 5.83 3.52 10 3.06V2c0-.55.45-1 1-1zm0 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm0 3a4 4 0 1 1 0 8 4 4 0 0 1 0-8z'/></svg>" );
	background-repeat: no-repeat;
	background-position: center;
}

.topro-dealer-locator__geo-btn:hover,
.topro-dealer-locator__geo-btn:focus-visible {
	background: #9a0a27;
	outline: none;
}

.topro-dealer-locator__summary {
	margin: 4px 0 0;
	padding: 6px 4px 0;
	font-size: 1rem;
	color: var( --tdl-muted );
}

.topro-dealer-locator__summary:empty {
	display: none;
}

/* -------- List (independently scrolling) -------- */

.topro-dealer-locator__list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

.topro-dealer-locator__placeholder {
	margin: 24px 0;
	color: var( --tdl-muted );
}

.topro-dealer-locator__group {
	margin: 0 0 20px;
}

.topro-dealer-locator__group-letter {
	margin: 12px 0 8px;
	font-size: 22px;
	font-weight: 700;
	color: var( --tdl-text );
	letter-spacing: 0.02em;
	font-family: inherit;
}

.topro-dealer-locator__group-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.topro-dealer-locator__city,
.topro-dealer-locator__country,
.topro-dealer-locator__dealer {
	display: grid;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 14px 16px;
	font: inherit;
	text-align: left;
	color: inherit;
	background: var( --tdl-card-bg );
	border: 1px solid var( --tdl-border );
	border-radius: var( --tdl-radius );
	box-shadow: var( --tdl-card-shadow );
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.05s ease;
}

.topro-dealer-locator__city,
.topro-dealer-locator__country {
	display: flex;
}

.topro-dealer-locator__country-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.topro-dealer-locator__dealer {
	grid-template-columns: 1fr;
	grid-template-areas:
		"name"
		"meta";
	row-gap: 4px;
}

.topro-dealer-locator__city:hover,
.topro-dealer-locator__country:hover,
.topro-dealer-locator__dealer:hover {
	border-color: #c9b896;
}

.topro-dealer-locator__city:active,
.topro-dealer-locator__country:active,
.topro-dealer-locator__dealer:active {
	transform: translateY( 1px );
}

.topro-dealer-locator__item-label {
	font-weight: 600;
}

.topro-dealer-locator__item-count {
	margin-left: 12px;
	font-size: 14px;
	color: var( --tdl-muted );
}

.topro-dealer-locator__item-chev {
	margin-left: auto;
	color: var( --tdl-muted );
}

.topro-dealer-locator__dealer-name {
	grid-area: name;
	font-weight: 600;
}

.topro-dealer-locator__dealer-meta {
	grid-area: meta;
	font-size: 1.125rem;
	color: var( --tdl-muted );
}

.topro-dealer-locator__dealer-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* -------- View header (back button + title) -------- */

.topro-dealer-locator__view-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1.25rem;
	margin-bottom: 1.25rem;
}

.topro-dealer-locator__back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0;
	font-size: 1.125rem;
	color: var( --tdl-text );
	background: transparent;
	border: 0;
	cursor: pointer;
	text-decoration: none;
}

.topro-dealer-locator__back-label {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.topro-dealer-locator__back:hover,
.topro-dealer-locator__back:focus-visible {
	color: var( --tdl-accent );
	outline: none;
}

.topro-dealer-locator__view-title {
	font-family: inherit;
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	text-align: left;
}

.topro-dealer-locator__view-count {
	color: var( --tdl-muted );
	font-weight: 500;
}

/* -------- Detail view -------- */

.topro-dealer-locator__detail {
	padding: 4px 2px 8px;
}

.topro-dealer-locator__detail-name {
	margin: 0 0 6px;
	font-size: 20px;
	font-weight: 700;
}

.topro-dealer-locator__detail-address {
	margin-bottom: 2rem;
	font-size: 1.125rem;
}

.topro-dealer-locator__contact {
	list-style: none;
	margin: 0 0 2rem;
	padding: 0;
	font-size: 1rem;
}

.topro-dealer-locator__contact li {
	margin: 0;
	padding: 2px 0;
	word-break: break-word;
}

.topro-dealer-locator__contact a {
	color: var( --tdl-text );
	text-decoration: underline;
}

.topro-dealer-locator__detail-section {
	margin: 16px 0 0;
}

.topro-dealer-locator__detail-section h4 {
	margin-bottom: 1rem;
	font-size: 1.125rem;
	font-weight: 600;
	font-family: inherit;
}

.topro-dealer-locator__detail-section .topro-dealer-locator__hours {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: stretch;
	margin: 0;
	padding: 0;
	font-size: 1rem;
}

.topro-dealer-locator__detail-section .topro-dealer-locator__hours dt,
.topro-dealer-locator__detail-section .topro-dealer-locator__hours dd {
	padding-block: 10px;
	border-bottom: 1px solid #E6DFD4;
}

.topro-dealer-locator__detail-section .topro-dealer-locator__hours dt {
	padding-right: 48px;
	font-weight: 400;
}

.topro-dealer-locator__detail-section .topro-dealer-locator__hours dd {
	margin: 0;
}

.topro-dealer-locator__detail-loading,
.topro-dealer-locator__detail-error {
	margin: 8px 0 0;
	padding: 8px 10px;
	font-size: 13px;
	color: var( --tdl-muted );
	background: #f3f4f6;
	border-radius: var( --tdl-radius );
}

.topro-dealer-locator__detail-error {
	color: #991b1b;
	background: #fef2f2;
}

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

.topro-dealer-locator__map {
	min-height: 0;
	height: 100%;
	width: 100%;
}

/* -------- Info window (Google bubble) -------- */

.topro-dealer-locator__iw {
	max-width: 280px;
	font-family: var(--wp--preset--font-family--inter);
}

.topro-dealer-locator__iw h4 {
	margin: 0 0 4px;
	font-size: 16px;
	font-family: inherit;
}

.topro-dealer-locator__iw p {
	margin: 0 0 6px;
	color: var( --tdl-muted );
}

.topro-dealer-locator__hours {
	margin: 8px 0 0;
	padding-left: 16px;
	font-size: 12px;
	color: var( --tdl-text );
}

/* -------- Editor preview -------- */

.topro-dealer-locator-editor-preview {
	padding: 16px;
	border: 1px dashed var( --tdl-border, #ccc );
	border-radius: 8px;
	background: #f9fafb;
}
