/*
 * WP EasyCart Product Search widget for Elementor ( 6.0.2 ). Small on purpose: it often sits in a site-wide header.
 * Colours read the store-wide variables and fall back to the kit's global colours.
 */

.wpec-search .wpec-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

.wpec-search {
	position: relative;
}

.wpec-search__form {
	position: relative;
	margin: 0;
}

.wpec-search__label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
}

.wpec-search__field {
	display: flex;
	align-items: stretch;
	min-height: var( --wpec-search-height, 44px );
	overflow: hidden;
	border: 1px solid var( --wpec-border-color, #c8c8c8 );
	border-radius: var( --wpec-radius, 0 );
	background: #fff;
}

.wpec-search__field:focus-within {
	border-color: var( --wpec-button-bg, var( --e-global-color-accent, #1d1d1d ) );
	box-shadow: 0 0 0 1px var( --wpec-button-bg, var( --e-global-color-accent, #1d1d1d ) );
}

.wpec-search__field > .wpec-search__icon {
	flex: 0 0 auto;
	align-self: center;
	margin-inline-start: var( --wpec-search-icon-gap, 12px );
	color: var( --wpec-muted-color, #6b6b6b );
}

/* An icon chosen in the panel ( Elementor's font or SVG icons ): sized by font-size, coloured by currentColor. */
.wpec-search__icon--custom {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	font-size: 20px;
	line-height: 1;
}

.wpec-search__icon--custom svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.wpec-search__icon--custom i {
	font-size: inherit;
	line-height: 1;
}

.wpec-search .wpec-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: auto;
	margin: 0;
	padding: 8px 12px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.wpec-search .wpec-search__input::-webkit-search-cancel-button {
	cursor: pointer;
}

/* Style › Search box › Clear button ( × ): hidden, or drawn in the chosen colour ( WebKit and Blink only: Firefox has none ). */
.wpec-search-clear-hide .wpec-search__input::-webkit-search-cancel-button {
	display: none;
	-webkit-appearance: none;
	appearance: none;
}

.wpec-search-clear-custom .wpec-search__input::-webkit-search-cancel-button {
	width: var( --wpec-search-clear-size, 14px );
	height: var( --wpec-search-clear-size, 14px );
	margin-inline-start: 6px;
	background-color: var( --wpec-search-clear-color, currentColor );
	-webkit-mask: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E" ) center / contain no-repeat;
	mask: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E" ) center / contain no-repeat;
	opacity: 0.7;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.wpec-search-clear-custom .wpec-search__input::-webkit-search-cancel-button:hover {
	opacity: 1;
}

.wpec-search__button {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 0;
	background-color: var( --wpec-button-bg, var( --e-global-color-accent, #1d1d1d ) );
	color: var( --wpec-button-color, #fff );
	font-family: var( --wpec-button-font-family, var( --e-global-typography-accent-font-family, inherit ) );
	font-size: var( --wpec-button-font-size, inherit );
	font-weight: var( --wpec-button-font-weight, 600 );
	letter-spacing: var( --wpec-button-letter-spacing, normal );
	text-transform: var( --wpec-button-text-transform, none );
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wpec-search__button:hover,
.wpec-search__button:focus-visible {
	background-color: var( --wpec-button-hover-bg, var( --wpec-button-bg, var( --e-global-color-accent, #1d1d1d ) ) );
	color: var( --wpec-button-hover-color, var( --wpec-button-color, #fff ) );
}

.wpec-search__button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.wpec-search--button-icon .wpec-search__button {
	min-width: var( --wpec-search-height, 44px );
	padding: 0;
}

.wpec-search__panel {
	position: absolute;
	z-index: 1000;
	top: calc( 100% + 4px );
	right: 0;
	left: 0;
	max-height: min( 70vh, 480px );
	overflow-y: auto;
	border: 1px solid var( --wpec-border-color, #d9d9d9 );
	border-radius: var( --wpec-radius, 0 );
	background: #fff;
	box-shadow: 0 10px 30px rgba( 0, 0, 0, 0.12 );
	color: var( --e-global-color-text, #1d1d1d );
}

.wpec-search__panel[hidden] {
	display: none;
}

.wpec-search__list {
	margin: 0;
	padding: 4px 0;
	list-style: none;
}

.wpec-search__list[hidden] {
	display: none;
}

.wpec-search__option {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 8px 12px;
	list-style: none;
	cursor: pointer;
}

.wpec-search__option.is-active,
.wpec-search__option:hover {
	background-color: #f3f4f6;
}

.wpec-search__option.is-active {
	box-shadow: inset 3px 0 0 var( --wpec-button-bg, var( --e-global-color-accent, #1d1d1d ) );
}

.wpec-search .wpec-search__thumb {
	flex: 0 0 40px;
	width: 40px;
	max-width: none;
	height: 40px;
	border-radius: var( --wpec-radius, 0 );
	background: #f3f3f3;
	object-fit: cover;
}

.wpec-search__option-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	gap: 2px;
}

.wpec-search__option-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpec-search__option-title mark {
	padding: 0;
	background: none;
	color: inherit;
	font-weight: 700;
}

.wpec-search__option-price {
	color: var( --wpec-price-color, var( --wpec-muted-color, #555 ) );
	font-size: 0.875em;
	font-weight: 600;
}

.wpec-search__all {
	justify-content: center;
	margin-top: 4px;
	border-top: 1px solid var( --wpec-border-color, #e5e5e5 );
	font-weight: 600;
}

.wpec-search__none {
	margin: 0;
	padding: 14px 12px;
	color: var( --wpec-muted-color, #6b6b6b );
}

.wpec-search.is-searching .wpec-search__field {
	background-image: linear-gradient( 90deg, transparent, rgba( 0, 0, 0, 0.04 ), transparent );
	background-size: 200% 100%;
	animation: wpec-search-busy 1.2s linear infinite;
}

@keyframes wpec-search-busy {
	from {
		background-position: 200% 0;
	}

	to {
		background-position: -200% 0;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wpec-search.is-searching .wpec-search__field {
		animation: none;
	}

	.wpec-search__button {
		transition: none;
	}
}
