/* ==================================================================
 * Tu Felix Austria – Produktseite (WooCommerce)
 * Wird nur auf Produktseiten geladen (siehe functions.php).
 * Das Standard-CSS von WooCommerce hat höhere Spezifität: darum die doppelte
 * Klasse .tfa-product-summary.tfa-product-summary bzw. !important an den
 * Stellen, wo WooCommerce sonst gewinnt.
 * ================================================================== */

.tfa-product-layout {
	align-items: flex-start;
}

/* Überzeile und H1 aus [tfa_product_heading] */
.tfa-product-eyebrow {
	margin-block-end: 0;
}

.tfa-product-eyebrow a {
	color: inherit;
	text-decoration: none;
}

.tfa-product-title {
	margin-block-start: 0.5rem;
}

/* Preis mit Hinweis daneben */
.tfa-price-row {
	align-items: baseline !important;
	gap: 0.25rem 0.75rem;
	margin-block-start: 1rem;
}

.tfa-price-row > * {
	margin: 0;
}

.tfa-price-note {
	font-size: var(--wp--preset--font-size--x-small);
}

.tfa-price-note a {
	color: inherit;
}

.tfa-product-summary form.cart {
	margin-block-start: 2rem;
}

/* ------------------------------------------------------------------
 * Varianten: Tabelle von WooCommerce als Blöcke darstellen
 * ---------------------------------------------------------------- */
.tfa-product-summary.tfa-product-summary form.cart table.variations,
.tfa-product-summary.tfa-product-summary form.cart table.variations tbody,
.tfa-product-summary.tfa-product-summary form.cart table.variations :is(th, td) {
	display: block;
	width: 100%;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none;
}

.tfa-product-summary.tfa-product-summary form.cart table.variations :is(th.label, td.value) {
	line-height: 1.4;
	text-align: left;
}

.tfa-product-summary.tfa-product-summary form.cart table.variations tr {
	display: block;
	position: relative;
	width: 100%;
	margin: 0 0 2.25rem !important;
	padding: 0 !important;
	border: 0;
	background: none;
}

.tfa-product-summary.tfa-product-summary form.cart table.variations th.label label {
	display: block;
	margin: 0 0 0.5rem !important;
	padding: 0 !important;
	font-size: 0.85rem !important;
	font-weight: 400 !important;
	line-height: 1.4 !important;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	opacity: 0.8;
}

.tfa-select-native,
.tfa-product-summary .reset_variations {
	display: none !important;
}

.tfa-sizelink {
	position: absolute;
	top: 0;
	right: 0;
	font-size: var(--wp--preset--font-size--x-small);
	color: inherit;
}

/* Auswahlkacheln (Radio-Buttons) */
.tfa-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.tfa-product-summary form.cart .tfa-swatches {
	margin: 0 !important;
}

.tfa-swatch {
	position: relative;
	display: block;
	cursor: pointer;
}

.tfa-product-summary.tfa-product-summary form.cart .tfa-swatch,
.tfa-product-summary.tfa-product-summary form.cart .tfa-swatch__text {
	margin: 0;
	line-height: 1.4;
}

.tfa-product-summary form.cart .tfa-swatch__text {
	font-weight: 300 !important;
}

