/**
 * Alcli Product Search styles.
 * Colours follow the Alcli palette: beige #F4EFE3, red #CD4547, ink #14110F.
 *
 * A note on specificity. This widget is placed inside Elementor containers, and
 * both Hello Elementor and the Elementor global button styles set background,
 * padding and border-radius on any <button>. Those rules were beating the ones
 * here, which is why the type chooser rendered as square black blocks instead of
 * the pills it was written as. The selectors below are deliberately chained
 * (.alcli-ps .alcli-ps__types .alcli-ps__type) and the handful of properties the
 * theme actually fights over are marked important. Nothing else uses important.
 */

.alcli-ps {
	--alcli-ps-red: #cd4547;
	--alcli-ps-red-dark: #b23a3c;
	--alcli-ps-ink: #14110f;
	--alcli-ps-soft: #57514a;
	--alcli-ps-beige: #f4efe3;
	--alcli-ps-line: rgba(20, 17, 15, 0.12);
	--alcli-ps-radius: 999px;
	position: relative;
	width: 100%;
	max-width: 880px;
	margin-inline: auto;
	font-size: 16px;
}

.alcli-ps *,
.alcli-ps *::before,
.alcli-ps *::after {
	box-sizing: border-box;
}

.alcli-ps__form {
	position: relative;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

/* ------------------------------------------------------------------ types */

/* A segmented control: one soft track, the active choice as a filled pill. */
.alcli-ps .alcli-ps__types {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 2px;
	margin: 0;
	padding: 4px;
	background: var(--alcli-ps-beige);
	border-radius: var(--alcli-ps-radius);
}

.alcli-ps .alcli-ps__types .alcli-ps__type {
	appearance: none;
	cursor: pointer;
	font: inherit;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 1.2;
	letter-spacing: 0.2px;
	text-transform: none !important;
	white-space: nowrap;
	color: var(--alcli-ps-soft) !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: var(--alcli-ps-radius) !important;
	padding: 9px 20px !important;
	box-shadow: none !important;
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.alcli-ps .alcli-ps__types .alcli-ps__type:hover {
	color: var(--alcli-ps-ink) !important;
	background: rgba(255, 255, 255, 0.75) !important;
}

.alcli-ps .alcli-ps__types .alcli-ps__type.is-active {
	color: #fff !important;
	background: var(--alcli-ps-red) !important;
	box-shadow: 0 2px 8px -2px rgba(205, 69, 71, 0.55) !important;
}

.alcli-ps .alcli-ps__types .alcli-ps__type:focus-visible {
	outline: 2px solid var(--alcli-ps-red);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ field */

.alcli-ps__field {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	background: #fff;
	border: 1px solid var(--alcli-ps-line);
	border-radius: var(--alcli-ps-radius);
	box-shadow: 0 1px 2px rgba(20, 17, 15, 0.04), 0 8px 24px -16px rgba(20, 17, 15, 0.4);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.alcli-ps__field:hover {
	border-color: rgba(20, 17, 15, 0.2);
}

.alcli-ps__field:focus-within {
	border-color: var(--alcli-ps-red);
	box-shadow: 0 0 0 4px rgba(205, 69, 71, 0.13), 0 8px 24px -16px rgba(20, 17, 15, 0.4);
}

.alcli-ps__icon {
	display: flex;
	align-items: center;
	padding-inline-start: 20px;
	pointer-events: none;
}

.alcli-ps__icon svg {
	width: 19px;
	height: 19px;
	fill: #9a938a;
	transition: fill 0.2s ease;
}

.alcli-ps__field:focus-within .alcli-ps__icon svg {
	fill: var(--alcli-ps-red);
}

.alcli-ps .alcli-ps__input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0 !important;
	outline: none;
	background: transparent !important;
	box-shadow: none !important;
	padding: 17px 14px !important;
	font-size: 15.5px;
	line-height: 1.4;
	color: var(--alcli-ps-ink);
}

.alcli-ps__input::placeholder {
	color: #9a938a;
	opacity: 1;
}

/* Hide the browser's own clear button so it does not fight the layout. */
.alcli-ps__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

/* The submit sits inside the capsule with a little breathing room. */
.alcli-ps .alcli-ps__submit {
	appearance: none;
	cursor: pointer;
	flex: 0 0 auto;
	align-self: stretch;
	margin: 5px;
	border: 0 !important;
	border-radius: var(--alcli-ps-radius) !important;
	background: var(--alcli-ps-red) !important;
	color: #fff !important;
	font: inherit;
	font-size: 12.5px !important;
	font-weight: 700 !important;
	text-transform: uppercase !important;
	letter-spacing: 1px;
	padding: 0 28px !important;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.alcli-ps .alcli-ps__submit:hover {
	background: var(--alcli-ps-red-dark) !important;
}

.alcli-ps .alcli-ps__submit:active {
	transform: scale(0.98);
}

.alcli-ps .alcli-ps__submit:focus-visible {
	outline: 2px solid var(--alcli-ps-ink);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------- results */

.alcli-ps__results {
	position: absolute;
	z-index: 999;
	inset-inline: 0;
	top: calc(100% + 10px);
	background: #fff;
	border: 1px solid var(--alcli-ps-line);
	border-radius: 16px;
	box-shadow: 0 30px 60px -28px rgba(20, 17, 15, 0.55);
	overflow: hidden;
	max-height: 70vh;
	overflow-y: auto;
}

.alcli-ps__results[hidden] {
	display: none;
}

.alcli-ps__msg,
.alcli-ps__note {
	padding: 16px 20px;
	font-size: 14px;
	color: var(--alcli-ps-soft);
}

.alcli-ps__note {
	background: var(--alcli-ps-beige);
	border-bottom: 1px solid var(--alcli-ps-line);
	color: var(--alcli-ps-ink);
}

.alcli-ps__list {
	list-style: none;
	margin: 0;
	padding: 6px;
}

.alcli-ps__item {
	list-style: none;
	margin: 0;
}

.alcli-ps__link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 14px;
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	transition: background-color 0.15s ease;
}

.alcli-ps__item:hover .alcli-ps__link,
.alcli-ps__item.is-active .alcli-ps__link {
	background: var(--alcli-ps-beige);
}

.alcli-ps__thumb {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--alcli-ps-beige);
}

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

.alcli-ps__body {
	flex: 1 1 auto;
	min-width: 0;
}

.alcli-ps__title {
	display: block;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--alcli-ps-ink);
	margin-bottom: 4px;
}

.alcli-ps__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 12px;
	font-size: 12.5px;
	color: var(--alcli-ps-soft);
}

.alcli-ps__sku {
	font-weight: 600;
	color: var(--alcli-ps-ink);
}

.alcli-ps__cat::before,
.alcli-ps__brand::before {
	content: "";
	display: inline-block;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--alcli-ps-red);
	margin-inline-end: 7px;
	vertical-align: middle;
}

