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

.wpls-search {
	position: relative;
	display: inline-flex;
	align-items: center;
	margin: 0;
	font-family: inherit;
}

/* ==========================================================
   Search Trigger Button (Search Icon)
   ========================================================== */
.wpls-search__trigger {
	position: relative;
	width: 38px !important;
	height: 38px !important;
	min-width: 38px !important;
	margin: 0 !important;
	padding: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	border: 1px solid #d5d9de !important;
	border-radius: 50% !important;
	background: #ffffff !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
	color: #334155 !important;
	cursor: pointer !important;
	outline: none !important;
	transition: all 0.15s ease !important;
}

.wpls-search__trigger:hover,
.wpls-search__trigger:focus-visible {
	border-color: #2563eb !important;
	color: #2563eb !important;
	background: #f8fafc !important;
	transform: translateY(-1px);
	box-shadow: 0 3px 6px rgba(37, 99, 235, 0.15) !important;
}

.wpls-search__trigger .wpls-search__icon {
	width: 18px !important;
	height: 18px !important;
	display: block !important;
	fill: none !important;
	stroke: currentColor !important;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ==========================================================
   Search Popup / Overlay
   ========================================================== */
.wpls-search__overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 20px 16px;
	animation: wplsFadeIn 0.15s ease-out;
}

.wpls-search__overlay[hidden] {
	display: none !important;
}