.tfa-swatch input[type="radio"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

/* Farbe: Kreis mit Ring bei Auswahl */
.tfa-swatch--color,
.tfa-swatches--color .tfa-swatch {
	display: grid;
	place-items: center;
	width: var(--wp--custom--min-target);
	height: var(--wp--custom--min-target);
	border: 0.125rem solid transparent;
	border-radius: 50%;
	box-sizing: border-box;
	transition: border-color 0.3s ease;
}

.tfa-swatches--color .tfa-swatch:hover {
	border-color: rgb(47 58 42 / 0.4);
}

.tfa-swatches--color .tfa-swatch:has(input:checked) {
	border-color: var(--wp--preset--color--textgruen);
}

.tfa-swatch__dot {
	display: block;
	width: 1.875rem;
	height: 1.875rem;
	border-radius: 50%;
	background: var(--swatch, var(--wp--preset--color--salbei));
	box-shadow: 0 0 0 var(--wp--custom--hairline) rgb(47 58 42 / 0.25);
}

.tfa-swatch--braun .tfa-swatch__dot {
	--swatch: #5b3a29;
}

.tfa-swatch--gruen .tfa-swatch__dot,
.tfa-swatch--grun .tfa-swatch__dot {
	--swatch: var(--wp--preset--color--gruen);
}

/* Größe, Schriftzug u. a.: rechteckige Kachel */
.tfa-swatch__text {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: var(--wp--custom--min-target);
	min-height: var(--wp--custom--min-target);
	padding: 0 1rem;
	border: var(--wp--custom--hairline) solid rgb(47 58 42 / 0.25);
	border-radius: 0.125rem;
	background: var(--wp--preset--color--weiss);
	font-size: var(--wp--preset--font-size--small);
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.tfa-swatch:hover .tfa-swatch__text {
	border-color: var(--wp--preset--color--textgruen);
}

.tfa-swatch input:checked + .tfa-swatch__text {
	border-color: var(--wp--preset--color--textgruen);
	background: var(--wp--preset--color--textgruen);
	color: var(--wp--preset--color--creme-hell);
}

.tfa-swatch:has(input:focus-visible) {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--rot);
	outline-offset: var(--wp--custom--focus--offset);
}

.tfa-swatch:has(input:disabled) {
	opacity: 0.35;
	cursor: not-allowed;
}

.tfa-swatch:has(input:disabled) input,
.tfa-swatch:has(input:disabled) .tfa-swatch__text {
	cursor: not-allowed;
	text-decoration: line-through;
}

/* ------------------------------------------------------------------
 * Anzahl: Dropdown mit "Stück". Das Mengenfeld von WooCommerce wird
 * ausgeblendet, sobald das Dropdown da ist; sonst (z. B. Einzelverkauf)
 * bleibt es als Fallback gestaltet.
 * ---------------------------------------------------------------- */
form.cart:has(.tfa-qty) .quantity,
.tfa-qty ~ .quantity {
	display: none !important;
}

.tfa-product-summary.tfa-product-summary form.cart div.quantity {
	float: none;
	margin: 0 0 1rem;
}

.tfa-product-summary.tfa-product-summary form.cart div.quantity .qty {
	box-sizing: border-box;
	width: 5rem;
	min-height: var(--wp--custom--min-target);
	padding: 0.5rem;
	border: var(--wp--custom--hairline) solid rgb(47 58 42 / 0.45);
	border-radius: 0.125rem;
	background: var(--wp--preset--color--weiss);
	color: inherit;
	font: inherit;
	text-align: center;
}

.tfa-qty {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0 0 1.5rem;
}

.tfa-qty__field {
	position: relative;
}

.tfa-qty__select {
	appearance: none;
	box-sizing: border-box;
	width: 6rem;
	min-height: var(--wp--custom--min-target);
	margin: 0;
	padding: 0.5rem 2.5rem 0.5rem 1rem;
	border: var(--wp--custom--hairline) solid rgb(47 58 42 / 0.45);
	border-radius: 0.125rem;
	background-color: var(--wp--preset--color--weiss);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232F3A2A' stroke-width='1.25'/%3E%3C/svg%3E");
	background-position: right 1rem center;
	background-repeat: no-repeat;
	background-size: 0.75rem 0.5rem;
	color: inherit;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	cursor: pointer;
	transition: border-color 0.3s ease;
}

.tfa-qty__select:hover,
.tfa-qty__select:focus {
	border-color: var(--wp--preset--color--textgruen);
}

.tfa-qty__unit {
	font-size: var(--wp--preset--font-size--small);
}

/* ------------------------------------------------------------------
 * Warenkorb-Button: eckig, Hover in Rot
 * ---------------------------------------------------------------- */
.tfa-product-summary .woocommerce-variation-add-to-cart {
	display: block;
}

.tfa-product-summary.tfa-product-summary form.cart .single_add_to_cart_button {
	float: none;
	width: 100%;
	min-height: 3.5rem;
	margin: 0;
	border-radius: 0 !important;
}

.tfa-product-summary.tfa-product-summary form.cart .single_add_to_cart_button:not(.disabled):not(:disabled):hover,
.tfa-product-summary.tfa-product-summary form.cart .single_add_to_cart_button:not(.disabled):not(:disabled):focus-visible {
	background: var(--wp--preset--color--rot) !important;
	color: var(--wp--preset--color--creme-hell) !important;
}

.tfa-product-summary .single_add_to_cart_button.disabled,
.tfa-product-summary .single_add_to_cart_button:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.tfa-product-summary .woocommerce-variation-price,
.tfa-product-summary .woocommerce-variation-description {
	display: none;
}

.tfa-product-summary .woocommerce-variation-availability p {
	margin-block: 0 1rem;
	font-size: var(--wp--preset--font-size--x-small);
}

/* ------------------------------------------------------------------
 * Produktgalerie: großes Bild mit Rahmen, Vorschaubilder darunter
 * ---------------------------------------------------------------- */
.tfa-product-layout .woocommerce-product-gallery {
	float: none !important;
	width: 100% !important;
	margin: 0 !important;
}

.woocommerce-product-gallery__trigger {
	display: none;
}

.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery__wrapper {
	border: var(--wp--custom--hairline) solid rgb(47 58 42 / 0.12);
}

.woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__wrapper {
	border: 0;
}

.woocommerce-product-gallery__image img {
	display: block;
	width: 100%;
	height: auto;
}

.woocommerce-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.75rem;
	margin: 1rem 0 0 !important;
	padding: 0 !important;
	list-style: none;
}

.woocommerce-product-gallery .flex-control-thumbs li {
	float: none !important;
	width: auto !important;
	margin: 0;
}

.woocommerce-product-gallery .flex-control-thumbs img {
	display: block;
	width: 100%;
	height: auto;
	border: var(--wp--custom--hairline) solid rgb(47 58 42 / 0.12);
	opacity: 1 !important;
	cursor: pointer;
	transition: outline-color 0.3s ease;
}

.woocommerce-product-gallery .flex-control-thumbs img.flex-active {
	outline: 0.125rem solid var(--wp--preset--color--textgruen);
	outline-offset: -0.125rem;
}

@media (max-width: 48rem) {
	.woocommerce-product-gallery .flex-control-thumbs {
		gap: 0.5rem;
	}
}
