/*
 * ATS Stockist locator.
 * Colours come from the theme's design tokens where available, with the
 * palette's own values as fallbacks so the panel still looks right if the
 * plugin is used on another theme.
 */

/* Themes commonly style bare <button> elements. The list rows and pager are
   buttons for keyboard access, so neutralise inherited fills, transforms and
   radii before the locator's own styling is applied. */
.ats-stk :where(button) {
	appearance: none;
	-webkit-appearance: none;
	background: none;
	border: 0;
	border-radius: 0;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	text-shadow: none;
	box-shadow: none;
	line-height: 1.4;
}

.ats-stk :where(button):hover,
.ats-stk :where(button):focus {
	color: inherit;
}

.ats-stk {
	--stk-bg: var(--ats-surface, #101215);
	--stk-bg-alt: var(--ats-surface-up, #14161a);
	--stk-border: var(--ats-border, #262a2f);
	--stk-text: var(--ats-text, #f4f5f6);
	--stk-muted: var(--ats-muted, #9aa0a8);
	--stk-dim: var(--ats-dim, #8a9098);
	--stk-accent: var(--ats-accent, #1e6fd9);
	--stk-accent-lt: var(--ats-accent-lt, #4c9aff);

	color: var(--stk-text);
	font-family: 'Manrope', system-ui, sans-serif;
}

/* --------------------------------------------------- search row --------- */

.ats-stk__search {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 14px;
	margin-bottom: 22px;
}

.ats-stk__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 240px;
	min-width: 0;
}

.ats-stk__field--radius {
	flex: 0 1 190px;
}

.ats-stk__field label {
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--stk-dim);
}

.ats-stk__input {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 14px;
	background: var(--stk-bg-alt);
	border: 1px solid var(--stk-border);
	color: var(--stk-dim);
}

.ats-stk__input input {
	flex: 1 1 auto;
	min-width: 0;
	height: 50px;
	background: none;
	border: 0;
	outline: none;
	color: var(--stk-text);
	font: inherit;
	font-size: 15px;
}

.ats-stk__input input::placeholder {
	color: var(--stk-dim);
}

.ats-stk__field select {
	height: 52px;
	padding: 0 14px;
	background: var(--stk-bg-alt);
	border: 1px solid var(--stk-border);
	border-radius: 0;
	color: var(--stk-text);
	font: inherit;
	font-size: 15px;
}

.ats-stk .ats-stk__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	height: 52px;
	padding: 0 26px;
	border: 1px solid transparent;
	border-radius: 0;
	font-family: 'Manrope', system-ui, sans-serif;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.ats-stk .ats-stk__btn--go {
	background: var(--stk-accent);
	color: #fff;
}

.ats-stk .ats-stk__btn--go:hover {
	background: var(--ats-accent-dk, #14509e);
	color: #fff;
}

.ats-stk .ats-stk__btn--reset {
	background: transparent;
	border-color: var(--stk-border);
	color: var(--stk-text);
}

.ats-stk .ats-stk__btn--reset:hover {
	border-color: var(--ats-hover, #6a7078);
}

.ats-stk__status {
	margin: 0 0 14px;
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 11.5px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--stk-dim);
	min-height: 1em;
}

/* --------------------------------------------------- list + map --------- */

.ats-stk__body {
	display: grid;
	grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
	gap: 18px;
	align-items: stretch;
}

.ats-stk__list {
	display: flex;
	flex-direction: column;
	max-height: 540px;
	overflow-y: auto;
	border: 1px solid var(--stk-border);
	background: var(--stk-bg);
	scrollbar-width: thin;
}

.ats-stk .ats-stk__item {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 16px;
	background: none;
	border: 0;
	border-bottom: 1px solid var(--stk-border);
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: background 0.25s;
}

.ats-stk .ats-stk__item:last-child {
	border-bottom: 0;
}

.ats-stk .ats-stk__item:hover,
.ats-stk .ats-stk .ats-stk__item.is-active {
	background: var(--stk-bg-alt);
}

.ats-stk .ats-stk__item.is-active {
	box-shadow: inset 3px 0 0 var(--stk-accent);
}

.ats-stk__logo {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	background: #fff;
	border: 1px solid var(--stk-border);
	overflow: hidden;
}

.ats-stk__logo img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.ats-stk__logo--none {
	background: var(--stk-bg-alt);
	color: var(--stk-dim);
	font-weight: 800;
	font-size: 18px;
}

.ats-stk__meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ats-stk .ats-stk__name {
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.35;
}

.ats-stk .ats-stk__addr {
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--stk-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ats-stk .ats-stk__name {
	overflow-wrap: anywhere;
}

.ats-stk__dist {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 11px;
	letter-spacing: 0.08em;
	color: var(--stk-accent-lt);
}

.ats-stk__empty {
	margin: 0;
	padding: 40px 20px;
	text-align: center;
	color: var(--stk-muted);
	font-size: 14px;
}

.ats-stk__map {
	border: 1px solid var(--stk-border);
	background: var(--stk-bg-alt);
	min-height: 540px;
	overflow: hidden;
}

.ats-stk__map iframe {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 540px;
	border: 0;
	/* OSM's tiles are light; soften them slightly so the panel sits in the
	   dark layout without hiding street detail. */
	filter: saturate(0.9) brightness(0.96);
}

/* --------------------------------------------------- pager -------------- */

.ats-stk__pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 22px;
}

.ats-stk .ats-stk__page {
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	background: transparent;
	border: 1px solid var(--stk-border);
	border-radius: 0;
	color: var(--stk-text);
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.ats-stk .ats-stk__page:hover:not(:disabled) {
	border-color: var(--ats-hover, #6a7078);
}

.ats-stk .ats-stk__page.is-current {
	background: var(--stk-accent);
	border-color: var(--stk-accent);
	color: #fff;
}

.ats-stk .ats-stk__page:disabled {
	opacity: 0.4;
	cursor: default;
}

/* --------------------------------------------------- responsive --------- */

@media (max-width: 1024px) {
	.ats-stk__body {
		grid-template-columns: 1fr;
	}

	.ats-stk__list {
		max-height: 380px;
	}

	.ats-stk__map,
	.ats-stk__map iframe {
		min-height: 380px;
	}
}

@media (max-width: 720px) {
	.ats-stk__field,
	.ats-stk__field--radius {
		flex: 1 1 100%;
	}

	.ats-stk .ats-stk__btn {
		flex: 1 1 calc(50% - 7px);
	}
}

/* Theme button styling cascades uppercase and tracking into the row's child
   spans; the row content is a business name and address, so reset it here. */
.ats-stk .ats-stk__item,
.ats-stk .ats-stk__name,
.ats-stk .ats-stk__addr {
	text-transform: none;
	letter-spacing: normal;
	white-space: normal;
}

.ats-stk .ats-stk__name {
	font-weight: 700;
	font-size: 14.5px;
	color: var(--stk-text);
}

.ats-stk .ats-stk__addr {
	font-weight: 400;
	font-size: 12.5px;
	color: var(--stk-muted);
}
