/**
 * Store finder and store page styles.
 *
 * Scoped under .osl-. Colours are CSS custom properties so a theme can
 * override them without touching the plugin.
 *
 * @package OSL
 */

.osl-finder,
.osl-store {
	--osl-color-accent: #1b6ac9;
	--osl-color-surface: #ffffff;
	--osl-color-text: #1f2933;
	--osl-color-muted: #5f6b7a;
	--osl-color-border: #d7dde5;
	--osl-color-danger: #b3261e;
	--osl-radius: 12px;
	--osl-gap: 16px;
	--osl-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
	--osl-type-official: #1b6ac9;
	--osl-type-retailer: #1a7f37;
	--osl-type-premium: #b26b00;
	--osl-badge-official-bg: #e7f0fb;
	--osl-badge-retailer-bg: #e6f4ea;
	--osl-badge-premium-bg: #fff4e0;
}

.osl-finder [hidden],
.osl-store [hidden] {
	display: none !important;
}

/* Finder --------------------------------------------------------------- */

.osl-finder {
	margin: 1.5rem 0;
	color: var(--osl-color-text);
}

.osl-finder__search {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 10px;
}

.osl-finder__input {
	flex: 1 1 260px;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--osl-color-border);
	border-radius: 8px;
	background: var(--osl-color-surface);
	color: inherit;
	font: inherit;
}

.osl-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 16px;
	border: 1px solid var(--osl-color-border);
	border-radius: 8px;
	background: var(--osl-color-surface);
	color: var(--osl-color-text);
	font: inherit;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.osl-button--primary {
	border-color: var(--osl-color-accent);
	background: var(--osl-color-accent);
	color: #ffffff;
}

.osl-button--location {
	border-style: dashed;
}

.osl-button:disabled {
	cursor: wait;
	opacity: 0.65;
}

.osl-finder__message {
	margin: 0 0 10px;
	color: var(--osl-color-muted);
}

.osl-finder__message:empty {
	display: none;
}

.osl-finder__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-start;
	padding: 14px;
	margin-bottom: 12px;
	border: 1px solid var(--osl-color-border);
	border-radius: var(--osl-radius);
	background: var(--osl-color-surface);
}

.osl-filter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 160px;
}

.osl-filter--types {
	flex: 1 1 240px;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
}

.osl-filter__label {
	font-size: 0.875rem;
	font-weight: 600;
}

.osl-filter--types .osl-filter__label {
	flex-basis: 100%;
	padding: 0;
}

.osl-filter__control {
	padding: 8px 10px;
	border: 1px solid var(--osl-color-border);
	border-radius: 8px;
	background: var(--osl-color-surface);
	color: inherit;
	font: inherit;
}

.osl-checkbox {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.9375rem;
	cursor: pointer;
}

.osl-checkbox input {
	accent-color: var(--osl-color-accent);
}

.osl-finder__tabs {
	display: none;
}

.osl-finder__body {
	display: grid;
	grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
	gap: var(--osl-gap);
	align-items: start;
}

.osl-finder__list-pane {
	min-width: 0;
}

.osl-finder__count {
	margin: 0 0 6px;
	color: var(--osl-color-muted);
	font-size: 0.875rem;
}

.osl-finder__radius-note {
	margin: 0 0 8px;
	padding: 8px 10px;
	border-radius: 8px;
	background: var(--osl-badge-premium-bg);
	color: var(--osl-type-premium);
	font-size: 0.875rem;
}

.osl-finder__list {
	display: grid;
	gap: 10px;
	max-height: 600px;
	padding-right: 4px;
	overflow-y: auto;
}

.osl-finder__empty {
	margin: 12px 0;
	padding: 18px;
	border: 1px dashed var(--osl-color-border);
	border-radius: var(--osl-radius);
	color: var(--osl-color-muted);
	text-align: center;
}

.osl-finder__loading {
	margin: 10px 0;
	color: var(--osl-color-muted);
}

.osl-finder__map {
	width: 100%;
	overflow: hidden;
	border-radius: var(--osl-radius);
	background: #e9eef5;
}

.osl-finder__map .leaflet-control-attribution,
.osl-store__map .leaflet-control-attribution {
	font-size: 11px;
	background: rgba(255, 255, 255, 0.85);
}

/* Cards --------------------------------------------------------------- */

.osl-card {
	padding: 14px 16px;
	border: 1px solid var(--osl-color-border);
	border-radius: var(--osl-radius);
	background: var(--osl-color-surface);
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.osl-card:hover,
.osl-card:focus-visible,
.osl-card.is-active {
	border-color: var(--osl-color-accent);
	box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
	outline: none;
}

.osl-card:focus-visible {
	box-shadow: 0 0 0 3px rgba(27, 106, 201, 0.35);
}

.osl-card__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
}

.osl-card__name {
	margin: 0;
	font-size: 1.0625rem;
	line-height: 1.3;
}

.osl-card__address,
.osl-card__distance {
	margin: 6px 0 0;
	color: var(--osl-color-muted);
	font-size: 0.9375rem;
}

.osl-card__distance {
	color: var(--osl-color-text);
	font-weight: 600;
}

