/**
 * Ulendo Product Search - front-end styles.
 *
 * Deliberately minimal: structure and sane defaults only, so Elementor's style
 * controls stay in charge of the look.
 */

.ulendo-ps-form {
	position: relative;
	max-width: 100%;
}

.ulendo-ps-form__row {
	display: flex;
	align-items: stretch;
	gap: 8px;
}

.ulendo-ps-form__field {
	position: relative;
	display: flex;
	/* Zero basis so the field fills the row regardless of the input's own width. */
	flex: 1 1 0%;
	min-width: 0;
}

.ulendo-ps-form__input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	padding: 12px 16px;
	font: inherit;
	color: inherit;
	background: #fff;
	border: 1px solid currentColor;
	border-radius: 4px;
}

/* The browser draws its own clear button on search inputs; ours replaces it. */
.ulendo-ps-form__input::-webkit-search-cancel-button,
.ulendo-ps-form__input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}

.ulendo-ps-form__clear {
	position: absolute;
	top: 50%;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	font-size: 18px;
	line-height: 1;
	color: inherit;
	cursor: pointer;
	/* Themed button styling would otherwise turn this into a coloured block. */
	background: none !important;
	border: 0 !important;
	box-shadow: none !important;
	border-radius: 50%;
	transform: translateY(-50%);
	opacity: 0.45;
}

.ulendo-ps-form__clear:hover,
.ulendo-ps-form__clear:focus {
	opacity: 1;
}

/*
 * Themes and page builders often set a display value on every button, which
 * beats the browser's own [hidden] rule. Without this the clear button sits
 * there permanently, even on an empty field.
 */
.ulendo-ps-form__clear[hidden] {
	display: none !important;
}

.ulendo-ps-form__submit {
	display: inline-flex;
	flex: 0 0 auto;
	gap: 8px;
	align-items: center;
	justify-content: center;
	padding: 12px 20px;
	font: inherit;
	cursor: pointer;
	border: 0;
	border-radius: 4px;
}

.ulendo-ps-form__icon {
	display: inline-flex;
}

/* Live dropdown ---------------------------------------------------------- */

