/**
 * Visuelle Integration von Warenkorb/Checkout (Phase 3A) in das
 * bestehende Designsystem.
 *
 * WICHTIG: Warenkorb- und Checkout-Seite sind bei diesem Shop bereits als
 * WooCommerce CART/CHECKOUT BLOCKS eingerichtet (Gutenberg-Block-Inhalt
 * auf den Seiten "warenkorb"/"kasse", kein klassisches Shortcode-
 * Template). Deshalb ausschliesslich REINES CSS gegen die eigenen,
 * stabilen/offiziellen WooCommerce-Blocks-Klassennamen (wc-block-*,
 * ermittelt aus den mitgelieferten Blocks-Stylesheets) - keine
 * Template-Overrides, keine Checkout-Feldlogik, keine eigene Checkout-
 * Engine. WooCommerce bleibt vollstaendig fuer Felder/Validierung/
 * Preisberechnung/Versand/Zahlung zustaendig, hier wird ausschliesslich
 * die Optik an Typografie/Farben/Abstaende/Buttons des bestehenden
 * Shops angeglichen.
 *
 * Sticky Bestelluebersicht (Abschnitt 4) nutzt WooCommerce's EIGENE,
 * native "is-sticky"-Unterstuetzung des Checkout-Blocks (Sidebar-Layout-
 * Einstellung im Block-Editor) - siehe Abschlussbericht, ob/wie aktiv.
 */

body.woocommerce-checkout .tdc-main,
body.woocommerce-cart .tdc-main {
	background: var(--tdc-bg-soft);
	padding: var(--tdc-space-xl) 0;
}

/*
 * Bugfix "Kasse"-Titel verrutscht/abgeschnitten: Warenkorb/Checkout haben
 * kein eigenes Theme-Template (kein page-kasse.php/page-warenkorb.php),
 * WordPress faellt deshalb auf Astras eigenes page.php zurueck. Astras
 * page.php erwartet die von astra_content_top()/astra_content_before()
 * geoeffneten Wrapper-Divs (u. a. .ast-container) - die liefert normal
 * Astras eigenes header.php. Unser eigenes header.php ersetzt Astras
 * Header bewusst vollstaendig (Architekturvorgabe) und ruft diese
 * Astra-spezifische Funktion nicht auf, wodurch .entry-header/.entry-
 * title (die native "Kasse"/"Warenkorb"-Ueberschrift) ganz ohne
 * Breitenbeschraenkung rendert (Astras .ast-container selbst ist nur
 * "max-width:100%" - die eigentliche Breite kommt von den fehlenden
 * Wrapper-Divs) waehrend die Checkout-/Cart-Bloecke darunter bereits
 * bewusst auf --tdc-container begrenzt sind - daher der sichtbare
 * Versatz. Fix: dieselbe Breite/denselben Gutter wie den Rest des
 * Checkouts geben, statt eine fehlende Astra-Funktion nachzubauen.
 */
body.woocommerce-checkout .entry-header,
body.woocommerce-cart .entry-header {
	max-width: var(--tdc-container);
	margin: 0 auto var(--tdc-space-lg);
	padding: 0 var(--tdc-gutter);
	box-sizing: border-box;
}
body.woocommerce-checkout .entry-title,
body.woocommerce-cart .entry-title {
	font-size: clamp(28px, 4vw, 44px);
	line-height: 1.15;
	font-weight: 700;
	margin: 0;
}

/* Max-Breite/Gutter wie .tdc-container, statt WordPress' generischem "alignwide". */
.wp-block-woocommerce-checkout.alignwide,
.wp-block-woocommerce-cart.alignwide {
	max-width: var(--tdc-container);
	margin: 0 auto;
	padding: 0 var(--tdc-gutter);
}

/* Grundtypografie/-farben innerhalb der Blocks an das Shop-Designsystem angleichen. */
body.woocommerce-checkout .wp-block-woocommerce-checkout,
body.woocommerce-cart .wp-block-woocommerce-cart {
	font-family: var(--tdc-font);
	color: var(--tdc-text);
}
body.woocommerce-checkout .wc-block-components-checkout-order-summary__title-text,
body.woocommerce-cart .wc-block-cart__totals-title,
body.woocommerce-checkout .wc-block-components-title,
body.woocommerce-cart .wc-block-components-title {
	font-weight: 700 !important;
}

