/*
 * Warenkorb, Kasse (WooCommerce-Blöcke) und Mein Konto (klassischer Shortcode).
 * Nur Gestaltung – Aufbau und Logik bleiben bei WooCommerce.
 */

.page--wc .page__header {
	margin-bottom: var(--space-4);
}

/* ---------- Gemeinsame Bausteine der Blöcke ---------- */

.page--wc {
	--wc-card-pad: var(--space-4);
}

.wc-block-components-button:not(.is-link) {
	min-height: var(--control-h);
	padding: var(--space-2) var(--space-5);
	border-radius: var(--radius-sm);
	font-family: var(--font-body);
	font-size: var(--fs-base);
	font-weight: var(--fw-bold);
	text-decoration: none;
}

.wc-block-components-button.contained,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {
	background: var(--color-brand) !important;
	color: var(--color-text-inverse) !important;
	border: 0;
}

.wc-block-components-button.contained:hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
	background: var(--color-brand-dark) !important;
}

.wc-block-components-button.outlined {
	border: 2px solid var(--color-anthracite);
	color: var(--color-anthracite);
}

.wc-block-components-button:focus-visible,
.wc-block-components-text-input input:focus,
.wc-block-components-combobox .wc-block-components-combobox-control input:focus,
.wc-blocks-components-select select:focus {
	outline: var(--focus-ring) !important;
	outline-offset: 2px;
	box-shadow: none !important;
}

/* Eingabefelder */
.wc-block-components-text-input input,
.wc-block-components-combobox .wc-block-components-combobox-control input,
.wc-blocks-components-select .wc-blocks-components-select__select,
.wc-block-components-textarea {
	border: 1px solid var(--color-border-strong) !important;
	border-radius: var(--radius-sm) !important;
	background: var(--color-surface) !important;
	color: var(--color-text) !important;
	font-family: var(--font-body) !important;
}

.wc-block-components-text-input label,
.wc-blocks-components-select__label {
	color: var(--color-text-muted) !important;
}

/* Auswahlfelder (Versand, Zahlung) */
.wc-block-components-radio-control__option,
.wc-block-components-radio-control-accordion-option {
	border-radius: var(--radius-sm);
}

.wc-block-components-radio-control__input:checked,
.wc-block-components-checkbox__input[type="checkbox"]:checked {
	border-color: var(--color-brand) !important;
	background-color: var(--color-brand) !important;
}

.wc-block-components-radio-control__input:checked::before {
	background: var(--color-surface) !important;
}

/* Überschriften der Blöcke in Bebas Neue */
.wc-block-components-title.wc-block-components-title,
.wc-block-cart__totals-title,
.wc-block-components-checkout-step__title {
	font-family: var(--font-display) !important;
	font-size: var(--fs-xl) !important;
	font-weight: 400 !important;
	line-height: 1 !important;
	letter-spacing: var(--tracking-display);
	text-transform: none !important;
	color: var(--color-anthracite);
}

/* Produktnamen sind teils <h3> – die Theme-Überschriftenschrift dort zurücksetzen */
.wc-block-components-product-name {
	color: var(--color-text);
	font-family: var(--font-body) !important;
	font-size: var(--fs-sm) !important;
	font-weight: var(--fw-semibold);
	line-height: var(--lh-tight);
	letter-spacing: normal;
	text-decoration: none;
	text-transform: none;
}

.wc-block-components-product-name:hover {
	color: var(--color-brand);
}

.wc-block-components-product-badge {
	border-color: var(--color-brand) !important;
	border-radius: var(--radius-pill) !important;
	color: var(--color-brand) !important;
}

.wc-block-components-sale-badge {
	background: var(--color-brand) !important;
	border-color: var(--color-brand) !important;
	color: var(--color-text-inverse) !important;
}

.wc-block-components-formatted-money-amount,
.wc-block-components-totals-item__value {
	font-variant-numeric: tabular-nums;
}

/* Mengenauswahl im Warenkorb */
.wc-block-components-quantity-selector {
	border-color: var(--color-border-strong) !important;
	border-radius: var(--radius-sm) !important;
}

.wc-block-components-quantity-selector::after {
	border: 0 !important;
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
	min-width: 40px;
	color: var(--color-anthracite);
}

/* ---------- Warenkorb ---------- */

.wc-block-cart .wc-block-cart__main,
.wc-block-cart .wc-block-cart__sidebar,
.wc-block-checkout .wc-block-checkout__main {
	padding: var(--wc-card-pad);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
}

.wc-block-cart .wc-block-cart__sidebar,
.wc-block-checkout .wc-block-checkout__sidebar {
	align-self: start;
}