.osl-card__phone {
	display: inline-block;
	margin-top: 8px;
}

.osl-card__links {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: center;
	margin-top: 10px;
}

.osl-card__map-btn {
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--osl-color-accent);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.osl-card__note {
	margin: 10px 0 0;
	color: var(--osl-type-premium);
	font-size: 0.8125rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Badges -------------------------------------------------------------- */

.osl-badge {
	display: inline-block;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
}

.osl-badge--official {
	background: var(--osl-badge-official-bg);
	color: var(--osl-type-official);
}

.osl-badge--retailer {
	background: var(--osl-badge-retailer-bg);
	color: var(--osl-type-retailer);
}

.osl-badge--premium_retailer {
	background: var(--osl-badge-premium-bg);
	color: var(--osl-type-premium);
}

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

.osl-marker {
	border: 0;
	background: transparent;
}

.osl-marker svg {
	display: block;
}

.osl-marker--official {
	color: var(--osl-type-official);
}

.osl-marker--retailer {
	color: var(--osl-type-retailer);
}

.osl-marker--premium_retailer {
	color: var(--osl-type-premium);
}

.osl-marker--user {
	color: var(--osl-color-accent);
}

.osl-finder .marker-cluster {
	background-color: rgba(27, 106, 201, 0.25);
}

.osl-finder .marker-cluster div {
	background-color: var(--osl-color-accent);
	color: #ffffff;
}

.osl-map--error {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	color: var(--osl-color-muted);
	text-align: center;
}

/* Store page ---------------------------------------------------------- */

.osl-store {
	max-width: 1100px;
	margin: 2rem auto;
	padding: 0 1rem;
	color: var(--osl-color-text);
}

.osl-store__article {
	display: block;
}

.osl-store__back {
	margin: 0 0 1rem;
}

.osl-store__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 1rem;
}

.osl-store__title {
	margin: 0;
	font-size: 2rem;
	line-height: 1.15;
}

.osl-store__media img {
	width: 100%;
	height: auto;
	border-radius: var(--osl-radius);
}

.osl-store__details {
	display: grid;
	gap: 6px;
	margin: 1rem 0 1.5rem;
}

.osl-store__details p {
	margin: 0;
}

.osl-store__details a {
	color: var(--osl-color-accent);
}

.osl-store__map {
	width: 100%;
	min-height: 320px;
	overflow: hidden;
	border-radius: var(--osl-radius);
	background: #e9eef5;
}

.osl-store__map-wrap {
	margin: 1rem 0 1.5rem;
}

.osl-store__collections {
	margin: 1.5rem 0;
}

.osl-store__collections h2 {
	margin: 0 0 0.75rem;
	font-size: 1.375rem;
}

.osl-collection-group {
	margin-top: 1rem;
}

.osl-collection-group__title {
	margin: 0 0 6px;
	font-size: 1rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--osl-color-muted);
}

.osl-collection-group__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.osl-collection-group__list a {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--osl-color-border);
	border-radius: 999px;
	color: var(--osl-color-text);
	text-decoration: none;
}

.osl-collection-group__list a:hover,
.osl-collection-group__list a:focus-visible {
	border-color: var(--osl-color-accent);
	color: var(--osl-color-accent);
}

.osl-store__description {
	margin-top: 1.5rem;
}

.osl-store__description img {
	max-width: 100%;
	height: auto;
}

.osl-preline {
	white-space: pre-line;
}

/* Utilities ----------------------------------------------------------- */

.osl-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Tabs (mobile) ------------------------------------------------------- */

@media (max-width: 767px) {
	.osl-finder__tabs {
		display: flex;
		gap: 8px;
		margin: 0 0 10px;
	}

	.osl-tab {
		flex: 1 1 0;
		padding: 10px 12px;
		border: 1px solid var(--osl-color-border);
		border-radius: 8px;
		background: var(--osl-color-surface);
		color: var(--osl-color-text);
		font: inherit;
		cursor: pointer;
	}

	.osl-tab.is-active {
		border-color: var(--osl-color-accent);
		background: var(--osl-color-accent);
		color: #ffffff;
	}

	.osl-finder__body {
		display: block;
	}

	.osl-finder[data-view="list"] [data-osl-pane="map"],
	.osl-finder[data-view="map"] [data-osl-pane="list"] {
		display: none;
	}

	.osl-finder__list {
		max-height: none;
		padding-right: 0;
	}

	.osl-finder__search .osl-button {
		flex: 1 1 auto;
	}

	.osl-store__title {
		font-size: 1.625rem;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	.osl-finder__body {
		grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
	}
}

/* Focus --------------------------------------------------------------- */

.osl-finder a:focus-visible,
.osl-finder button:focus-visible,
.osl-finder input:focus-visible,
.osl-finder select:focus-visible,
.osl-store a:focus-visible,
.osl-store button:focus-visible {
	outline: 3px solid rgba(27, 106, 201, 0.55);
	outline-offset: 2px;
}

/* Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.osl-card {
		transition: none;
	}
}

/* Product button ------------------------------------------------------- */

.osl-pbtn-wrap {
	margin: 1.25rem 0;
}

.osl-pbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	min-height: 46px;
	padding: 0.7rem 1.35rem;
	border: 1px solid #1b2a41;
	border-radius: 999px;
	background: #1b2a41;
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.osl-pbtn:hover,
.osl-pbtn:focus-visible {
	background: #28405f;
	border-color: #28405f;
	color: #fff;
}

.osl-pbtn.is-loading {
	opacity: 0.75;
	cursor: progress;
}

.osl-pbtn__spinner {
	display: none;
	width: 1em;
	height: 1em;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: osl-spin 0.8s linear infinite;
}

.osl-pbtn.is-loading .osl-pbtn__spinner {
	display: inline-block;
}

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

.osl-pbtn__note {
	margin: 0.5rem 0 0;
	color: #5b6572;
	font-size: 0.875rem;
}

.osl-product-link {
	margin: 1.25rem 0;
}

.osl-product-link__anchor {
	display: inline-block;
	font-weight: 600;
}

/* Product modal -------------------------------------------------------- */

body.osl-modal-open {
	overflow: hidden;
}

.osl-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(15, 23, 36, 0.62);
}

