/* Wiederverwendbare Komponenten: Produktkarte, Verfügbarkeit, Suche mit Vorschlägen, Hinweis-Toast. */

/* Produktkarte */
.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	overflow: hidden;
}

.product-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1;
	padding: var(--space-4);
	border-bottom: 1px solid var(--color-border);
	background: var(--color-surface);
}

.product-card__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.product-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--space-2);
	padding: var(--space-4);
}

.product-card__brand {
	font-size: var(--fs-xs);
	font-weight: var(--fw-bold);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.product-card__title {
	font-family: var(--font-body);
	font-size: var(--fs-base);
	font-weight: var(--fw-semibold);
	line-height: var(--lh-tight);
	letter-spacing: normal;
	text-wrap: pretty;
}

.product-card__title a {
	color: var(--color-text);
	text-decoration: none;
}

.product-card__title a:hover {
	color: var(--color-brand);
	text-decoration: underline;
}

.product-card__price {
	margin-top: auto;
	padding-top: var(--space-2);
	font-size: var(--fs-lg);
	font-weight: var(--fw-bold);
	line-height: var(--lh-tight);
	font-variant-numeric: tabular-nums;
}

.product-card__price del {
	margin-right: var(--space-2);
	font-size: var(--fs-sm);
	font-weight: var(--fw-regular);
	color: var(--color-text-muted);
}

.product-card__price ins {
	color: var(--color-brand);
	text-decoration: none;
}

.badge {
	position: absolute;
	top: var(--space-3);
	left: var(--space-3);
	padding: 2px var(--space-2);
	border-radius: var(--radius-pill);
	font-size: var(--fs-xs);
	font-weight: var(--fw-bold);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
}

.badge--sale {
	background: var(--color-brand);
	color: var(--color-text-inverse);
}

/* Verfügbarkeit – gut sichtbar als farbige Zeile */
.availability {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
	padding: var(--space-1) var(--space-2);
	border-radius: var(--radius-sm);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semibold);
	line-height: var(--lh-tight);
}

.availability .icon {
	width: 18px;
	height: 18px;
}

.availability--pickup {
	background: var(--color-success-bg);
	color: var(--color-success);
}

.availability--order {
	background: var(--color-warning-bg);
	color: var(--color-warning);
}

/* Suche */
.search {
	position: relative;
}

.search__label {
	display: block;
	margin-bottom: var(--space-2);
	font-weight: var(--fw-semibold);
}

.search__row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.search__box {
	position: relative;
	flex: 1 1 14rem;
}

.search__icon {
	position: absolute;
	top: 50%;
	left: var(--space-3);
	width: 20px;
	height: 20px;
	color: var(--color-text-muted);
	transform: translateY(-50%);
	pointer-events: none;
}

.search__input {
	padding-left: calc(var(--space-3) + 20px + var(--space-2));
	background: var(--color-bg);
	border-color: var(--color-border-strong);
	-webkit-appearance: none;
	appearance: none;
}

.search__input:focus {
	background: var(--color-surface);
}

.search__input::-webkit-search-cancel-button {
	display: none;
}

.search__box:has(.search__submit) .search__input {
	padding-right: calc(var(--tap) + var(--space-2));
}

.search__submit {
	position: absolute;
	top: 2px;
	right: 2px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--tap);
	height: var(--tap);
	border: 0;
	border-radius: calc(var(--radius-sm) - 2px);
	background: var(--color-brand);
	color: var(--color-text-inverse);
}

.search__submit:hover {
	background: var(--color-brand-dark);
}

.search__submit .icon {
	width: 20px;
	height: 20px;
}

.search__button {
	flex: 1 0 auto;
}

