/* Webbler Search */

.wsearch-wrap {
	display: flex;
	justify-content: flex-start;
}

.wsearch {
	--wsearch-width: 320px;
	--wsearch-height: 48px;
	--wsearch-pad: 20px;
	--wsearch-radius: 100px;
	--wsearch-btn-inset: 4px;
	--wsearch-results-width: 420px;
	--wsearch-offset: 10px;
	--wsearch-sheet-bg: #ffffff;
	--wsearch-ease: cubic-bezier(0.25, 0.8, 0.25, 1);

	position: relative;
	width: var(--wsearch-width);
	max-width: 100%;
	font-size: 16px;
	line-height: 1.3;
}

.wsearch.is-open {
	z-index: 1000;
}

/* ---------- Bar ---------- */

.wsearch__form {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
	height: var(--wsearch-height);
	margin: 0;
	padding: 0 var(--wsearch-pad);
	border: 1px solid #cccccc;
	border-radius: var(--wsearch-radius);
	background-color: #ffffff;
	box-sizing: border-box;
	transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}

.wsearch__form:focus-within {
	border-color: #163e35;
}

.wsearch--icon-button .wsearch__form {
	padding-right: var(--wsearch-btn-inset);
}

.wsearch__label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.wsearch .wsearch__input,
.wsearch .wsearch__input:focus {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: none;
	background: transparent;
	box-shadow: none;
	color: #101921;
	font: inherit;
	line-height: normal;
	-webkit-appearance: none;
	appearance: none;
}

.wsearch__input::placeholder {
	color: #6b7378;
	opacity: 1;
}

.wsearch__input::-webkit-search-decoration,
.wsearch__input::-webkit-search-cancel-button,
.wsearch__input::-webkit-search-results-button,
.wsearch__input::-webkit-search-results-decoration {
	display: none;
	-webkit-appearance: none;
}

.wsearch__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #101921;
	font-size: 20px;
	line-height: 1;
	transition: color 200ms ease;
}

.wsearch svg {
	display: block;
	width: 1em;
	height: 1em;
}

.wsearch__icon i,
.wsearch__open i,
.wsearch__submit i {
	font-size: inherit;
	line-height: 1;
}

/* Small round buttons (clear / close / open) – reset theme button styles */
.wsearch .wsearch__clear,
.wsearch .wsearch__close,
.wsearch .wsearch__open {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 4px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: #101921;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: color 200ms ease, background-color 200ms ease;
}

.wsearch .wsearch__clear[hidden] {
	display: none;
}

.wsearch .wsearch__clear:hover,
.wsearch .wsearch__close:hover {
	background: rgba(16, 25, 33, 0.06);
}

.wsearch .wsearch__clear:focus-visible,
.wsearch .wsearch__close:focus-visible,
.wsearch .wsearch__open:focus-visible,
.wsearch .wsearch__submit:focus-visible {
	outline: 2px solid #163e35;
	outline-offset: 2px;
}

/* Submit button inside the bar */
.wsearch .wsearch__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	height: calc(var(--wsearch-height) - 2px - (var(--wsearch-btn-inset) * 2));
	min-width: calc(var(--wsearch-height) - 2px - (var(--wsearch-btn-inset) * 2));
	margin: 0;
	padding: 0 14px;
	border: 0;
	border-radius: calc(var(--wsearch-radius) - var(--wsearch-btn-inset));
	background-color: #ffc600;
	color: #101921;
	font: inherit;
	font-size: 18px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease;
}

.wsearch__submit-text {
	font-size: 15px;
	white-space: nowrap;
}

/* ---------- Results popup ---------- */

.wsearch__results {
	position: absolute;
	top: calc(100% + var(--wsearch-offset));
	right: 0;
	z-index: 3;
	width: var(--wsearch-results-width);
	max-width: calc(100vw - 32px);
	overflow: hidden;
	border-radius: 16px;
	background-color: #ffffff;
	box-shadow: none;
	box-sizing: border-box;
	text-align: left;
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 180ms var(--wsearch-ease), transform 180ms var(--wsearch-ease);
}

.wsearch__results[hidden] {
	display: none;
}

.wsearch.is-open .wsearch__results {
	opacity: 1;
	transform: none;
}

.wsearch--results-left .wsearch__results {
	right: auto;
	left: 0;
}

.wsearch--results-center .wsearch__results {
	right: auto;
	left: 50%;
	transform: translate(-50%, -6px);
}

.wsearch--results-center.is-open .wsearch__results {
	transform: translateX(-50%);
}

.wsearch .wsearch__list {
	max-height: 70vh;
	margin: 0;
	padding: 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
}

.wsearch .wsearch__list:empty {
	display: none;
}

.wsearch .wsearch__list > li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wsearch .wsearch__list > li::before,
.wsearch .wsearch__list > li::marker {
	content: none;
}

