.epsw-product-search,
.epsw-product-search * {
	box-sizing: border-box;
}

.epsw-product-search {
	--epsw-height: 50px;
	--epsw-primary: var(--e-global-color-primary, #04724d);
	--epsw-accent: var(--e-global-color-accent, #035c3e);
	--epsw-text: var(--e-global-color-text, #1b1b1b);
	--epsw-muted: #8b8b8b;
	--epsw-surface: #fff;
	--epsw-line: #ebebeb;
	--epsw-submit-background: var(--epsw-primary);
	--epsw-submit-hover-background: var(--epsw-accent);
	--epsw-submit-text-color: #fff;
	--epsw-submit-hover-text-color: #fff;
	--epsw-submit-icon-color: #fff;
	--epsw-submit-hover-icon-color: #fff;
	--epsw-submit-padding: 0 24px;
	--epsw-submit-radius: 3px;
	--epsw-submit-gap: 14px;
	--epsw-submit-icon-size: 18px;
	--epsw-input-color: var(--epsw-text);
	--epsw-input-placeholder-color: var(--epsw-muted);
	position: relative;
	width: 100%;
	z-index: 20;
	font-family: inherit;
}

.epsw-search-form,
.epsw-search-bar {
	width: 100%;
}

.epsw-search-bar {
	display: flex;
	align-items: stretch;
	min-width: 0;
	height: var(--epsw-height);
	background: transparent;
	overflow: visible;
}

.epsw-field-shell {
	display: flex;
	align-items: stretch;
	min-width: 0;
	height: 100%;
	flex: 1 1 auto;
	background: var(--epsw-surface);
	border-radius: 3px;
	overflow: visible;
}

/*
 * فقط خود تگ‌های button ریست می‌شوند تا قوانین عمومی قالب و Elementor
 * روی ظاهر ویجت اثر نگذارند. ظاهر قابل‌مشاهده روی لایه‌های داخلی است.
 */
.epsw-product-search button.epsw-category-toggle,
.epsw-product-search button.epsw-category-option,
.epsw-product-search button.epsw-trending-item,
.epsw-product-search button.epsw-clear,
.epsw-product-search button.epsw-panel-close,
.epsw-product-search button.epsw-submit {
	-webkit-appearance: none !important;
	appearance: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	outline: 0;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	text-decoration: none !important;
	text-shadow: none !important;
	filter: none !important;
	font: inherit;
	line-height: inherit;
	text-transform: none;
	-webkit-tap-highlight-color: transparent;
	cursor: pointer;
}

.epsw-product-search button.epsw-category-toggle::before,
.epsw-product-search button.epsw-category-toggle::after,
.epsw-product-search button.epsw-category-option::before,
.epsw-product-search button.epsw-category-option::after,
.epsw-product-search button.epsw-trending-item::before,
.epsw-product-search button.epsw-trending-item::after,
.epsw-product-search button.epsw-clear::before,
.epsw-product-search button.epsw-clear::after,
.epsw-product-search button.epsw-panel-close::before,
.epsw-product-search button.epsw-panel-close::after,
.epsw-product-search button.epsw-submit::before,
.epsw-product-search button.epsw-submit::after {
	display: none !important;
	content: none !important;
}

.epsw-category-wrap {
	position: relative;
	z-index: 5;
	align-self: stretch;
	width: 190px;
	flex: 0 0 190px;
	padding: 5px;
	background: transparent;
}

.epsw-category-toggle {
	display: block;
	width: 100%;
	height: 100%;
}

.epsw-category-surface {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	width: 100%;
	height: 100%;
	padding: 0 20px;
	color: var(--epsw-text);
	background: var(--epsw-surface);
	border-inline-end: 1px solid #eee;
	border-radius: 2px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	text-align: start;
	transition: color .25s ease, background-color .25s ease;
}

.epsw-current-category {
	display: block;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.epsw-category-arrow {
	width: 11px;
	height: 8px;
	flex: 0 0 auto;
	transition: transform .25s ease;
}

.epsw-category-wrap.is-open .epsw-category-arrow {
	transform: rotate(180deg);
}

.epsw-category-dropdown {
	position: absolute;
	inset-inline-start: 0;
	top: calc(100% + 8px);
	z-index: 1002;
	display: flex;
	flex-direction: column;
	width: max(100%, 220px);
	max-height: min(380px, 60vh);
	padding: 8px;
	overflow-x: hidden;
	overflow-y: auto;
	background: var(--epsw-surface);
	border-radius: 3px;
	box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

.epsw-category-wrap.is-open .epsw-category-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.epsw-category-option {
	display: block;
	width: 100%;
}

.epsw-category-option-surface {
	display: block;
	width: 100%;
	padding: 8px 12px;
	border-radius: 3px;
	color: var(--epsw-text);
	background: transparent;
	font-size: 11px;
	line-height: 1.5;
	text-align: start;
	white-space: nowrap;
	transition: color .2s ease, background-color .2s ease;
}

.epsw-category-option:hover .epsw-category-option-surface,
.epsw-category-option:focus-visible .epsw-category-option-surface,
.epsw-category-option.is-active .epsw-category-option-surface {
	color: var(--epsw-primary);
	background: #f3f8f6;
}

.epsw-input-area {
	position: relative;
	display: flex;
	align-items: center;
	min-width: 0;
	flex: 1 1 auto;
	background: var(--epsw-surface);
	font-family: inherit;
	font-size: 13px;
	line-height: normal;
}

.epsw-input {
	width: 100%;
	height: 100%;
	min-width: 0;
	margin: 0;
	padding: 0 20px 0 42px;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--epsw-input-color) !important;
	font: inherit !important;
	-webkit-appearance: none;
	appearance: none;
}

[dir="rtl"] .epsw-input,
.rtl .epsw-input {
	padding: 0 20px 0 42px;
}

.epsw-input::-webkit-search-cancel-button,
.epsw-input::-webkit-search-decoration {
	display: none;
	-webkit-appearance: none;
}

.epsw-input::placeholder {
	color: var(--epsw-input-placeholder-color) !important;
	opacity: 1;
}

.epsw-clear {
	position: absolute;
	inset-inline-end: 12px;
	top: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	transform: translateY(-50%);
}

.epsw-clear[hidden] {
	display: none !important;
}

.epsw-clear-icon {
	display: block;
	width: 17px;
	height: 17px;
	color: #b6b6b6;
	transition: color .2s ease, opacity .2s ease;
}

.epsw-clear:hover .epsw-clear-icon,
.epsw-clear:focus-visible .epsw-clear-icon {
	color: var(--epsw-text);
}

.epsw-submit-wrap {
	display: flex;
	align-items: stretch;
	align-self: stretch;
	flex: 0 0 auto;
	min-width: 0;
	margin: 0;
}

.epsw-submit {
	display: inline-flex !important;
	align-items: stretch;
	justify-content: stretch;
	min-width: 104px;
	height: 100%;
}

.epsw-submit-surface {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	gap: var(--epsw-submit-gap);
	min-width: 104px;
	height: 100%;
	padding: var(--epsw-submit-padding);
	border-radius: var(--epsw-submit-radius);
	background: var(--epsw-submit-background);
	color: var(--epsw-submit-text-color);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	pointer-events: none;
	transition: color .25s ease, background-color .25s ease, transform .25s ease;
}

.epsw-submit:hover .epsw-submit-surface,
.epsw-submit:focus .epsw-submit-surface,
.epsw-submit:focus-visible .epsw-submit-surface,
.epsw-submit:active .epsw-submit-surface {
	background: var(--epsw-submit-hover-background);
	color: var(--epsw-submit-hover-text-color);
}

.epsw-submit:active .epsw-submit-surface {
	transform: translateY(1px);
}

.epsw-submit-text {
	color: var(--epsw-submit-text-color);
}

.epsw-submit:hover .epsw-submit-text,
.epsw-submit:focus .epsw-submit-text,
.epsw-submit:focus-visible .epsw-submit-text,
.epsw-submit:active .epsw-submit-text {
	color: var(--epsw-submit-hover-text-color);
}

.epsw-submit-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--epsw-submit-icon-size);
	height: var(--epsw-submit-icon-size);
	font-size: var(--epsw-submit-icon-size);
	line-height: 1;
	color: var(--epsw-submit-icon-color);
}

.epsw-submit:hover .epsw-submit-icon,
.epsw-submit:focus .epsw-submit-icon,
.epsw-submit:focus-visible .epsw-submit-icon,
.epsw-submit:active .epsw-submit-icon {
	color: var(--epsw-submit-hover-icon-color);
}

.epsw-submit-icon i,
.epsw-submit-icon svg {
	display: block;
	width: 1em;
	height: 1em;
	color: inherit;
}

.epsw-submit-icon svg:not([fill="none"]),
.epsw-submit-icon svg [fill]:not([fill="none"]) {
	fill: currentColor !important;
}

.epsw-submit-icon svg [stroke]:not([stroke="none"]) {
	stroke: currentColor !important;
}

.epsw-panel {
	position: absolute;
	inset-inline-start: 0;
	top: calc(100% + 30px);
	z-index: 1000;
	width: 100%;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity .25s ease, visibility .25s ease, transform .25s ease;
}

.epsw-product-search.is-panel-open .epsw-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.epsw-panel-inner {
	position: relative;
	max-height: 70vh;
	padding: 28px 20px 42px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--epsw-surface);
	border-radius: 3px;
	box-shadow: 6px 5px 11px rgba(0, 0, 0, .1);
}

.epsw-trending {
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 0 0 25px;
	border-bottom: 1px solid var(--epsw-line);
}

.epsw-trending-title {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 10px;
	color: var(--epsw-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.epsw-trending-title svg {
	width: 14px;
	height: 17px;
	flex: 0 0 auto;
}

.epsw-trending-list {
	display: flex;
	align-items: center;
	gap: 30px;
	min-width: 0;
	padding: 2px 0;
	overflow-x: auto;
	scrollbar-width: thin;
}

.epsw-trending-item {
	flex: 0 0 auto;
}

.epsw-trending-item-label {
	display: block;
	color: #555;
	font-size: 12px;
	line-height: 1.5;
	white-space: nowrap;
	transition: color .2s ease;
}

.epsw-trending-item:hover .epsw-trending-item-label,
.epsw-trending-item:focus-visible .epsw-trending-item-label {
	color: var(--epsw-primary);
}

.epsw-results-area {
	position: relative;
	min-height: 64px;
	padding-top: 36px;
}

.epsw-results-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 30px;
	width: 100%;
}

.epsw-result-item {
	display: flex;
	align-items: center;
	min-width: 0;
	gap: 16px;
}

.epsw-result-image {
	position: relative;
	display: block;
	width: 90px;
	height: 90px;
	flex: 0 0 90px;
	overflow: hidden;
	border-radius: 3px;
	background: #f6f6f6;
}

.epsw-result-image img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	border-radius: inherit;
	transition: transform .35s ease;
}

.epsw-result-item:hover .epsw-result-image img {
	transform: scale(1.04);
}

.epsw-result-content {
	min-width: 0;
	flex: 1 1 auto;
}

.epsw-result-category,
.epsw-result-sku {
	margin: 0 0 6px;
	color: #9a9a9a;
	font-size: 10px;
	font-weight: 500;
	line-height: 1.45;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.epsw-result-category a {
	color: inherit;
	text-decoration: none;
}

.epsw-result-title {
	display: -webkit-box;
	margin: 0 0 9px;
	overflow: hidden;
	color: var(--epsw-text);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.55;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.epsw-result-title a {
	color: inherit;
	text-decoration: none;
	transition: color .2s ease;
}

.epsw-result-title a:hover,
.epsw-result-title a:focus-visible {
	color: var(--epsw-primary);
}

.epsw-result-price {
	color: var(--epsw-primary);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.5;
}

.epsw-result-price del {
	margin-inline-end: 5px;
	color: #a5a5a5;
	font-weight: 400;
	opacity: 1;
}

.epsw-result-price ins {
	background: transparent;
	color: inherit;
	text-decoration: none;
}

.epsw-message {
	width: 100%;
	padding: 22px 12px;
	color: #777;
	font-size: 14px;
	line-height: 1.8;
	text-align: center;
}

.epsw-message[hidden],
.epsw-view-all[hidden] {
	display: none !important;
}

.epsw-view-all {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 28px auto 0;
	color: var(--epsw-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.5;
	text-decoration: none;
	transition: color .2s ease;
}

.epsw-view-all:hover,
.epsw-view-all:focus-visible {
	color: var(--epsw-primary);
}

.epsw-view-all svg {
	width: 14px;
	height: 11px;
	transform: scaleX(var(--epsw-arrow-direction, 1));
}

[dir="rtl"] .epsw-view-all,
.rtl .epsw-view-all {
	--epsw-arrow-direction: -1;
}

.epsw-loader {
	position: absolute;
	inset-inline-start: 50%;
	top: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	opacity: 0;
	visibility: hidden;
	transform: translateX(-50%);
	transition: opacity .15s ease, visibility .15s ease;
}

[dir="rtl"] .epsw-loader,
.rtl .epsw-loader {
	transform: translateX(50%);
}

.epsw-product-search.is-loading .epsw-loader {
	opacity: 1;
	visibility: visible;
}

.epsw-product-search.is-loading .epsw-results-grid,
.epsw-product-search.is-loading .epsw-message,
.epsw-product-search.is-loading .epsw-view-all {
	opacity: .25;
}

.epsw-loader span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	animation: epsw-bounce 1s infinite ease-in-out;
}

.epsw-loader span:nth-child(2) { animation-delay: .12s; }
.epsw-loader span:nth-child(3) { animation-delay: .24s; }

@keyframes epsw-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .35; }
	30% { transform: translateY(-5px); opacity: 1; }
}

.epsw-panel-close {
	position: absolute;
	inset-inline-end: 16px;
	bottom: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
}

.epsw-panel-close-icon,
.epsw-panel-close-icon::before,
.epsw-panel-close-icon::after {
	position: absolute;
	display: block;
	content: "";
}

.epsw-panel-close-icon {
	width: 40px;
	height: 40px;
	color: var(--epsw-text);
	border-radius: 50%;
	transition: transform .25s ease;
}

.epsw-panel-close-icon::before,
.epsw-panel-close-icon::after {
	inset-inline-start: 10px;
	top: 19px;
	width: 20px;
	height: 1px;
	background: currentColor;
}

.epsw-panel-close-icon::before { transform: rotate(45deg); }
.epsw-panel-close-icon::after { transform: rotate(-45deg); }
.epsw-panel-close:hover .epsw-panel-close-icon { transform: rotate(90deg); }

.elementor-editor-active .epsw-editor-preview .epsw-panel {
	position: relative;
	top: auto !important;
	margin-top: 20px;
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
}

.elementor-editor-active .epsw-editor-preview .epsw-panel-close {
	display: none;
}

.epsw-product-search :focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (max-width: 1024px) {
	.epsw-results-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 22px;
	}

	.epsw-category-wrap {
		width: 165px;
		flex-basis: 165px;
	}

	.epsw-trending {
		align-items: flex-start;
	}
}

