.rg-product-search {
	position: relative;
	width: min(100%, 22rem);
}

.rg-product-search__form {
	margin: 0;
}

.rg-product-search__field {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--rg-border-default, #d7dde1);
	border-radius: var(--rg-container-radius, 4px);
	background: var(--wp--preset--color--white, #fff);
	overflow: hidden;
}

.rg-product-search__field:focus-within {
	border-color: var(--wp--preset--color--diesel-blue, #0b3a53);
	box-shadow: var(--rg-input-focus-shadow, 0 0 0 2px rgba(11, 58, 83, 0.18));
}

.rg-product-search__input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	box-shadow: none;
	background: transparent;
	padding: 0.55rem 0.75rem;
	font: inherit;
	color: var(--wp--preset--color--graphite, #141b22);
	/* Avoid native + custom clear icons both showing. */
	-webkit-appearance: none;
	appearance: none;
}

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

.rg-product-search__input::-ms-clear {
	display: none;
	width: 0;
	height: 0;
}

.rg-product-search__input:focus,
.rg-product-search__input:focus-visible {
	outline: none;
	box-shadow: none;
}

.rg-product-search__clear {
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--engine-gray, #55616c);
	padding: 0 0.35rem;
	cursor: pointer;
	font-size: 1.25rem;
	line-height: 1;
}

.rg-product-search__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-left: 1px solid var(--rg-border-default, #d7dde1);
	background: var(--wp--preset--color--smoke, #f4f6f7);
	color: var(--wp--preset--color--graphite, #141b22);
	padding: 0 0.85rem;
	cursor: pointer;
}

.rg-product-search__submit:hover {
	background: var(--wp--preset--color--steel, #d7dde1);
}

.rg-product-search__dropdown {
	position: absolute;
	top: calc(100% + 0.4rem);
	right: 0;
	z-index: 40;
	width: min(55rem, calc(100vw - 1.5rem));
	max-height: min(75vh, 35rem);
	flex-direction: column;
	background: var(--wp--preset--color--white, #fff);
	border: 1px solid var(--rg-border-default, #d7dde1);
	border-radius: var(--rg-container-radius, 4px);
	box-shadow: 0 16px 36px rgba(20, 27, 34, 0.16);
	overflow: hidden;
}

/* `display: flex` must not override the HTML `hidden` attribute on load. */
.rg-product-search__dropdown[hidden] {
	display: none !important;
}

.rg-product-search.is-open .rg-product-search__dropdown:not([hidden]) {
	display: flex;
}

.rg-product-search__panels {
	display: grid;
	grid-template-columns: minmax(0, 2.15fr) minmax(0, 0.95fr);
	grid-template-rows: minmax(0, 1fr);
	flex: 1 1 auto;
	min-height: 0;
	/* Prefer a comfortable panel height without escaping the dropdown. */
	/* height: min(70vh, 28rem); */
	max-height: 100%;
	overflow: hidden;
}

.rg-product-search__dropdown:has(.rg-product-search__status:not([hidden])) .rg-product-search__panels {
	height: auto;
	flex: 1 1 auto;
}

.rg-product-search__panels > * {
	min-width: 0;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.rg-product-search__list {
	border-right: 1px solid var(--rg-border-default, #d7dde1);
	padding: 0.5rem 0;
}

.rg-product-search__preview {
	padding: 1rem 1.1rem;
	background: var(--wp--preset--color--smoke, #f4f6f7);
}

.rg-product-search__status:not([hidden]) {
	flex: 0 0 auto;
	border-top: 1px solid var(--rg-border-default, #d7dde1);
}

.rg-product-search__preview.is-clickable {
	cursor: pointer;
}

.rg-product-search__preview.is-clickable:hover {
	background: #eef2f4;
}

.rg-product-search__section-title {
	padding: 0.35rem 0.9rem;
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--engine-gray, #55616c);
	font-weight: 700;
}

.rg-product-search__item {
	box-sizing: border-box;
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	padding: 0.55rem 0.75rem;
	border: 0;
	background: transparent;
	color: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	font: inherit;
}

.rg-product-search__item:hover,
.rg-product-search__item.is-active {
	background: rgba(11, 58, 83, 0.08);
}

.rg-product-search__item--product {
	display: grid;
	grid-template-columns: 2.75rem minmax(0, 1fr) minmax(4.5rem, auto);
	align-items: start;
	column-gap: 0.55rem;
}

.rg-product-search__item--category {
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15rem;
}

.rg-product-search__thumb {
	width: 2.75rem;
	height: 2.75rem;
	object-fit: cover;
	border-radius: 2px;
	background: var(--wp--preset--color--white, #fff);
	flex: 0 0 auto;
}

.rg-product-search__thumb.is-empty {
	display: inline-block;
	background: var(--wp--preset--color--steel, #d7dde1);
}

.rg-product-search__item-body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	overflow: hidden;
}

.rg-product-search__item-title {
	font-weight: 600;
	color: var(--wp--preset--color--graphite, #141b22);
	overflow-wrap: anywhere;
	word-break: break-word;
	line-height: 1.25;
}

.rg-product-search__item-title strong {
	font-weight: 800;
}

.rg-product-search__item-meta {
	font-size: 0.85em;
	color: var(--wp--preset--color--engine-gray, #55616c);
	overflow-wrap: anywhere;
}

.rg-product-search__item-price {
	min-width: 0;
	max-width: 100%;
	font-size: 0.82em;
	font-weight: 700;
	line-height: 1.25;
	color: var(--wp--preset--color--graphite, #141b22);
	text-align: right;
	justify-self: end;
}

.rg-product-search__item-price .woocommerce-Price-amount,
.rg-product-search__item-price .amount,
.rg-product-search__item-price bdi {
	white-space: nowrap;
}

.rg-product-search__item-price del,
.rg-product-search__item-price ins {
	display: block;
	text-decoration: inherit;
}

.rg-product-search__see-all,
.rg-product-search__preview-more,
.rg-product-search__preview-link {
	display: inline-block;
	margin: 0.5rem 0.9rem 0.75rem;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--wp--preset--color--diesel-blue, #0b3a53);
	text-decoration: underline;
}

.rg-product-search__preview-more,
.rg-product-search__preview-link {
	margin: 0.85rem 0 0;
}

.rg-product-search__preview-link {
	display: inline-block;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--wp--preset--color--diesel-blue, #0b3a53);
	text-decoration: underline;
}

.rg-product-search__empty,
.rg-product-search__status {
	padding: 0.85rem 1rem;
	margin: 0;
	color: var(--wp--preset--color--engine-gray, #55616c);
}

.rg-product-search__status.is-error {
	color: var(--wp--preset--color--alert, #b9382e);
}

.rg-product-search__preview-kicker {
	margin: 0 0 0.25rem;
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--wp--preset--color--engine-gray, #55616c);
}

.rg-product-search__preview-title {
	margin: 0 0 0.35rem;
	font-size: 1.15rem;
	line-height: 1.25;
	font-family: var(--wp--preset--font-family--industrial, inherit);
	font-weight: 800;
	color: var(--wp--preset--color--graphite, #141b22);
}

.rg-product-search__preview-breadcrumb,
.rg-product-search__preview-sku,
.rg-product-search__preview-excerpt {
	margin: 0 0 0.5rem;
	color: var(--wp--preset--color--engine-gray, #55616c);
	font-size: 0.92rem;
}

.rg-product-search__preview-price {
	margin: 0 0 0.65rem;
	font-size: 1.05rem;
	font-weight: 800;
}

.rg-product-search__preview-stock {
	margin: 0 0 0.65rem;
	font-weight: 700;
	color: var(--wp--preset--color--success, #176b3a);
}

.rg-product-search__preview-image {
	display: block;
	width: 100%;
	max-height: min(10rem, 40%);
	object-fit: contain;
	margin: 0 0 0.85rem;
	background: var(--wp--preset--color--white, #fff);
	border-radius: 2px;
}

.rg-product-search__preview-rows {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-top: 0.75rem;
}

.rg-product-search__preview-row {
	display: flex;
	gap: 0.65rem;
	align-items: center;
	padding: 0.4rem;
	border-radius: 2px;
	text-decoration: none;
	color: inherit;
	background: var(--wp--preset--color--white, #fff);
}

.rg-product-search__preview-row:hover {
	outline: 1px solid var(--wp--preset--color--diesel-blue, #0b3a53);
}

.rg-product-search__preview-row img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	flex: 0 0 auto;
}

.rg-product-search__preview-row-body {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.rg-product-search__preview-row-title {
	font-weight: 600;
	font-size: 0.92rem;
}

.rg-product-search__preview-row-price {
	font-size: 0.85rem;
	font-weight: 700;
}

.rg-product-search.is-loading .rg-product-search__submit {
	opacity: 0.65;
}

@media (max-width: 960px) {
	.rg-product-search__item--product {
		grid-template-columns: 2.5rem minmax(0, 1fr);
		grid-template-areas:
			"thumb body"
			"thumb price";
		row-gap: 0.2rem;
	}

	.rg-product-search__item--product .rg-product-search__thumb {
		grid-area: thumb;
	}

	.rg-product-search__item--product .rg-product-search__item-body {
		grid-area: body;
	}

	.rg-product-search__item--product .rg-product-search__item-price {
		grid-area: price;
		text-align: left;
		justify-self: start;
		font-size: 0.88em;
	}
}

@media (max-width: 782px) {
	.rg-product-search {
		width: 100%;
	}

	.rg-product-search__dropdown {
		left: 0;
		right: 0;
		width: auto;
		max-height: min(70vh, 28rem);
	}

	.rg-product-search__panels {
		grid-template-columns: 1fr;
		grid-template-rows: minmax(0, 1fr);
		height: min(70vh, 28rem);
	}

	.rg-product-search__list {
		border-right: 0;
		border-bottom: 0;
	}

	.rg-product-search__preview {
		display: none !important;
	}
}