/* Vorschlagsliste */
.search__listbox {
	position: absolute;
	top: calc(100% + var(--space-1));
	left: 0;
	right: 0;
	z-index: var(--z-dropdown);
	max-height: min(70vh, 32rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-block: var(--space-2);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	color: var(--color-text);
	box-shadow: var(--shadow-md);
	text-align: left;
}

.search__listbox[hidden] {
	display: none;
}

.suggest__group + .suggest__group {
	margin-top: var(--space-2);
	padding-top: var(--space-2);
	border-top: 1px solid var(--color-border);
}

.suggest__group-label {
	padding: var(--space-1) var(--space-4);
	font-size: var(--fs-xs);
	font-weight: var(--fw-bold);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.suggest__option {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: var(--tap);
	padding: var(--space-2) var(--space-4);
	cursor: pointer;
}

.suggest__option:hover,
.suggest__option.is-active {
	background: var(--color-bg);
}

.suggest__option.is-active {
	box-shadow: inset 4px 0 0 var(--color-brand);
}

.suggest__name {
	font-weight: var(--fw-semibold);
	line-height: var(--lh-tight);
}

.suggest__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--space-3);
	margin-top: 2px;
	font-size: var(--fs-sm);
	color: var(--color-text-muted);
}

.suggest__sku {
	font-variant-numeric: tabular-nums;
	font-weight: var(--fw-semibold);
	color: var(--color-anthracite);
}

.suggest__stock--pickup {
	color: var(--color-success);
}

.suggest__all {
	flex-direction: row;
	align-items: center;
	gap: var(--space-2);
	margin-top: var(--space-2);
	border-top: 1px solid var(--color-border);
	color: var(--color-brand);
	font-weight: var(--fw-semibold);
}

.suggest__empty {
	padding: var(--space-2) var(--space-4);
	color: var(--color-text-muted);
}

/* Hinweis nach „In den Warenkorb“ */
.toast {
	position: fixed;
	left: var(--gutter);
	right: var(--gutter);
	bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
	z-index: var(--z-toast);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-4);
	max-width: 32rem;
	margin-inline: auto;
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
	background: var(--color-anthracite);
	color: var(--color-text-inverse);
	box-shadow: var(--shadow-md);
	--color-focus: var(--color-text-inverse);
}

.toast[hidden] {
	display: none;
}

.toast__link {
	display: inline-flex;
	align-items: center;
	min-height: var(--tap);
	color: inherit;
	font-weight: var(--fw-bold);
}

.product-card__action .btn {
	padding-inline: var(--space-3);
	white-space: nowrap;
}

/* Öffnungs- und Abholzeiten (Definitionsliste) */
.hours {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: var(--space-1) var(--space-4);
	margin: 0;
}

.hours > div {
	display: contents;
}

.hours dt {
	font-weight: var(--fw-bold);
	white-space: nowrap;
}

.hours dd {
	margin: 0;
}

.hours--large {
	font-size: var(--fs-md);
}

/* „Route planen“ */
.route-link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	min-height: var(--tap);
	margin-block: calc((var(--tap) - 1.5em) / -2);
	font-weight: var(--fw-semibold);
}

.route-link .icon {
	width: 18px;
	height: 18px;
}

/* WooCommerce-Hinweise (klassisch und Blöcke) */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	margin: 0 0 var(--space-5);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-anthracite);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text);
	list-style: none;
}

.woocommerce-message,
.wc-block-components-notice-banner.is-success {
	border-left-color: var(--color-success);
}

.woocommerce-error,
.wc-block-components-notice-banner.is-error {
	border-left-color: var(--color-brand);
}

.woocommerce-error li {
	list-style: none;
}

.notices {
	padding-top: var(--space-4);
}

.notices .woocommerce-message,
.notices .woocommerce-info,
.notices .woocommerce-error {
	margin-bottom: 0;
}

/* Buttons aus WooCommerce-Templates (Konto, Hinweise, variable Produkte) im Theme-Stil */
.woocommerce .button,
.woocommerce-page .button,
.woocommerce-message .button,
.woocommerce-info .button,
.woocommerce-error .button,
.single_add_to_cart_button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	min-height: var(--control-h);
	padding: var(--space-2) var(--space-5);
	border: 2px solid var(--color-anthracite);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-anthracite);
	font-size: var(--fs-base);
	font-weight: var(--fw-bold);
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.woocommerce .button:hover,
.woocommerce-page .button:hover {
	background: var(--color-anthracite);
	color: var(--color-text-inverse);
}