@media (max-width: 767px) {
	.epsw-product-search {
		--epsw-height: 48px;
	}

	.epsw-category-wrap {
		width: 132px;
		flex-basis: 132px;
	}

	.epsw-category-surface {
		padding-inline: 12px;
		font-size: 10px;
	}

	.epsw-hide-category-mobile .epsw-category-wrap {
		display: none;
	}

	.epsw-submit-wrap {
		min-width: 0;
	}

	.epsw-submit,
	.epsw-submit-surface {
		min-width: 54px;
	}

	.epsw-submit-surface {
		padding-inline: 16px;
	}

	.epsw-hide-button-text-mobile .epsw-submit-text {
		display: none;
	}

	.epsw-panel {
		top: calc(100% + 12px);
	}

	.epsw-panel-inner {
		max-height: 72vh;
		padding: 22px 15px 34px;
	}

	.epsw-trending {
		display: block;
		padding-bottom: 18px;
	}

	.epsw-trending-title {
		margin-bottom: 14px;
	}

	.epsw-trending-list {
		gap: 22px;
	}

	.epsw-results-area {
		padding-top: 22px;
	}

	.epsw-results-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.epsw-result-image {
		width: 76px;
		height: 76px;
		flex-basis: 76px;
	}

	.epsw-panel-close {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.epsw-product-search *,
	.epsw-product-search *::before,
	.epsw-product-search *::after {
		scroll-behavior: auto !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