.wpls-search__backdrop {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(15, 23, 42, 0.48);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

.wpls-search__box {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: 600px;
	margin-top: 40px;
	background: #ffffff;
	border-radius: 16px;
	border: 1px solid #e2e8f0;
	box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
	overflow: hidden;
	animation: wplsSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wplsFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes wplsSlideDown {
	from {
		opacity: 0;
		transform: translateY(-16px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ==========================================================
   Search Input Form in Popup
   ========================================================== */
.wpls-search__form {
	height: 52px;
	display: flex;
	align-items: center;
	margin: 0 !important;
	padding: 0 8px 0 16px !important;
	border-bottom: 1px solid #e2e8f0 !important;
	background: #ffffff !important;
}

.wpls-search__form-icon {
	width: 20px !important;
	height: 20px !important;
	flex: 0 0 20px;
	margin-right: 12px;
	fill: none;
	stroke: #64748b;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wpls-search__input {
	width: 100% !important;
	min-width: 0;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #0f172a !important;
	font: inherit !important;
	font-size: 16px !important;
	line-height: 1 !important;
	outline: none !important;
}

.wpls-search__input::placeholder {
	color: #94a3b8;
	opacity: 1;
}

.wpls-search__close {
	width: 36px !important;
	min-width: 36px !important;
	height: 36px !important;
	margin: 0 !important;
	padding: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	border: 0 !important;
	border-radius: 8px !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #64748b !important;
	font-size: 22px !important;
	line-height: 1 !important;
	cursor: pointer !important;
	transition: background-color 0.12s ease, color 0.12s ease !important;
}

.wpls-search__close:hover {
	background: #f1f5f9 !important;
	color: #0f172a !important;
}

/* ==========================================================
   Search Results
   ========================================================== */
.wpls-search__results {
	max-height: min(65vh, 460px);
	overflow-y: auto;
	background: #ffffff;
}

.wpls-search__results[hidden] {
	display: none !important;
}

/* Fields that belong to the theme. The plugin only paints the rows inside them. */
.wpls-external-host {
	position: relative;
}

[data-wpls-external] > .wpls-search__results {
	position: absolute;
	z-index: 1000;
	left: 0;
	right: 0;
	top: calc(100% + 4px);
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
	max-height: 420px;
	overflow-y: auto;
}

.wpls-search__result {
	min-height: 58px;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	gap: 14px;
	border-bottom: 1px solid #f1f5f9;
	color: inherit;
	text-decoration: none;
	transition: background-color 0.12s ease;
}

.wpls-search__result:last-of-type {
	border-bottom: 0;
}

.wpls-search__result:hover,
.wpls-search__result:focus-visible,
.wpls-search__result.is-active {
	background: #f8fafc;
	outline: none;
}

.wpls-search__image {
	width: 44px !important;
	height: 44px !important;
	flex: 0 0 44px;
	display: block;
	object-fit: contain;
	border-radius: 6px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
}

.wpls-search__result-info {
	min-width: 0;
	display: grid;
	gap: 3px;
	flex: 1;
}

.wpls-search__result-title {
	overflow: hidden;
	color: #0f172a;
	font-size: 14px !important;
	line-height: 1.35 !important;
	font-weight: 600 !important;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpls-search__result-price,
.wpls-search__result-price * {
	color: #059669;
	font-size: 13px !important;
	line-height: 1.2 !important;
	font-weight: 600 !important;
}

.wpls-search__result-price del {
	margin-right: 6px;
	color: #94a3b8;
	font-size: 11px !important;
	font-weight: 400 !important;
}

.wpls-search__result-price ins {
	text-decoration: none;
}

.wpls-search__all {
	display: block;
	padding: 12px 16px;
	background: #f8fafc;
	border-top: 1px solid #e2e8f0;
	color: #2563eb;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.wpls-search__all:hover {
	background: #eff6ff;
	color: #1d4ed8;
}

.wpls-search__status,
.wpls-notice {
	padding: 18px 20px;
	color: #64748b;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
}

.wpls-search__status.is-loading::after {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 8px;
	border: 2px solid #cbd5e1;
	border-top-color: #2563eb;
	border-radius: 50%;
	vertical-align: middle;
	animation: wpls-spin 0.6s linear infinite;
}

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

/* ==========================================================
   Header layout fix for Impreza theme (Mobile & Tablet)
   ========================================================== */
@media screen and (max-width: 899px) {
	/* Keep bottom subheader as a single clean row */
	.l-subheader.at_bottom {
		display: block !important;
		height: 48px !important;
		min-height: 48px !important;
		line-height: 48px !important;
		padding: 0 12px !important;
		background: #ffffff !important;
		border-top: 1px solid #f1f5f9 !important;
	}

	.l-subheader.at_bottom .l-subheader-h {
		height: 48px !important;
		line-height: 48px !important;
	}

	.l-subheader.at_bottom .l-subheader-cell.at_center {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		justify-content: space-between !important;
		gap: 8px !important;
		width: 100% !important;
		height: 48px !important;
	}

	/* Fix "Kategorijas" button: strictly inline icon + text on ONE line */
	.l-subheader.at_bottom .ush_menu_3 {
		flex: 0 0 auto !important;
		margin: 0 !important;
	}

	.l-subheader.at_bottom .ush_menu_3 .w-nav-control {
		display: inline-flex !important;
		flex-direction: row-reverse !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 6px !important;
		height: 36px !important;
		line-height: 36px !important;
		margin: 0 !important;
		padding: 0 12px 0 8px !important;
		border: 1px solid #d5d9de !important;
		border-radius: 18px !important;
		background: #ffffff !important;
		color: #1e293b !important;
		font-size: 13px !important;
		font-weight: 600 !important;
		text-decoration: none !important;
		white-space: nowrap !important;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
	}

	.l-subheader.at_bottom .ush_menu_3 .w-nav-control .w-nav-icon {
		position: static !important;
		margin: 0 !important;
		font-size: 16px !important;
		width: 16px !important;
		height: 16px !important;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.l-subheader.at_bottom .ush_menu_3 .w-nav-control span {
		display: inline-block !important;
		line-height: 1 !important;
		vertical-align: middle !important;
		white-space: nowrap !important;
	}

	/* Search Icon */
	.l-subheader.at_bottom .ush_html_2 {
		flex: 0 0 auto !important;
		margin: 0 !important;
		display: flex !important;
		align-items: center !important;
	}

	/* Language Switcher */
	.l-subheader.at_bottom .ush_html_3 {
		flex: 0 0 auto !important;
		margin: 0 !important;
		display: flex !important;
		align-items: center !important;
	}

	/* Fullscreen-like popup on small screens */
	.wpls-search__box {
		margin-top: 10px;
		border-radius: 14px;
	}
}

.wpls-search__results .wpls-search__brands,
.tm-wc-home-search-results .wpls-search__brands {
	padding: 10px 14px 6px;
	border-bottom: 1px solid #e8ece9;
	background: #fafafa;
}

.wpls-search__results .tm-wc-home-search-category-list,
.tm-wc-home-search-results .tm-wc-home-search-category-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
}

.wpls-search__brand {
	display: inline-block;
	padding: 4px 10px;
	border: 1px solid #e0e0e0;
	border-radius: 999px;
	background: #fff;
	color: #141414;
	font-size: 13px;
	text-decoration: none;
}

.wpls-search__brand-count,
.wpls-search__brand .tm-wc-home-search-category-count {
	color: #6b6b6b;
}