/* Die Bestellübersicht der Kasse hat bereits einen eigenen Rahmen – nur Fläche und Radius angleichen */
.wc-block-checkout .wc-block-components-checkout-order-summary__content,
.wc-block-checkout .wp-block-woocommerce-checkout-order-summary-block {
	border-color: var(--color-border) !important;
	border-radius: var(--radius-lg) !important;
	background: var(--color-surface);
}

.wc-block-cart-items th,
.wc-block-cart-items__header {
	font-size: var(--fs-xs) !important;
	font-weight: var(--fw-bold);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.wc-block-cart-items td {
	border-color: var(--color-border) !important;
}

.wc-block-cart-item__image img {
	border-radius: var(--radius-sm);
	background: var(--color-surface);
}

.wc-block-cart-item__remove-link {
	color: var(--color-text-muted) !important;
	font-size: var(--fs-sm) !important;
}

.wc-block-components-totals-wrapper {
	border-color: var(--color-border) !important;
}

.wc-block-components-totals-footer-item {
	font-size: var(--fs-lg);
}

/* Leerer Warenkorb */
.wp-block-woocommerce-empty-cart-block {
	padding: var(--space-6) var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	text-align: center;
}

.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title {
	font-family: var(--font-display);
	font-size: var(--fs-h3);
	color: var(--color-anthracite);
}

.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title::before {
	background-color: var(--color-text-muted);
}

/* Produktempfehlungen im Warenkorb (Block „Product Collection“) */
.page--wc .wp-block-woocommerce-product-collection .wp-block-heading {
	font-family: var(--font-display);
	font-size: var(--fs-h3);
	font-weight: 400;
	color: var(--color-anthracite);
}

.page--wc .wc-block-product-template {
	gap: var(--space-4) !important;
}

.page--wc .wc-block-product {
	padding: var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
}

.page--wc .wc-block-product .wp-block-post-title a {
	color: var(--color-text);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semibold);
	text-decoration: none;
}

.page--wc .wp-block-button__link {
	border-radius: var(--radius-sm);
	background: var(--color-brand);
	color: var(--color-text-inverse);
	font-weight: var(--fw-bold);
}

/* ---------- Kasse ---------- */

.wc-block-components-checkout-step {
	padding-bottom: var(--space-2);
}

.wc-block-components-checkout-step__container::after {
	background: var(--color-border) !important;
}

.wc-block-components-checkout-step__heading-content,
.wc-block-components-checkout-step__description {
	color: var(--color-text-muted);
}

.wc-block-checkout__terms {
	font-size: var(--fs-sm);
	color: var(--color-text-muted);
}

.wc-block-components-checkout-return-to-cart-button {
	color: var(--color-anthracite) !important;
}

/* ---------- Mein Konto (klassisch) ---------- */

.woocommerce-account .page__content > .woocommerce {
	display: grid;
	gap: var(--space-5);
}

/* Anmeldung */
.woocommerce-form-login,
.woocommerce-form-register,
.woocommerce-ResetPassword,
.woocommerce-EditAccountForm,
.woocommerce-address-fields {
	display: grid;
	gap: var(--space-4);
	max-width: 32rem;
	margin: 0;
	padding: var(--space-5);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
}

.woocommerce-account .page__content h2 {
	margin-bottom: var(--space-3);
	color: var(--color-anthracite);
	font-size: var(--fs-h3);
}

.woocommerce form .form-row {
	display: grid;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
}

.woocommerce form .form-row label {
	font-weight: var(--fw-semibold);
}

.woocommerce form .form-row .required {
	color: var(--color-brand);
	text-decoration: none;
}

.woocommerce form .input-text,
.woocommerce form select,
.woocommerce form textarea {
	width: 100%;
	min-height: var(--control-h);
	padding: var(--space-2) var(--space-4);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text);
}

.woocommerce form .input-text:focus-visible,
.woocommerce form select:focus-visible,
.woocommerce form textarea:focus-visible {
	outline: var(--focus-ring);
	outline-offset: 0;
	border-color: var(--color-focus);
}

.woocommerce form .password-input {
	position: relative;
	display: block;
}

.woocommerce form .show-password-input {
	position: absolute;
	top: 0;
	right: 0;
	width: var(--control-h);
	height: var(--control-h);
	border: 0;
	background: transparent;
	color: var(--color-text-muted);
}

.woocommerce form .show-password-input::after {
	content: "👁";
	font-size: 1.1rem;
}

.woocommerce-form-login__rememberme,
.woocommerce-form__label-for-checkbox {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	min-height: var(--tap);
	font-weight: var(--fw-regular) !important;
}

