/* AJAX Search Widget v1.0.0 */

.asw-wrap {
	--asw-box-width: 320px;
	--asw-toggle-size: 44px;
	position: relative;
	display: inline-flex;
	align-items: center;
}

/* ---------- Icons (CSS mask — Elementor strips inline SVG) ---------- */
.asw-icon {
	display: inline-block;
	width: 18px;
	height: 18px;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	flex: 0 0 auto;
}

.asw-icon-search {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
}

.asw-icon-close {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='5' y1='5' x2='19' y2='19'/%3E%3Cline x1='19' y1='5' x2='5' y2='19'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='5' y1='5' x2='19' y2='19'/%3E%3Cline x1='19' y1='5' x2='5' y2='19'/%3E%3C/svg%3E");
}

/* ---------- Toggle button ---------- */
.asw-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	transition: background-color 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.asw-toggle .asw-icon {
	transition: background-color 0.25s ease;
}

/* ---------- Panel & box (shared) ---------- */
.asw-panel {
	position: relative;
}

.asw-box {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #fff;
	padding: 0 12px;
	position: relative;
	overflow: hidden;
}

.asw-box-icon {
	color: #9ca3af;
	width: 16px;
	height: 16px;
}

.asw-input {
	flex: 1 1 auto;
	min-width: 0;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	height: 46px;
	font-size: 15px;
	padding: 0 !important;
	margin: 0 !important;
	color: inherit;
}

.asw-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 4px;
	color: #9ca3af;
	transition: color 0.2s ease;
	flex: 0 0 auto;
}

.asw-close:hover {
	color: #374151;
}

.asw-close .asw-icon {
	width: 14px;
	height: 14px;
}

/* ---------- Spinner ---------- */
.asw-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(0, 0, 0, 0.12);
	border-top-color: #2563eb;
	border-radius: 50%;
	flex: 0 0 auto;
	opacity: 0;
	transition: opacity 0.15s ease;
	animation: asw-spin 0.7s linear infinite;
}

.asw-wrap.asw-loading .asw-spinner,
.asw-overlay.asw-loading .asw-spinner {
	opacity: 1;
}

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

/* ---------- Mode: Expand Inline ---------- */
.asw-mode-inline .asw-panel {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	opacity: 0;
	pointer-events: none;
	transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
	z-index: 9990;
}

.asw-mode-inline.asw-dir-left .asw-panel {
	right: 0;
}

.asw-mode-inline.asw-dir-right .asw-panel {
	left: 0;
}

.asw-mode-inline.asw-open .asw-panel {
	width: var(--asw-box-width);
	opacity: 1;
	pointer-events: auto;
}

.asw-mode-inline.asw-open .asw-toggle {
	opacity: 0;
	pointer-events: none;
	transform: scale(0.6);
}

/* ---------- Mode: Always Visible (Static Bar) ---------- */
/* No toggle button exists in this mode, so the box is always in normal
   document flow at full wrapper width — never absolutely positioned,
   never gated behind an .asw-open class (there is nothing to reopen it
   with, so it must never be hidden). Only the results dropdown animates. */
.asw-wrap.asw-mode-static {
	display: block;
	width: 100%;
}

.asw-mode-static .asw-panel {
	position: relative;
	width: 100%;
}

.asw-mode-static .asw-box {
	width: 100%;
}

/* ---------- Mode: Dropdown ---------- */
.asw-mode-dropdown .asw-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: var(--asw-box-width);
	opacity: 0;
	transform: translateY(-8px);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
	z-index: 9990;
}

.asw-mode-dropdown.asw-open .asw-panel {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* ---------- Mode: Fullscreen Overlay ---------- */
.asw-overlay {
	position: fixed;
	inset: 0;
	background: rgba(17, 24, 39, 0.92);
	z-index: 999990;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 12vh 20px 40px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.asw-overlay.asw-open {
	opacity: 1;
	visibility: visible;
}

.asw-overlay .asw-panel {
	width: 100%;
	max-width: 640px;
	transform: translateY(-16px);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.asw-overlay.asw-open .asw-panel {
	transform: translateY(0);
}

.asw-overlay-close {
	position: absolute;
	top: 28px;
	right: 32px;
	color: rgba(255, 255, 255, 0.75);
}

.asw-overlay-close:hover {
	color: #ffffff;
}

.asw-overlay-close .asw-icon {
	width: 22px;
	height: 22px;
}

/* ---------- Results ---------- */
.asw-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #fff;
	overflow: hidden;
	opacity: 0;
	transform: translateY(-6px);
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 9991;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.asw-overlay .asw-results {
	position: relative;
	top: auto;
	margin-top: 10px;
}

.asw-has-results .asw-results {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.asw-results-list {
	max-height: 380px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.asw-results-list::-webkit-scrollbar {
	width: 6px;
}

.asw-results-list::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.18);
	border-radius: 3px;
}

/* ---------- Result item ---------- */
.asw-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	text-decoration: none !important;
	transition: background-color 0.15s ease;
	cursor: pointer;
}

.asw-item + .asw-item {
	border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.asw-item-thumb {
	width: 44px;
	height: 44px;
	object-fit: cover;
	flex: 0 0 auto;
	background: #f3f4f6;
}

.asw-item-body {
	flex: 1 1 auto;
	min-width: 0;
}

.asw-item-title {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	line-height: 1.35;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.asw-item-title mark {
	background: transparent;
	color: #2563eb;
	font-weight: 700;
	padding: 0;
}

.asw-item-excerpt {
	display: block;
	font-size: 12px;
	color: #6b7280;
	line-height: 1.4;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.asw-item-price {
	font-size: 13px;
	font-weight: 700;
	color: #059669;
	flex: 0 0 auto;
	white-space: nowrap;
}

.asw-item-badge {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #6b7280;
	background: #f3f4f6;
	border-radius: 4px;
	padding: 2px 6px;
	flex: 0 0 auto;
}

/* ---------- No results / view all ---------- */
.asw-empty {
	padding: 18px 14px;
	font-size: 13px;
	color: #6b7280;
	text-align: center;
}

.asw-view-all {
	display: block;
	padding: 11px 14px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	color: #2563eb;
	text-decoration: none !important;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	transition: background-color 0.15s ease;
}

.asw-view-all:hover {
	background: #f8fafc;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.asw-mode-inline .asw-panel,
	.asw-mode-dropdown .asw-panel {
		position: fixed;
		top: 12px;
		left: 12px;
		right: 12px;
		width: auto !important;
		transform: none;
		z-index: 999991;
	}

	.asw-mode-inline .asw-panel {
		transition: opacity 0.25s ease;
	}

	.asw-mode-inline.asw-open .asw-panel {
		width: auto;
	}
}
