/**
 * Store Locator - Frontend Styles
 *
 * @package MBWS_Store_Locator
 */

.mbws-store-locator {
	--sl-primary: #2271b1;
	--sl-border: #e2e4e7;
	--sl-text: #1d2327;
	--sl-text-light: #646970;
	--sl-bg-card: #ffffff;
	--sl-radius: 10px;
	--sl-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
	--sl-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);

	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--sl-text);
	max-width: 1400px;
	margin: 0 auto;
}

.mbws-store-locator *,
.mbws-store-locator *::before,
.mbws-store-locator *::after {
	box-sizing: border-box;
}

/* Filter */
.store-filter {
	display: flex;
	gap: 10px;
	margin-bottom: 12px;
}

.store-filter__field {
	flex: 1;
}

.store-filter__select {
	width: 100%;
	height: 42px;
	padding: 0 30px 0 12px;
	border: 1px solid var(--sl-border);
	border-radius: 6px;
	background-color: #fff;
	font-size: 14px;
	color: var(--sl-text);
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23646970' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 10px 6px;
	cursor: pointer;
	transition: border-color 0.2s ease;
	margin: unset;
}

.store-filter__select:focus {
	outline: none;
	border-color: var(--sl-primary);
}

.store-filter__select:disabled {
	background-color: #f6f7f7;
	color: #a7aaad;
	cursor: not-allowed;
}

/* Layout */
.store-locator__body {
	display: flex;
	gap: 12px;
	align-items: stretch;
}

.store-sidebar {
	flex: 0 0 40%;
	max-width: 40%;
	display: flex;
	flex-direction: column;
}

.store-map {
	flex: 0 0 60%;
	max-width: 60%;
	position: relative;
	min-height: 400px;
	border-radius: 6px;
	overflow: hidden;
	background: #f0f0f1;
}

.store-map__iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.store-map__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--sl-text-light);
	font-size: 14px;
	background: #f0f0f1;
	pointer-events: none;
}

.store-map.has-map .store-map__placeholder {
	display: none;
}

.store-map.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	z-index: 2;
}

.store-map.is-loading::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin-top: -16px;
	margin-left: -16px;
	border: 3px solid var(--sl-border);
	border-top-color: var(--sl-primary);
	border-radius: 50%;
	z-index: 3;
	animation: sl-spin 0.7s linear infinite;
}

/* Store list */
.store-list {
	flex: 1;
	overflow-y: auto;
	min-height: 0;
	padding-right: 4px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.store-list__items {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.store-list__loading,
.store-list__empty,
.store-list__error {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 32px 16px;
	color: var(--sl-text-light);
	font-size: 14px;
	text-align: center;
}

.store-list__error {
	color: #d63638;
}

.sl-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--sl-border);
	border-top-color: var(--sl-primary);
	border-radius: 50%;
	display: inline-block;
	animation: sl-spin 0.7s linear infinite;
}

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

/* Store card */
.store-item {
	background: var(--sl-bg-card);
	border: 1px solid var(--sl-border);
	border-radius: 6px;
	box-shadow: none;
	padding: 12px 16px;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.store-item:hover {
	border-color: var(--sl-primary);
}

.store-item:focus-visible {
	outline: 2px solid var(--sl-primary);
	outline-offset: 2px;
}

.store-item.store-active {
	border-color: var(--sl-primary);
	background: #ffffff;
}

.store-item__title {
	margin: 0 0 6px;
	font-size: 14.5px;
	font-weight: 700;
	color: var(--sl-text);
}

.store-item__row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 4px 0;
	font-size: 13px;
	color: var(--sl-text);
	line-height: 1.4;
}

.store-item__row a {
	color: inherit;
	text-decoration: none;
	word-break: break-word;
}

.store-item__row a:hover {
	text-decoration: underline;
}

.store-item__fb-link {
	color: #1877f2 !important;
	display: inline-flex;
	align-items: center;
	margin-left: 6px;
	font-size: 14px;
}

.store-item__zalo-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 6px;
	vertical-align: middle;
}

.store-item__zalo-link svg {
	width: 16px;
	height: 16px;
}

.store-item__icon {
	flex: 0 0 auto;
	margin-top: 1px;
	color: var(--sl-text-light);
	font-size: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
	.store-sidebar {
		flex-basis: 40%;
		max-width: 40%;
	}

	.store-map {
		flex-basis: 60%;
		max-width: 60%;
	}
}

@media (max-width: 782px) {
	.store-locator__body {
		flex-direction: column;
		height: auto !important;
	}

	.store-sidebar {
		display: block;
		height: auto;
	}

	.store-sidebar,
	.store-map {
		flex-basis: 100%;
		max-width: 100%;
	}

	.store-map {
		height: 400px !important;
	}

	.store-list {
		height: 400px;
		overflow-y: auto;
	}

	.store-filter {
		flex-direction: column;
	}
}