.woocommerce-form-login__rememberme input,
.woocommerce-form__label-for-checkbox input {
	width: 20px;
	height: 20px;
	accent-color: var(--color-brand);
}

.woocommerce-form-login .form-row:has(.woocommerce-form-login__submit) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
}

.woocommerce-LostPassword a,
.lost_password a {
	display: inline-flex;
	align-items: center;
	min-height: var(--tap);
}

/* Navigation im Konto */
.woocommerce-MyAccount-navigation ul {
	display: flex;
	gap: var(--space-2);
	margin: 0;
	padding: 0 0 var(--space-2);
	list-style: none;
	overflow-x: auto;
	scrollbar-width: thin;
}

.woocommerce-MyAccount-navigation a {
	display: inline-flex;
	align-items: center;
	min-height: var(--tap);
	padding: 0 var(--space-4);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-pill);
	background: var(--color-surface);
	color: var(--color-text);
	font-weight: var(--fw-semibold);
	white-space: nowrap;
	text-decoration: none;
}

.woocommerce-MyAccount-navigation a:hover {
	border-color: var(--color-brand);
	color: var(--color-brand);
}

.woocommerce-MyAccount-navigation .is-active a {
	border-color: var(--color-anthracite);
	background: var(--color-anthracite);
	color: var(--color-text-inverse);
}

.woocommerce-MyAccount-content {
	display: grid;
	gap: var(--space-4);
	min-width: 0;
	padding: var(--space-5);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
}

.woocommerce-MyAccount-content > p:first-child {
	font-size: var(--fs-md);
}

/* Tabellen (Bestellungen, Bestelldetails) */
.woocommerce table.shop_table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--fs-sm);
}

.woocommerce table.shop_table th,
.woocommerce table.shop_table td {
	padding: var(--space-3) var(--space-2);
	border-bottom: 1px solid var(--color-border);
	text-align: left;
	vertical-align: top;
}

.woocommerce table.shop_table thead th {
	font-size: var(--fs-xs);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--color-text-muted);
}

/* Mobil: Tabellenzeilen als Karten (WooCommerce setzt data-title) */
@media (max-width: 767px) {
	.woocommerce table.shop_table_responsive thead {
		display: none;
	}

	.woocommerce table.shop_table_responsive tr {
		display: grid;
		padding-block: var(--space-2);
		border-bottom: 1px solid var(--color-border);
	}

	.woocommerce table.shop_table_responsive td,
	.woocommerce table.shop_table_responsive th {
		display: flex;
		justify-content: space-between;
		gap: var(--space-4);
		padding: var(--space-1) 0;
		border: 0;
	}

	.woocommerce table.shop_table_responsive td::before {
		content: attr(data-title);
		font-weight: var(--fw-semibold);
	}
}

/* Adressen */
.woocommerce-Addresses {
	display: grid;
	gap: var(--space-4);
}

.woocommerce-Address {
	padding: var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.woocommerce-Address-title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
}

.woocommerce-Address address {
	font-style: normal;
}

fieldset {
	margin: 0;
	padding: 0;
	border: 0;
}

legend {
	margin-bottom: var(--space-3);
	font-family: var(--font-display);
	font-size: var(--fs-xl);
	color: var(--color-anthracite);
}

/* Mobil braucht die Artikel-Tabelle des Warenkorbs die volle Breite – dort ohne Karte */
@media (max-width: 767px) {
	.wc-block-cart .wc-block-cart__main {
		padding: 0;
		border: 0;
		background: transparent;
	}
}

/* Schmaler Warenkorb: feste Spalten von WooCommerce (80/132/76 px) flexibel machen */
.wc-block-cart.is-mobile .wc-block-cart-items__row {
	grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) auto;
	column-gap: var(--space-3);
}

.wc-block-components-sale-badge {
	white-space: normal !important;
	text-align: center;
}

/* ---------- Tablet / Desktop ---------- */

@media (min-width: 768px) {
	.page--wc {
		--wc-card-pad: var(--space-5);
	}

	.woocommerce-Addresses {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.woocommerce-account.logged-in .page__content > .woocommerce {
		grid-template-columns: 240px minmax(0, 1fr);
		align-items: start;
	}

	.woocommerce-MyAccount-navigation ul {
		flex-direction: column;
		overflow: visible;
	}

	.woocommerce-MyAccount-navigation a {
		width: 100%;
		border-radius: var(--radius-sm);
	}

	.woocommerce-account:not(.logged-in) .page__content > .woocommerce {
		grid-template-columns: minmax(0, 32rem);
	}
}