.alcli-ps__price {
	flex: 0 0 auto;
	font-size: 14px;
	font-weight: 700;
	color: var(--alcli-ps-red);
	white-space: nowrap;
}

.alcli-ps__link mark {
	background: rgba(205, 69, 71, 0.16);
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}

.alcli-ps__all {
	display: block;
	margin: 6px;
	border-radius: 12px;
	text-align: center;
	padding: 13px 16px;
	background: var(--alcli-ps-ink);
	color: #fff;
	font-size: 12.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.alcli-ps__all:hover {
	background: var(--alcli-ps-red);
	color: #fff;
}

/* Note shown on the full results page when a product number was normalised. */
.alcli-ps-normalised-note {
	max-width: 1240px;
	margin: 0 auto 18px;
	padding: 12px 18px;
	background: var(--alcli-ps-beige, #f4efe3);
	border-inline-start: 3px solid #cd4547;
	border-radius: 4px;
	font-size: 14px;
	color: #14110f;
}

/* Screen reader only helper, in case the theme does not provide one. */
.alcli-ps .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ----------------------------------------------------------------- small */

@media (max-width: 700px) {
	.alcli-ps .alcli-ps__types {
		display: flex;
		width: 100%;
		justify-content: stretch;
	}

	.alcli-ps .alcli-ps__types .alcli-ps__type {
		flex: 1 1 auto;
		padding: 9px 12px !important;
		font-size: 12.5px !important;
	}
}

@media (max-width: 480px) {
	.alcli-ps .alcli-ps__input {
		padding: 15px 10px !important;
		/* 16px keeps iOS from zooming the page when the field is focused. */
		font-size: 16px;
	}

	.alcli-ps__icon {
		padding-inline-start: 16px;
	}

	.alcli-ps .alcli-ps__submit {
		padding: 0 18px !important;
		font-size: 11.5px !important;
		letter-spacing: 0.6px;
	}

	.alcli-ps__price {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.alcli-ps__type,
	.alcli-ps__submit,
	.alcli-ps__link,
	.alcli-ps__all,
	.alcli-ps__icon svg {
		transition: none !important;
		transform: none !important;
	}
}
