/* Autorival Multisite Search Drawer – frontend.css v3.0.0 */

:root {
	--amsd-color: #c00000;
	--amsd-color-hover: color-mix(in srgb, var(--amsd-color) 85%, black);
	--amsd-z: 99998;
}

/* ─── FAB ──────────────────────────────────────── */
#amsd-fab {
	position: fixed;
	z-index: calc(var(--amsd-z) + 1);
	width: 56px;
	height: 56px;
	background: var(--amsd-color);
	border-radius: 50%;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .22);
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease;
	color: #fff;
	border: none;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

#amsd-fab:hover,
#amsd-fab:focus-visible {
	transform: scale(1.1);
	box-shadow: 0 6px 28px rgba(0, 0, 0, .28);
}

#amsd-fab:active {
	transform: scale(.96);
}

#amsd-fab svg {
	width: 26px;
	height: 26px;
	pointer-events: none;
}

/* ─── Overlay ───────────────────────────────────── */
#amsd-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .45);
	z-index: var(--amsd-z);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	animation: amsdFadeIn .2s ease;
}

#amsd-overlay.open {
	display: block;
}

/* ─── Drawer ────────────────────────────────────── */
#amsd-drawer {
	position: fixed;
	top: 0;
	right: -480px;
	width: 420px;
	max-width: 100vw;
	height: 100vh;
	height: 100dvh;
	background: #fff;
	box-shadow: -4px 0 32px rgba(0, 0, 0, .16);
	z-index: calc(var(--amsd-z) + 1);
	display: flex;
	flex-direction: column;
	transition: right .3s cubic-bezier(.4, 0, .2, 1);
	will-change: right;
}

#amsd-drawer.open {
	right: 0;
}

/* ─── Header ────────────────────────────────────── */
.amsd-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 20px 16px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.amsd-title {
	font-size: 1.05rem;
	font-weight: 700;
	color: #111;
	letter-spacing: -.01em;
}

#amsd-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	border-radius: 6px;
	color: #666;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s, color .15s;
	line-height: 0;
}

#amsd-close svg {
	width: 20px;
	height: 20px;
}

#amsd-close:hover {
	background: #f5f5f5;
	color: var(--amsd-color);
}

/* ─── Body / scrollable ─────────────────────────── */
.amsd-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px 32px;
	overscroll-behavior: contain;
}

/* ─── Form ──────────────────────────────────────── */
#amsd-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

#amsd-site-wrap select {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid #e0e0e0;
	border-radius: 12px;
	font-size: 14px;
	color: #1a1a1a;
	background: #fafafa;
	cursor: pointer;
	outline: none;
	transition: border-color .15s, background .15s;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

#amsd-site-wrap select:focus {
	border-color: var(--amsd-color);
	background-color: #fff;
}

.amsd-input-row {
	display: flex;
	gap: 8px;
}

#amsd-input {
	flex: 1;
	padding: 10px 14px;
	border: 1.5px solid #e0e0e0;
	border-radius: 12px;
	font-size: 14px;
	color: #1a1a1a;
	background: #fafafa;
	outline: none;
	transition: border-color .15s, background .15s;
	min-width: 0;
}

#amsd-input:focus {
	border-color: var(--amsd-color);
	background: #fff;
}

#amsd-submit {
	padding: 10px 16px;
	background: var(--amsd-color);
	color: #fff;
	border: none;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	transition: opacity .15s, transform .1s;
	flex-shrink: 0;
}

#amsd-submit svg {
	width: 16px;
	height: 16px;
}

#amsd-submit:hover {
	opacity: .88;
}

#amsd-submit:active {
	transform: scale(.97);
}

#amsd-submit:disabled {
	opacity: .5;
	cursor: not-allowed;
	transform: none;
}

/* ─── Loader ─────────────────────────────────────── */
#amsd-loader {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
	color: #888;
	padding: 12px 0;
}

#amsd-loader[hidden] {
	display: none;
}

.amsd-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid #e0e0e0;
	border-top-color: var(--amsd-color);
	border-radius: 50%;
	animation: amsdSpin .7s linear infinite;
	flex-shrink: 0;
}

/* ─── Results ─────────────────────────────────────── */
.amsd-group-title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: #999;
	margin: 20px 0 10px;
}