/* Karten/Panels: Formularabschnitte, Bestelluebersicht - einheitlicher Rahmen/Radius wie im uebrigen Shop statt WooCommerce's Standard-Grauton. */
body.woocommerce-checkout .wc-block-components-panel,
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block,
body.woocommerce-cart .wc-block-components-panel,
body.woocommerce-cart .wc-block-cart-items,
body.woocommerce-cart .wc-block-components-totals-wrapper {
	border-color: var(--tdc-border) !important;
	border-radius: var(--tdc-radius-lg) !important;
}
body.woocommerce-checkout .wc-block-checkout__main,
body.woocommerce-checkout .wc-block-checkout__sidebar > *,
body.woocommerce-cart .wc-block-cart-items,
body.woocommerce-cart .wc-block-cart__sidebar > * {
	background: var(--tdc-white);
	border: 1px solid var(--tdc-border);
	border-radius: var(--tdc-radius-lg);
	padding: var(--tdc-space-lg);
}
body.woocommerce-checkout .wc-block-checkout__sidebar > *,
body.woocommerce-cart .wc-block-cart__sidebar > * {
	margin-bottom: var(--tdc-space-md);
}

/* Formularfelder: gleiche Optik wie das uebrige Shop-Formular-Styling (Suche, Grössenfinder etc.). */
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-text-input textarea,
body.woocommerce-checkout .wc-block-components-address-form select,
body.woocommerce-checkout select.wc-block-components-select-input,
body.woocommerce-cart .wc-block-components-text-input input {
	border: 1px solid var(--tdc-border) !important;
	border-radius: var(--tdc-radius) !important;
	font-family: var(--tdc-font);
}
body.woocommerce-checkout .wc-block-components-text-input input:focus,
body.woocommerce-checkout select.wc-block-components-select-input:focus {
	border-color: var(--tdc-black) !important;
	box-shadow: 0 0 0 1px var(--tdc-black) !important;
	outline: none;
}
body.woocommerce-checkout .wc-block-components-text-input label,
body.woocommerce-checkout .wc-block-components-address-form label {
	font-family: var(--tdc-font);
}

/* Versandmethoden-Auswahl: aktive Option klar erkennbar, nicht nur Farbe (Accessibility, Abschnitt 25). */
body.woocommerce-checkout .wc-block-components-radio-control__option {
	border: 1px solid var(--tdc-border) !important;
	border-radius: var(--tdc-radius) !important;
}
body.woocommerce-checkout .wc-block-components-radio-control__option-checked {
	border-color: var(--tdc-black) !important;
	background: var(--tdc-bg-soft);
}

/* Buttons: dieselbe Optik wie .tdc-btn-primary (schwarz, kompakt) statt WooCommerce's Standard-Lila/-Blau. */
body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:visited,
body.woocommerce-cart .wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-cart__submit-button:visited,
body.woocommerce-checkout .wc-block-components-totals-coupon__button,
body.woocommerce-cart .wc-block-components-totals-coupon__button {
	background: var(--tdc-black) !important;
	color: var(--tdc-white) !important;
	border-color: var(--tdc-black) !important;
	border-radius: var(--tdc-radius) !important;
	font-family: var(--tdc-font);
	font-weight: 700 !important;
	box-shadow: none !important;
}
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:focus,
body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-cart .wc-block-cart__submit-button:focus {
	background: #222 !important;
}

/* Zwischensumme/Versand/Steuer/Gesamt (Abschnitt 13): klare Trennung, Gesamt optisch hervorgehoben. */
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
	font-weight: 700 !important;
	font-size: 17px;
}

/* Zeilenprodukte im Warenkorb/Checkout: Produktname klar, Item-Data (Kartons/Rollen/Preis pro Rolle aus TDC_Cart_Pricing) dezent darunter statt technisch wirkend. */
body.woocommerce-checkout .wc-block-components-product-metadata__variation-data,
body.woocommerce-cart .wc-block-components-product-metadata__variation-data {
	font-size: 13px;
	color: var(--tdc-muted);
}

/* Fehler-/Hinweisboxen: Rot als Akzent statt WooCommerce-Standardrot, konsistent mit dem uebrigen Shop. */
body.woocommerce-checkout .wc-block-components-notice-banner.is-error,
body.woocommerce-cart .wc-block-components-notice-banner.is-error {
	border-left-color: var(--tdc-red) !important;
}

/* ==========================================================================
   Responsive (Abschnitt 5/26) - WooCommerce steuert die grundsaetzliche
   Umbruchlogik bereits selbst per CSS Container Queries (main/sidebar),
   hier nur zusaetzliche Abstands-/Breiten-Korrekturen fuer kleine Breiten.
   ========================================================================== */
@media (max-width: 680px) {
	body.woocommerce-checkout .tdc-main,
	body.woocommerce-cart .tdc-main {
		padding: var(--tdc-space-md) 0;
	}
	.wp-block-woocommerce-checkout.alignwide,
	.wp-block-woocommerce-cart.alignwide {
		padding: 0 var(--tdc-gutter);
	}
	body.woocommerce-checkout .wc-block-checkout__main,
	body.woocommerce-checkout .wc-block-checkout__sidebar > *,
	body.woocommerce-cart .wc-block-cart-items,
	body.woocommerce-cart .wc-block-cart__sidebar > * {
		padding: var(--tdc-space-md);
	}
	body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
	body.woocommerce-cart .wc-block-cart__submit-button {
		width: 100%;
	}
}
