
.riedel-product-search-shell {
	width: 100%;
}

.riedel-product-search__mobile-toggle,
.riedel-product-search__mobile-close {
	display: none;
}

.riedel-product-search__mobile-panel {
	display: contents;
}

.riedel-product-search__mobile-panel-inner {
	display: contents;
}

.riedel-product-search {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: stretch;
	width: 100%;
	margin: 0;
	padding: var(--wp--preset--spacing--1, 0.25rem) var(--wp--preset--spacing--1, 0.25rem) var(--wp--preset--spacing--1, 0.25rem) var(--wp--preset--spacing--4, 1rem);
	border: 1px solid var(--wp--preset--color--border-strong, #CBD5E1);
	border-radius: var(--wp--custom--radius--lg, 8px);
	background: var(--wp--preset--color--surface-default, #fff);
}

.riedel-product-search__field {
	display: flex;
	align-items: center;
	min-width: 0;
	gap: var(--wp--preset--spacing--2, 0.5rem);
}

.riedel-product-search__icon {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--wp--preset--color--text-secondary, #475669);
}

.riedel-product-search__icon svg {
	display: block;
	width: 20px;
	height: 20px;
}

.riedel-product-search input.riedel-product-search__input[type="search"] {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	border: 0;
	padding: 0;
	color: var(--wp--preset--color--text-primary, #1A1A1A);
	font-size: var(--wp--preset--font-size--lg, 1.125rem);
	background: transparent;
	box-shadow: none;
	border-radius: var(--wp--custom--radius--none, 0px);
	outline: none;
}

.riedel-product-search input.riedel-product-search__input[type="search"]:focus,
.riedel-product-search input.riedel-product-search__input[type="search"]:active {
	outline: none;
	border: 0;
	box-shadow: none;
}

.riedel-product-search__input::placeholder {
	color: var(--wp--preset--color--text-placeholder, #94A3B8);
	opacity: 1;
}

.riedel-product-search__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	height: 40px;
	width: 40px;
	padding: 0;
	border: 0;
	border-radius: 0 var(--wp--custom--radius--lg, 8px) var(--wp--custom--radius--lg, 8px) 0;
	background: var(--wp--preset--color--action-primary, #007D7D);
	color: var(--wp--preset--color--text-inverse, #fff);
	cursor: pointer;
	flex: 0 0 auto;
}

.riedel-product-search__submit:hover,
.riedel-product-search__submit:focus {
	background: var(--wp--preset--color--action-primary-hover, #006666);
	outline: none;
}

.riedel-product-search__submit svg {
	display: block;
	width: 20px;
	height: 20px;
}

/* ── Autocomplete panel ─────────────────────────────────────── */

.riedel-product-search {
	position: relative;
}

.riedel-product-search__autocomplete {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 30;
	max-height: 420px;
	overflow-y: auto;
	border: 1px solid var(--wp--preset--color--border-default, #E2E8F0);
	border-radius: var(--wp--custom--radius--xxl, 12px);
	background: var(--wp--preset--color--surface-default, #fff);
	box-shadow: 0 16px 40px color-mix(in srgb, var(--wp--preset--color--footer-border, #0F172A) 12%, transparent);
}

.riedel-product-search__autocomplete[hidden] {
	display: none !important;
}

/* "Meinten Sie …?" correction row, pinned to the top of the dropdown. */
.riedel-product-search__autocomplete-suggestion {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.35em;
	padding: var(--wp--preset--spacing--2, 0.5rem) var(--wp--preset--spacing--4, 1rem);
	text-decoration: none;
	background: var(--wp--preset--color--surface-secondary, #F8FAFC);
	border-bottom: 1px solid var(--wp--preset--color--border-default, #E2E8F0);
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
}

.riedel-product-search__autocomplete-suggestion-label {
	color: var(--wp--preset--color--text-secondary, #475669);
}

.riedel-product-search__autocomplete-suggestion-term {
	font-weight: 700;
	color: var(--wp--preset--color--action-primary, #007D7D);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.riedel-product-search__autocomplete-suggestion:hover .riedel-product-search__autocomplete-suggestion-term,
.riedel-product-search__autocomplete-suggestion:focus .riedel-product-search__autocomplete-suggestion-term {
	color: var(--wp--preset--color--action-primary-hover, #006666);
}

.riedel-product-search__autocomplete-item {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--3, 0.75rem);
	padding: var(--wp--preset--spacing--2, 0.5rem) var(--wp--preset--spacing--4, 1rem);
	text-decoration: none;
	color: var(--wp--preset--color--text-secondary, #475669);
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--border-default, #E2E8F0) 60%, transparent);
}

.riedel-product-search__autocomplete-item:first-child {
	border-top: 0;
}

.riedel-product-search__autocomplete-item:hover,
.riedel-product-search__autocomplete-item.is-active {
	background: var(--wp--preset--color--surface-tertiary, #F1F5F9);
	color: var(--wp--preset--color--footer-border, #0F172A);
}

.riedel-product-search__autocomplete-thumb {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	object-fit: contain;
	border-radius: var(--wp--custom--radius--md, 6px);
	background: color-mix(in srgb, var(--wp--preset--color--surface-tertiary, #F1F5F9) 80%, transparent);
}

.riedel-product-search__autocomplete-info {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: var(--wp--preset--spacing--1, 0.25rem);
	min-width: 0;
}

.riedel-product-search__autocomplete-name {
	display: block;
	overflow: hidden;
	font-size: var(--wp--preset--font-size--input, 0.9375rem);
	font-weight: 500;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.riedel-product-search__autocomplete-sku {
	display: block;
	font-size: var(--wp--preset--font-size--sm, 0.75rem);
	color: var(--wp--preset--color--text-secondary, #475669);
}

/* ── Loading skeleton ───────────────────────────────────────── */

.riedel-product-search__autocomplete-skeleton {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--3, 0.75rem);
	padding: var(--wp--preset--spacing--2, 0.5rem) var(--wp--preset--spacing--4, 1rem);
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--border-default, #E2E8F0) 60%, transparent);
}

.riedel-product-search__autocomplete-skeleton:first-child {
	border-top: 0;
}

.riedel-product-search__autocomplete-skeleton-thumb {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: var(--wp--custom--radius--md, 6px);
}

.riedel-product-search__autocomplete-skeleton-lines {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: var(--wp--preset--spacing--2, 0.5rem);
}

.riedel-product-search__autocomplete-skeleton-line {
	width: 100%;
	height: 12px;
	border-radius: var(--wp--custom--radius--sm, 4px);
}

.riedel-product-search__autocomplete-skeleton-line.is-short {
	width: 40%;
}

.riedel-product-search__autocomplete-skeleton-thumb,
.riedel-product-search__autocomplete-skeleton-line {
	background: linear-gradient(
		90deg,
		var(--wp--preset--color--surface-tertiary, #F1F5F9) 25%,
		var(--wp--preset--color--border-default, #E2E8F0) 37%,
		var(--wp--preset--color--surface-tertiary, #F1F5F9) 63%
	);
	background-size: 400% 100%;
	animation: riedel-search-shimmer 1.4s ease infinite;
}

@keyframes riedel-search-shimmer {
	0% {
		background-position: 100% 50%;
	}

	100% {
		background-position: 0 50%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.riedel-product-search__autocomplete-skeleton-thumb,
	.riedel-product-search__autocomplete-skeleton-line {
		animation: none;
	}
}

/* ── Empty state ────────────────────────────────────────────── */

.riedel-product-search__autocomplete-empty {
	padding: var(--wp--preset--spacing--4, 1rem);
	font-size: var(--wp--preset--font-size--base, 0.875rem);
	color: var(--wp--preset--color--text-tertiary, #64748B);
	text-align: center;
}

@media (max-width: 799px) {
	.has-riedel-mobile-search {
		overflow: hidden;
	}

	.riedel-product-search-shell {
		display: flex;
		justify-content: flex-end;
	}

	.riedel-product-search__mobile-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		margin: 0;
		padding: 0;
		border-radius: var(--wp--custom--radius--lg, 8px);
		color: var(--wp--preset--color--footer-border, #0F172A);
		box-shadow: none;
		cursor: pointer;
	}

	.riedel-product-search__mobile-toggle:hover,
	.riedel-product-search__mobile-toggle:focus {
		color: var(--wp--preset--color--footer-border, #0F172A);
		outline: none;
	}

	.riedel-product-search__mobile-toggle svg {
		width: 24px;
		height: 24px;
	}

	.riedel-product-search__mobile-panel {
		position: fixed;
		inset: 0;
		z-index: 100000;
		display: block;
		visibility: hidden;
		opacity: 0;
		background: var(--wp--preset--color--surface-default, #fff);
		pointer-events: none;
		transition: opacity 180ms ease, visibility 180ms ease;
	}

	/* Offset below the WP admin bar so the close button isn't overlapped. */
	body.admin-bar .riedel-product-search__mobile-panel {
		top: 32px;
	}

	.riedel-product-search__mobile-panel-inner {
		position: absolute;
		inset: 0;
		display: block;
		width: 100%;
		min-height: 100%;
		padding: var(--wp--preset--spacing--16, 4rem) var(--wp--preset--spacing--4, 1rem) var(--wp--preset--spacing--6, 1.5rem);
		background: var(--wp--preset--color--surface-default, #fff);
		transform: translateY(12px);
		transition: transform 180ms ease;
	}

	.riedel-product-search-shell.is-search-open .riedel-product-search__mobile-panel {
		visibility: visible;
		opacity: 1;
		pointer-events: auto;
	}

	.riedel-product-search-shell.is-search-open .riedel-product-search__mobile-panel-inner {
		transform: translateX(0);
	}

	.riedel-product-search__mobile-close {
		position: absolute;
		top: var(--wp--preset--spacing--3, 0.75rem);
		right: var(--wp--preset--spacing--3, 0.75rem);
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: var(--wp--custom--radius--none, 0px);
		background: transparent;
		color: var(--wp--preset--color--footer-border, #0F172A);
		box-shadow: none;
		cursor: pointer;
	}

	.riedel-product-search__mobile-close:hover,
	.riedel-product-search__mobile-close:focus {
		background: transparent;
		color: var(--wp--preset--color--footer-border, #0F172A);
		outline: none;
	}

	.riedel-product-search {
		grid-template-columns: 1fr auto;
		align-content: start;
	}

	.riedel-product-search__field {
		gap: var(--wp--preset--spacing--2, 0.5rem);
	}

	.riedel-product-search input.riedel-product-search__input[type="search"] {
		height: 44px;
		font-size: var(--wp--preset--font-size--md, 1rem);
	}

	.riedel-product-search__submit {
		height: 44px;
		width: 44px;
	}

	.riedel-product-search__submit svg {
		width: 18px;
		height: 18px;
	}

	.riedel-product-search__autocomplete {
		top: 48px;
		max-height: 45vh;
	}
}

/* WP admin bar is 46px tall at ≤782px (32px above), so bump the panel further. */
@media (max-width: 782px) {
	body.admin-bar .riedel-product-search__mobile-panel {
		top: 46px;
	}
}