.amsd-group-title:first-child {
	margin-top: 0;
}

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

.amsd-item {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 10px;
	border: 1px solid #f0f0f0;
	border-radius: 12px;
	text-decoration: none;
	transition: border-color .15s, background .15s, box-shadow .15s;
}

.amsd-item:hover {
	border-color: var(--amsd-color);
	background: #fafafa;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.amsd-thumb {
	flex-shrink: 0;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	overflow: hidden;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
}

.amsd-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.amsd-item-info {
	flex: 1;
	min-width: 0;
}

.amsd-item-title {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #111;
	text-decoration: none;
	line-height: 1.4;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.amsd-item:hover .amsd-item-title {
	color: var(--amsd-color);
}

.amsd-item-price {
	font-size: 13px;
	color: #1a1a1a;
	font-weight: 700;
	margin-bottom: 4px;
}

.amsd-item-price .woocommerce-Price-amount {
	font-weight: 700;
}

.amsd-item-price del {
	color: #aaa;
	font-weight: 400;
}

.amsd-item-price ins {
	text-decoration: none;
	color: var(--amsd-color);
}

.amsd-stock {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 20px;
	font-weight: 600;
}

.amsd-stock::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
}

.amsd-instock {
	background: #e8f5e9;
	color: #2e7d32;
}

.amsd-instock::before {
	background: #2e7d32;
}

.amsd-outofstock {
	background: #fce4e4;
	color: #c62828;
}

.amsd-outofstock::before {
	background: #c62828;
}

/* ─── Empty / Error states ─────────────────────── */
.amsd-no-results,
.amsd-error-msg {
	font-size: 13px;
	color: #666;
	text-align: center;
	padding: 32px 0 16px;
	line-height: 1.6;
}

.amsd-error-msg {
	color: #c62828;
}

.amsd-phone {
	text-align: center;
	font-size: 14px;
	color: #444;
	padding: 8px 0;
}

.amsd-phone a {
	color: var(--amsd-color);
	font-weight: 700;
	text-decoration: none;
}

.amsd-phone a:hover {
	text-decoration: underline;
}

/* ─── Dark mode ─────────────────────────────────── */
@media (prefers-color-scheme: dark) {
	#amsd-drawer {
		background: #1c1c1e;
	}

	.amsd-header {
		border-color: #2c2c2e;
	}

	.amsd-title {
		color: #f2f2f7;
	}

	#amsd-close {
		color: #8e8e93;
	}

	#amsd-close:hover {
		background: #2c2c2e;
	}

	#amsd-site-wrap select,
	#amsd-input {
		background: #2c2c2e;
		border-color: #3a3a3c;
		color: #f2f2f7;
	}

	#amsd-site-wrap select:focus,
	#amsd-input:focus {
		background: #3a3a3c;
	}

	.amsd-item {
		border-color: #2c2c2e;
	}

	.amsd-item:hover {
		background: #2c2c2e;
	}

	.amsd-item-title {
		color: #f2f2f7;
	}

	.amsd-item-price {
		color: #e0e0e0;
	}

	.amsd-thumb {
		background: #2c2c2e;
	}

	.amsd-group-title {
		color: #636366;
	}

	.amsd-no-results,
	.amsd-phone {
		color: #8e8e93;
	}
}

/* ─── Reduced motion ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	#amsd-drawer,
	#amsd-fab,
	.amsd-item {
		transition: none;
	}

	.amsd-spinner {
		animation: none;
		border-top-color: var(--amsd-color);
	}
}

/* ─── Mobile ─────────────────────────────────────── */
@media (max-width: 480px) {
	#amsd-drawer {
		width: 100vw;
		border-radius: 20px 20px 0 0;
		top: auto;
		bottom: -100vh;
		right: 0 !important;
		left: 0;
		height: 90vh;
		height: 90dvh;
		transition: bottom .3s cubic-bezier(.4, 0, .2, 1);
	}

	#amsd-drawer.open {
		bottom: 0;
		right: 0 !important;
	}

	.amsd-header {
		padding: 20px 16px 14px;
		border-radius: 20px 20px 0 0;
	}

	.amsd-body {
		padding: 12px 16px 24px;
	}
}

/* ─── Animations ────────────────────────────────── */
@keyframes amsdFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes amsdSpin {
	to { transform: rotate(360deg); }
}