.wsearch .wsearch__item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 12px;
	border-radius: 10px;
	color: inherit;
	text-decoration: none;
	transition: background-color 150ms ease;
}

.wsearch .wsearch__item:hover,
.wsearch .wsearch__item.is-active {
	background-color: #f0faf9;
	text-decoration: none;
}

.wsearch__thumb {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 8px;
	background: #eef1f1;
}

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

.wsearch__thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #9aa3a6;
	font-size: 18px;
}

.wsearch__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wsearch__title {
	color: #101921;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.wsearch__title mark {
	padding: 0 1px;
	border-radius: 3px;
	background-color: rgba(255, 198, 0, 0.45);
	color: inherit;
}

.wsearch__meta {
	color: #6b7378;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.wsearch__excerpt {
	color: #6b7378;
	font-size: 14px;
	line-height: 1.4;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.wsearch__status {
	padding: 16px 20px;
	color: #6b7378;
	font-size: 15px;
}

.wsearch__status:empty {
	display: none;
}

.wsearch__status strong {
	color: #101921;
}

.wsearch .wsearch__all {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 20px;
	border-top: 1px solid #eef1f1;
	color: #163e35;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}

.wsearch .wsearch__all:hover,
.wsearch .wsearch__all.is-active {
	background-color: #f0faf9;
	text-decoration: none;
}

.wsearch__all-arrow {
	transition: transform 200ms var(--wsearch-ease);
}

.wsearch__all:hover .wsearch__all-arrow,
.wsearch__all.is-active .wsearch__all-arrow {
	transform: translateX(4px);
}

/* ---------- Big panel layout ---------- */

.wsearch--panel .wsearch__results {
	width: min(var(--wsearch-panel-width, 1040px), calc(100vw - 32px));
	max-width: calc(100vw - 32px);
}

.wsearch--panel .wsearch__list {
	display: none;
}

.wsearch--panel .wsearch__panel:empty {
	display: none;
}

.wsearch--panel .wsp__body {
	max-height: var(--wsearch-panel-max, 70vh);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.wsearch.is-expanded.wsearch--panel .wsearch__results {
	max-width: none;
}

.wsearch.is-expanded.wsearch--panel .wsp__body {
	max-height: calc(100vh - var(--wsearch-height) - 150px);
	max-height: calc(100dvh - var(--wsearch-height) - 150px);
}

/* Loading bar on top of the popup */
.wsearch.is-loading .wsearch__results::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	width: 40%;
	height: 2px;
	background: #ffc600;
	animation: wsearch-loading 900ms ease-in-out infinite;
}

@keyframes wsearch-loading {
	from { transform: translateX(-100%); }
	to { transform: translateX(250%); }
}

/* ---------- Overlay (dims the page) ---------- */

.wsearch__overlay {
	position: fixed;
	inset: 0;
	z-index: 1;
	background-color: rgba(16, 25, 33, 0.45);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 200ms ease, visibility 0s linear 200ms;
}

.wsearch.is-open .wsearch__overlay,
.wsearch__overlay.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 200ms ease, visibility 0s;
}

/* ---------- Collapsed (icon) mode on small screens ----------
 * The widget prints a media query that shows .wsearch__open, hides the bar
 * until .is-expanded, and shows the sheet. Below are the expanded styles.
 */

.wsearch .wsearch__open,
.wsearch .wsearch__close,
.wsearch__sheet {
	display: none;
}

/* JS adds .is-collapsed below the breakpoint: only the icon takes space */
.wsearch.is-collapsed {
	width: auto;
}

.wsearch .wsearch__open {
	padding: 6px;
	color: #000000;
	font-size: 32px;
}

.wsearch.is-expanded .wsearch__sheet {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 2;
	height: calc(var(--wsearch-height) + 32px);
	background: var(--wsearch-sheet-bg);
	box-shadow: 0 4px 20px rgba(16, 25, 33, 0.08);
}

.wsearch.is-expanded .wsearch__form {
	position: fixed;
	top: 16px;
	left: 16px;
	right: 16px;
	z-index: 3;
	display: flex;
}

.wsearch.is-expanded .wsearch__close {
	display: inline-flex;
	font-size: 20px;
}

.wsearch.is-expanded .wsearch__results,
.wsearch.is-expanded.wsearch--results-center .wsearch__results {
	left: 0;
	right: 0;
	width: auto;
	max-width: none;
	transform: none;
}

.wsearch.is-expanded .wsearch__list {
	max-height: calc(100vh - var(--wsearch-height) - 140px);
	max-height: calc(100dvh - var(--wsearch-height) - 140px);
}

/* Elementor editor: keep the popup visible above other elements */
.elementor-editor-active .wsearch.is-open {
	z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
	.wsearch__results,
	.wsearch__overlay,
	.wsearch__form,
	.wsearch__item,
	.wsearch__all-arrow {
		transition: none !important;
	}

	.wsearch.is-loading .wsearch__results::before {
		animation: none;
	}
}