.woocommerce .button.alt,
.woocommerce button[type="submit"].button,
.single_add_to_cart_button {
	border-color: var(--color-brand);
	background: var(--color-brand);
	color: var(--color-text-inverse);
}

.woocommerce .button.alt:hover,
.woocommerce button[type="submit"].button:hover,
.single_add_to_cart_button:hover {
	border-color: var(--color-brand-dark);
	background: var(--color-brand-dark);
}

/* Mengenfeld mit − / + */
.qty-field {
	display: inline-flex;
	align-items: stretch;
	height: var(--control-h);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	overflow: hidden;
}

.qty-field__btn {
	width: var(--control-h);
	border: 0;
	background: var(--color-bg);
	color: var(--color-anthracite);
	font-size: var(--fs-lg);
	font-weight: var(--fw-bold);
	line-height: 1;
}

.qty-field__btn:hover {
	background: var(--color-surface-sunken);
}

.qty-field__btn:focus-visible {
	outline-offset: -3px;
}

.qty-field__input {
	width: 3.5rem;
	border: 0;
	background: transparent;
	font-weight: var(--fw-bold);
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.qty-field__input::-webkit-outer-spin-button,
.qty-field__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.qty-field__input:focus-visible {
	outline: var(--focus-ring);
	outline-offset: -3px;
}

/* Seitennummerierung (WooCommerce) */
.woocommerce-pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-2);
	margin: var(--space-7) 0 0;
	padding: 0;
	list-style: none;
}

.woocommerce-pagination a.page-numbers,
.woocommerce-pagination span.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--tap);
	min-height: var(--tap);
	padding: 0 var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text);
	font-weight: var(--fw-semibold);
	text-decoration: none;
}

.woocommerce-pagination a.page-numbers:hover {
	border-color: var(--color-brand);
	color: var(--color-brand);
}

.woocommerce-pagination .page-numbers.current {
	border-color: var(--color-anthracite);
	background: var(--color-anthracite);
	color: var(--color-text-inverse);
}

/* Horizontale Reihen (Marken, Produkte): mobil randlos scrollbar.
   position: relative, damit absolut positionierte Screenreader-Texte in den Karten
   mit abgeschnitten werden und die Seite nicht seitlich verbreitern. */
.brand-row,
.product-row {
	position: relative;
	margin: 0 calc(-1 * var(--gutter));
	padding: var(--space-1) var(--gutter) var(--space-3);
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--gutter);
	scrollbar-width: thin;
}

.brand-row {
	display: flex;
	gap: var(--space-3);
}

.brand-row > li {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.brand-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-1);
	min-width: 168px;
	height: 88px;
	padding: 0 var(--space-5);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	color: var(--color-anthracite);
	font-family: var(--font-display);
	font-size: 1.75rem;
	letter-spacing: var(--tracking-display);
	line-height: 1;
	text-decoration: none;
	transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.brand-tile:hover {
	border-color: var(--color-brand);
	color: var(--color-brand);
}

.brand-tile__count {
	font-family: var(--font-body);
	font-size: var(--fs-xs);
	letter-spacing: normal;
	color: var(--color-text-muted);
}

.brand-tile img {
	width: auto;
	max-height: 40px;
}

.product-row {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(240px, 72%);
	gap: var(--space-3);
}

.product-row > li {
	display: flex;
	scroll-snap-align: start;
}

@media (min-width: 768px) {
	.product-row {
		grid-auto-columns: minmax(260px, 40%);
		gap: var(--space-4);
	}
}

@media (min-width: 1024px) {
	.brand-row,
	.product-row {
		margin-inline: 0;
		padding-inline: 0;
		overflow: visible;
	}

	.brand-row {
		flex-wrap: wrap;
	}

	.product-row {
		grid-auto-flow: row;
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