.ulendo-ps-live {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	z-index: 999;
	max-height: 420px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 6px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.ulendo-ps-live[hidden] {
	display: none;
}

.ulendo-ps-live__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ulendo-ps-live__item + .ulendo-ps-live__item {
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.ulendo-ps-live__link {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 10px 14px;
	color: inherit;
	text-decoration: none;
}

.ulendo-ps-live__link:hover,
.ulendo-ps-live__link:focus,
.ulendo-ps-live__item.is-active .ulendo-ps-live__link {
	background: rgba(0, 0, 0, 0.04);
}

.ulendo-ps-live__media {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 4px;
}

.ulendo-ps-live__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

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

.ulendo-ps-live__title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ulendo-ps-live__meta {
	display: flex;
	gap: 10px;
	align-items: center;
	font-size: 0.875em;
	opacity: 0.85;
}

.ulendo-ps-live__all,
.ulendo-ps-live__suggestion {
	display: block;
	padding: 12px 14px;
	text-align: center;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ulendo-ps-live__empty {
	padding: 18px 14px;
	text-align: center;
}

.ulendo-ps-live.is-loading {
	opacity: 0.6;
}

/* Icon trigger and search overlay ---------------------------------------- */

/*
 * Themes style every button on the site, and this one has to read as a bare
 * icon. The border is forced off; background and radius stay overridable so
 * the Elementor controls still work.
 */
.ulendo-ps-trigger,
.ulendo-ps-trigger:hover,
.ulendo-ps-trigger:focus,
.ulendo-ps-trigger:active {
	border: 0 !important;
	box-shadow: none !important;
	text-decoration: none;
	-webkit-appearance: none;
	appearance: none;
}

.ulendo-ps-trigger {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	padding: 8px;
	font: inherit;
	color: inherit;
	line-height: 1;
	cursor: pointer;
	background-color: transparent;
	min-width: 0;
	min-height: 0;
}

.ulendo-ps-trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.ulendo-ps-trigger svg {
	width: 22px;
	height: 22px;
}

.ulendo-ps-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 12vh 20px 20px;
}

.ulendo-ps-overlay[hidden] {
	display: none !important;
}

.ulendo-ps-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.ulendo-ps-overlay__panel {
	position: relative;
	width: 100%;
	max-width: 680px;
}

.ulendo-ps-overlay__close {
	position: absolute;
	top: -46px;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font-size: 26px;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	background: none;
	border: 0;
	opacity: 0.85;
}

.ulendo-ps-overlay__close:hover,
.ulendo-ps-overlay__close:focus {
	opacity: 1;
}

.ulendo-ps-overlay__title {
	margin: 0 0 12px;
	color: #fff;
	font-size: 1.1rem;
}

/* The dropdown sits in normal flow inside the overlay rather than floating. */
.ulendo-ps-overlay .ulendo-ps-live {
	position: static;
	margin-top: 10px;
	max-height: 55vh;
}

.ulendo-ps-overlay.is-open .ulendo-ps-overlay__panel {
	animation: ulendo-ps-rise 0.18s ease-out;
}

@keyframes ulendo-ps-rise {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ulendo-ps-overlay.is-open .ulendo-ps-overlay__panel {
		animation: none;
	}
}

body.ulendo-ps-locked {
	overflow: hidden;
}

/* Results grid ----------------------------------------------------------- */

.ulendo-ps-grid {
	display: grid;
	grid-template-columns: repeat(var(--ups-columns, 4), minmax(0, 1fr));
	column-gap: 24px;
	row-gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 1024px) {
	.ulendo-ps-grid {
		grid-template-columns: repeat(var(--ups-columns-tablet, 3), minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.ulendo-ps-grid {
		grid-template-columns: repeat(var(--ups-columns-mobile, 2), minmax(0, 1fr));
	}
}

.ulendo-ps-card {
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ulendo-ps-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1 / var(--ups-ratio, 1);
}

.ulendo-ps-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.ulendo-ps-card__badge {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 3px 10px;
	font-size: 12px;
	color: #fff;
	background: #b32d2e;
	border-radius: 999px;
}

.ulendo-ps-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	padding: 14px 0 0;
}

.ulendo-ps-card__title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.35;
}

.ulendo-ps-card__title a {
	color: inherit;
	text-decoration: none;
}

.ulendo-ps-card__excerpt {
	margin: 0;
	font-size: 0.9em;
	opacity: 0.8;
}

.ulendo-ps-card__actions {
	margin-top: auto;
	padding-top: 10px;
}

.ulendo-ps-card__stock.is-outofstock {
	opacity: 0.7;
}

.ulendo-ps-mark {
	padding: 0 1px;
	color: inherit;
	background: rgba(255, 214, 0, 0.4);
}

/* Sorting, pagination, summary ------------------------------------------- */

.ulendo-ps-sort {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: flex-end;
	margin-bottom: 16px;
}

.ulendo-ps-sort__select {
	padding: 8px 12px;
	font: inherit;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

.ulendo-ps-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
	justify-content: center;
	margin-top: 32px;
}

.ulendo-ps-pagination__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	padding: 8px 12px;
	color: inherit;
	text-decoration: none;
	border-radius: 4px;
}

.ulendo-ps-pagination__link.is-current {
	background: rgba(0, 0, 0, 0.08);
}

.ulendo-ps-loadmore {
	margin-top: 32px;
	text-align: center;
}

.ulendo-ps-loadmore__button {
	padding: 12px 28px;
	font: inherit;
	cursor: pointer;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: transparent;
}

.ulendo-ps-summary {
	margin-bottom: 16px;
}

.ulendo-ps-summary p {
	margin: 0 0 4px;
}

.ulendo-ps-empty {
	padding: 32px 0;
}

.ulendo-ps-empty__list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 0;
	list-style: none;
}

.ulendo-ps-empty__list a {
	display: inline-block;
	padding: 6px 14px;
	text-decoration: none;
	border: 1px solid currentColor;
	border-radius: 999px;
}

/* Filters ---------------------------------------------------------------- */

.ulendo-ps-filter {
	margin: 0;
	padding: 0;
	border: 0;
}

.ulendo-ps-filter + .ulendo-ps-filter {
	margin-top: 24px;
}

.ulendo-ps-filter__title {
	padding: 0;
	margin-bottom: 10px;
	font-weight: 600;
}

.ulendo-ps-filter__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ulendo-ps-filter__item + .ulendo-ps-filter__item {
	margin-top: 6px;
}

.ulendo-ps-filter__label {
	display: flex;
	gap: 8px;
	align-items: center;
	cursor: pointer;
}

.ulendo-ps-filter__name {
	flex: 1 1 auto;
}

.ulendo-ps-filter__count {
	font-size: 0.85em;
	opacity: 0.6;
}

.ulendo-ps-filter__price {
	display: flex;
	gap: 8px;
	align-items: center;
}

.ulendo-ps-filter__price-input {
	width: 100%;
	min-width: 0;
	padding: 8px 10px;
	font: inherit;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

.ulendo-ps-filters__reset {
	margin-top: 20px;
}

/* States ----------------------------------------------------------------- */

.ulendo-ps-results.is-loading {
	position: relative;
	opacity: 0.55;
	pointer-events: none;
}

.ulendo-ps-placeholder {
	padding: 32px;
	text-align: center;
	border: 1px dashed rgba(0, 0, 0, 0.2);
	border-radius: 6px;
}

.ulendo-ps-placeholder__icon {
	display: block;
	margin-bottom: 8px;
	font-size: 28px;
	opacity: 0.5;
}

.ulendo-ps-preview-note {
	margin: 0 0 12px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.6;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