.osl-modal__dialog {
	display: flex;
	flex-direction: column;
	width: min(1040px, 100%);
	max-height: min(88vh, 900px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 30px 80px rgba(15, 23, 36, 0.35);
	overflow: hidden;
}

.osl-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.15rem 1.35rem 0.25rem;
}

.osl-modal__title {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.3;
	color: #1b2a41;
}

.osl-modal__close {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border: 1px solid #d7dde5;
	border-radius: 50%;
	background: #fff;
	color: #1b2a41;
	font-size: 0;
	cursor: pointer;
	position: relative;
}

.osl-modal__close::before,
.osl-modal__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 15px;
	height: 2px;
	background: currentColor;
	transform: translate(-50%, -50%) rotate(45deg);
}

.osl-modal__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.osl-modal__search {
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem 1.35rem 0.4rem;
	flex-wrap: wrap;
}

.osl-modal__input {
	flex: 1 1 220px;
	min-height: 42px;
	padding: 0.55rem 0.8rem;
	border: 1px solid #cfd7e1;
	border-radius: 8px;
	font: inherit;
}

.osl-modal__message {
	min-height: 1.2em;
	margin: 0;
	padding: 0 1.35rem;
	color: #6b4c00;
	font-size: 0.875rem;
}

.osl-modal__tabs {
	display: none;
	gap: 0.35rem;
	padding: 0.4rem 1.35rem;
}

.osl-modal__tab {
	flex: 1 1 0;
	min-height: 38px;
	border: 1px solid #cfd7e1;
	background: #fff;
	border-radius: 8px;
	font: inherit;
	cursor: pointer;
}

.osl-modal__tab.is-active {
	background: #1b2a41;
	border-color: #1b2a41;
	color: #fff;
}

.osl-modal__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	min-height: 0;
	flex: 1 1 auto;
}

.osl-modal__list-pane {
	min-height: 0;
	overflow-y: auto;
	padding: 0.65rem 1.35rem 1rem;
}

.osl-modal__list {
	display: grid;
	gap: 0.75rem;
}

.osl-modal__empty,
.osl-modal__radius-note {
	margin: 0.75rem 0;
	color: #5b6572;
}

.osl-modal__more {
	margin-top: 0.85rem;
}

.osl-modal__map-pane {
	min-height: 320px;
	border-left: 1px solid #e2e7ee;
}

.osl-modal__map {
	width: 100%;
	height: 100%;
	min-height: 320px;
}

.osl-modal__footer {
	display: flex;
	align-items: center;
	gap: 0.75rem 1.25rem;
	flex-wrap: wrap;
	padding: 0.85rem 1.35rem;
	border-top: 1px solid #e2e7ee;
	background: #f8fafc;
	font-size: 0.875rem;
}

.osl-modal__count {
	margin: 0;
	font-weight: 600;
}

.osl-modal__disclaimer {
	flex: 1 1 260px;
	margin: 0;
	color: #5b6572;
}

.osl-modal__all {
	margin-left: auto;
	font-weight: 600;
}

@media (max-width: 767px) {
	.osl-modal {
		padding: 0;
	}

	.osl-modal__dialog {
		width: 100%;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}

	.osl-modal__tabs {
		display: flex;
	}

	.osl-modal__body {
		grid-template-columns: 1fr;
	}

	.osl-modal__map-pane {
		border-left: 0;
		min-height: 0;
	}

	.osl-modal[data-view="list"] .osl-modal__map-pane {
		display: none;
	}

	.osl-modal[data-view="map"] .osl-modal__list-pane {
		display: none;
	}

	.osl-modal[data-view="map"] .osl-modal__map-pane {
		display: block;
	}

	.osl-modal__map,
	.osl-modal__map-pane {
		height: 100%;
	}

	.osl-modal__footer {
		flex-wrap: nowrap;
		overflow-x: auto;
	}

	.osl-modal__disclaimer {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.osl-pbtn {
		transition: none;
	}
}

