/*
 * Smart Woo Search — frontend styles
 * Prefixed with .sws- to avoid collisions with themes/plugins.
 */

.sws-search-widget {
	--sws-loader-color: #7f54b3;
	--sws-loader-size: 22px;
	position: relative;
	width: 100%;
	max-width: 480px;
	box-sizing: border-box;
}

/* Close (clear) button can be switched off from Elementor. */
.sws-search-widget.sws-no-clear .sws-search__clear-btn {
	display: none !important;
}

.sws-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ *
 * Search bar
 * ------------------------------------------------------------------ */
.sws-search-bar-wrap {
	position: relative;
}

.sws-search__form {
	position: relative;
	display: flex;
	align-items: center;
	background-color: #ffffff;
	border: 1px solid #e2e2e2;
	border-radius: 999px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
	padding: 4px;
	box-sizing: border-box;
}

.sws-search__form:focus-within {
	border-color: #7f54b3;
	box-shadow: 0 0 0 3px rgba(127, 84, 179, 0.15);
}

.sws-search__input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	border: 0;
	outline: none;
	background: transparent;
	font-size: 15px;
	line-height: 1.4;
	padding: 12px 8px 12px 18px;
	color: #1e1e1e;
	appearance: none;
	-webkit-appearance: none;
}

.sws-search__input::-webkit-search-decoration,
.sws-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.sws-search__input::placeholder {
	color: #9aa0a6;
}

.sws-search__icon-btn,
.sws-search__clear-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0 4px 0 0;
	padding: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
	color: #6b6b6b;
	border-radius: 50%;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.sws-search__icon-btn:hover,
.sws-search__icon-btn:focus-visible,
.sws-search__clear-btn:hover,
.sws-search__clear-btn:focus-visible {
	background-color: rgba(0, 0, 0, 0.05);
	color: #1e1e1e;
	outline: none;
}

.sws-search__clear-btn {
	font-size: 20px;
	line-height: 1;
}

/* ------------------------------------------------------------------ *
 * Results dropdown
 * ------------------------------------------------------------------ */
.sws-search__results {
	position: absolute;
	inset-inline-start: 0;
	top: calc(100% + 8px);
	width: 100%;
	max-height: 400px;
	overflow-y: auto;
	overflow-x: hidden;
	background-color: #ffffff;
	border: 1px solid #ececec;
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
	z-index: 9999;
	padding: 6px;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
	box-sizing: border-box;
}

.sws-search__results[hidden] {
	display: none;
}

.sws-search__results.sws-is-visible {
	opacity: 1;
	transform: translateY(0);
}

.sws-search__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border-radius: 10px;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.12s ease;
}

.sws-search__item:hover,
.sws-search__item:focus-visible,
.sws-search__item.sws-is-active {
	background-color: #f6f4fa;
	outline: none;
}

.sws-search__item-image {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 8px;
	overflow: hidden;
	background-color: #f3f3f3;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sws-search__item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.sws-search__item-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.sws-search__item-title {
	font-size: 14px;
	font-weight: 500;
	color: #1e1e1e;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.sws-search__item-price {
	font-size: 13px;
	font-weight: 600;
	color: #1e1e1e;
	white-space: nowrap;
}

.sws-search__item-price del {
	opacity: 0.6;
	font-weight: 400;
	margin-inline-end: 4px;
}

.sws-search__item-price ins {
	text-decoration: none;
	color: #d63638;
}

.sws-search__item-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 11px;
	color: #8a8a8a;
}

.sws-search__item-meta span {
	white-space: nowrap;
}

.sws-search__item-meta .sws-stock--outofstock {
	color: #d63638;
}

.sws-search__item-meta .sws-stock--instock {
	color: #2e7d32;
}

.sws-search__view-all {
	display: block;
	text-align: center;
	padding: 10px;
	margin-top: 4px;
	font-size: 13px;
	font-weight: 600;
	color: #7f54b3;
	text-decoration: none;
	border-radius: 8px;
	border-top: 1px solid #f0f0f0;
}

.sws-search__view-all:hover,
.sws-search__view-all:focus-visible {
	background-color: #f6f4fa;
	outline: none;
}

.sws-search__empty,
.sws-search__hint,
.sws-search__error {
	padding: 24px 12px;
	text-align: center;
	font-size: 13px;
	color: #8a8a8a;
}

.sws-search__error {
	color: #d63638;
}

/* ------------------------------------------------------------------ *
 * Loader
 * ------------------------------------------------------------------ */
.sws-search__loader {
	position: absolute;
	inset-inline-end: 52px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--sws-loader-size);
	height: var(--sws-loader-size);
	pointer-events: none;
}

.sws-search__loader[hidden] {
	display: none;
}

/* Ring */
.sws-ring-circle {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-top-color: var(--sws-loader-color);
	animation: sws-spin 0.7s linear infinite;
}

/* Spinner (thicker) */
.sws-spinner-circle {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 3px solid transparent;
	border-top-color: var(--sws-loader-color);
	border-inline-end-color: var(--sws-loader-color);
	animation: sws-spin 0.6s linear infinite;
}

/* Pulse */
.sws-pulse-circle {
	width: 60%;
	height: 60%;
	border-radius: 50%;
	background-color: var(--sws-loader-color);
	animation: sws-pulse 1s ease-in-out infinite;
}

/* Dots */
.sws-loader--dots {
	gap: 3px;
}

.sws-dot {
	width: 22%;
	height: 22%;
	border-radius: 50%;
	background-color: var(--sws-loader-color);
	animation: sws-dot-bounce 0.8s ease-in-out infinite;
}

.sws-dot:nth-child(2) {
	animation-delay: 0.12s;
}

.sws-dot:nth-child(3) {
	animation-delay: 0.24s;
}

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

@keyframes sws-pulse {
	0%, 100% {
		transform: scale(0.6);
		opacity: 1;
	}
	50% {
		transform: scale(1);
		opacity: 0.4;
	}
}

@keyframes sws-dot-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.5;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sws-ring-circle,
	.sws-spinner-circle,
	.sws-pulse-circle,
	.sws-dot {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

/* ------------------------------------------------------------------ *
 * Mobile trigger + popup
 * ------------------------------------------------------------------ */
.sws-mobile-trigger {
	display: none;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid #e2e2e2;
	background-color: #ffffff;
	color: #1e1e1e;
	cursor: pointer;
}

.sws-mobile-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.sws-mobile-popup[hidden] {
	display: none;
}

.sws-mobile-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(20, 18, 24, 0.6);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.sws-mobile-popup.sws-is-open .sws-mobile-overlay {
	opacity: 1;
}

.sws-mobile-panel {
	position: relative;
	width: calc(100% - 32px);
	max-width: 560px;
	margin: 64px auto 0;
	background-color: #ffffff;
	border-radius: 16px;
	padding: 20px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	opacity: 0;
	transform: translateY(-16px) scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease;
	max-height: calc(100vh - 96px);
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

.sws-mobile-popup.sws-is-open .sws-mobile-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.sws-mobile-close {
	position: absolute;
	top: 12px;
	inset-inline-end: 12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 0;
	background-color: #f3f3f3;
	color: #1e1e1e;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.sws-search__form--mobile {
	margin-top: 12px;
}

.sws-mobile-panel .sws-search__results {
	position: relative;
	top: 0;
	margin-top: 12px;
	box-shadow: none;
	border: 1px solid #f0f0f0;
	opacity: 1;
	transform: none;
	max-height: none;
	flex: 1 1 auto;
	overflow-y: auto;
}

.sws-mobile-panel .sws-search__loader {
	position: static;
	transform: none;
	margin: 16px auto 0;
}

@media (prefers-reduced-motion: reduce) {
	.sws-mobile-overlay,
	.sws-mobile-panel {
		transition-duration: 0.01ms !important;
	}
}

/* ------------------------------------------------------------------ *
 * Responsive mode switching
 * ------------------------------------------------------------------ */
@media (max-width: 767px) {
	.sws-mobile-mode--icon .sws-search-bar-wrap {
		display: none;
	}

	.sws-mobile-mode--icon .sws-mobile-trigger {
		display: inline-flex;
	}

	.sws-mobile-mode--full .sws-mobile-trigger {
		display: none;
	}
}

@media (min-width: 768px) {
	.sws-mobile-trigger {
		display: none;
	}

	.sws-mobile-popup {
		display: none !important;
	}
}

/* ------------------------------------------------------------------ *
 * v3.3.0 — Search field inner border fix.
 * Themes (and browsers) often paint their own border/outline/box-shadow on
 * search inputs, which showed up as a second "border inside the border".
 * The input itself is now fully transparent, and the visible focus ring is
 * driven by editable custom properties from the Elementor panel.
 * ------------------------------------------------------------------ */
.sws-search-widget .sws-search__form {
	--sws-focus-ring-width: 3px;
	--sws-focus-ring-color: rgba(127, 84, 179, 0.15);
	--sws-inner-border-width: 0px;
	--sws-inner-border-color: transparent;
	--sws-inner-border-radius: 999px;
}

.sws-search-widget .sws-search__input,
.sws-search-widget .sws-search__input:hover,
.sws-search-widget .sws-search__input:focus,
.sws-search-widget .sws-search__input:focus-visible,
.sws-search-widget .sws-search__input:active {
	border: var(--sws-inner-border-width) solid var(--sws-inner-border-color) !important;
	border-radius: var(--sws-inner-border-radius);
	outline: 0 !important;
	outline-offset: 0 !important;
	box-shadow: none !important;
	background-image: none;
	min-height: 0;
}

/* Focus ring is a shadow on the wrapper, so it never looks like a 2nd border. */
.sws-search-widget .sws-search__form:focus-within {
	box-shadow: 0 0 0 var(--sws-focus-ring-width) var(--sws-focus-ring-color);
}
