/*!
 * DieWeedBox Design System – Mobile-Bedienung (seitenweit, ≤ 1024px)
 * 0.2.1: kritische Touch-Ziele und Überdeckungen.
 *
 * Nur Größe/Trefferfläche/Stapelung – keine Farben, keine Texte, nichts ausgeblendet.
 * Ladereihenfolge im Plugin: footer → mobile → woocommerce → Seiten-Layer.
 * woocommerce.css lädt NACH dieser Datei, daher hier teils spezifischere Selektoren.
 * Ziel: jedes Bedienelement ≥ --dwb-ds-control-h (44px, WCAG 2.5.5) und nicht dauerhaft verdeckt.
 */

/* =====================================================================
 * 1. Fixe Bottom-Navigation (Plugin dieweedbox-mobile-shop-ui, nur ≤ 767px)
 *    nav.dwb-mui__bottom: bottom 9px + 89px hoch = 98px. Ohne Abstand liegt das
 *    Seitenende (Footer-Logo-Link, Warenkorb „Zur Kasse“) dauerhaft darunter.
 *    2 × 44 + 12 = 100px ≥ 98px, plus iOS-Home-Indikator.
 * ===================================================================== */
@media (max-width: 767px) {
	/* Abstand im (dunklen) Elementor-Footer statt am Body → kein weißer Streifen am Seitenende */
	body.dwbds-on:has(.dwb-mui__bottom) .elementor-location-footer {
		background-color: var(--dwb-ds-deep); /* Footer-Sektionen sind schwarz; Abstandsfläche gleich einfärben */
		padding-bottom: calc(var(--dwb-ds-control-h) * 2 + var(--dwb-ds-space-3) + env(safe-area-inset-bottom));
	}

	/* Mystery Box Classic: Live-Regel der Mobile-UI setzt die CommerceKit-Sticky-Leiste
	   (75px) auf bottom:106px – Seitenende braucht 106 + 75 = 181px Luft.
	   4 × 44 + 12 = 188px. Route-gebunden wie die Original-Regel (css-dwb-mui-css). */
	body.dwbds-on.postid-25684:has(.dwb-mui__bottom) .elementor-location-footer {
		padding-bottom: calc(var(--dwb-ds-control-h) * 4 + var(--dwb-ds-space-3) + env(safe-area-inset-bottom));
	}

	/* Filter-Drawer (Shoptimizer #secondary, z-index 102) und das darin verschachtelte
	   WooCommerce-Filter-Overlay lagen UNTER der Bottom-Nav (z-index 2147482999):
	   „Anwenden“ und die letzten Checkboxen waren nicht antippbar.
	   Offener Drawer = modaler Dialog → über die Nav heben (Wert = .dwb-mui__sheet). */
	body.dwbds-on.filter-open #secondary.widget-area {
		z-index: 2147483000;
	}

	/* Mobile-Menü-Sheet: Such-Button 20×20 → 44×44 (negativer Rand hält die Pillenhöhe) */
	body.dwbds-on .dwb-mui__search button {
		min-width: var(--dwb-ds-control-h);
		min-height: var(--dwb-ds-control-h);
		margin: calc(var(--dwb-ds-space-3) * -1) calc(var(--dwb-ds-space-3) * -1) calc(var(--dwb-ds-space-3) * -1) 0;
	}
	body.dwbds-on .dwb-mui__search input {
		min-height: var(--dwb-ds-control-h);
	}
	/* „Alles anzeigen“ / „Alle Aktionen“ (18px hoch) */
	body.dwbds-on .dwb-mui__head a {
		min-height: var(--dwb-ds-control-h);
		margin-block: calc(var(--dwb-ds-space-3) * -1);
	}
}

/* =====================================================================
 * 2. Touch-Ziele seitenweit (Smartphone + Tablet)
 * ===================================================================== */
@media (max-width: 1024px) {

	/* Header-Logo (88×22): Trefferfläche vertikal erweitern, Layout unverändert */
	body.dwbds-on .site-branding a.custom-logo-link {
		display: inline-block;
		padding-block: var(--dwb-ds-space-3);
		margin-block: calc(var(--dwb-ds-space-3) * -1);
	}

	/* Elementor-Buttons (z. B. „Jetzt erstellen“ 39px) */
	body.dwbds-on a.elementor-button,
	body.dwbds-on button.elementor-button {
		min-height: var(--dwb-ds-control-h);
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	/* Elementor-Toggle/Accordion-Titel (FAQ, 40px) */
	body.dwbds-on .elementor-toggle .elementor-tab-title,
	body.dwbds-on .elementor-accordion .elementor-tab-title {
		min-height: var(--dwb-ds-control-h);
	}

	/* Einzelne Text-Links, die als Bedienelement stehen: Trefferfläche über Padding
	   (inline-block statt flex – Leerzeichen zwischen Text und <span> bleiben erhalten).
	   (44px − 1 Zeilenhöhe) / 2 oben und unten. */
	body.dwbds-on a.dwb-product-link,
	body.dwbds-on .woocommerce-review-link,
	body.dwbds-on a.shipping-calculator-button,
	body.dwbds-on #secondary li.cat-item > a,
	body.dwbds-on #secondary .wc-layered-nav-rating > a,
	body.dwbds-on #secondary .wc-layered-nav-term > a {
		display: inline-block;
		padding-block: calc((var(--dwb-ds-control-h) - 1lh) / 2);
	}
	/* Review-Link und Versandrechner: Fläche wächst, Zeilenhöhe der Umgebung nicht */
	body.dwbds-on .woocommerce-product-rating .woocommerce-review-link,
	body.dwbds-on a.shipping-calculator-button {
		margin-block: calc((var(--dwb-ds-control-h) - 1lh) / -2);
	}

	/* Footer-Formular (Widerruf, 40px Felder) – nur Höhe */
	body.dwbds-on [data-elementor-type="footer"] .woocommerce-input-wrapper .input-text,
	body.dwbds-on .elementor-location-footer .woocommerce-input-wrapper .input-text {
		min-height: var(--dwb-ds-control-h);
	}

	/* ---- Shop / Kategorie ---- */
	body.dwbds-on button.mobile-filter.shoptimizer-mobile-toggle,
	body.dwbds-on .woocommerce-ordering select.orderby {
		min-height: var(--dwb-ds-control-h);
	}
	body.dwbds-on .woocommerce-pagination ul.page-numbers li .page-numbers {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: var(--dwb-ds-control-h);
		min-height: var(--dwb-ds-control-h);
	}

	/* Filter-Drawer (Shoptimizer): Kategorie-/Bewertungs-Links siehe oben.
	   Unterkategorie-Toggle (18px-Kreis, absolut an top:1px) mit dem Link-Padding mitziehen
	   und Trefferfläche über ::after auf 44px erweitern (Icon liegt auf ::before). */
	body.dwbds-on #secondary li.cat-item > a > .shoptimizer-wc-cat-widget--toggle {
		top: calc((var(--dwb-ds-control-h) - 1lh) / 2);
	}
	body.dwbds-on #secondary .shoptimizer-wc-cat-widget--toggle::after {
		content: "";
		position: absolute;
		inset: calc(var(--dwb-ds-space-3) * -1 - 1px); /* 18 + 2 × 13 = 44px */
	}
	/* Schließen-Button des Drawers 40px */
	body.dwbds-on button.filters.close-drawer {
		min-width: var(--dwb-ds-control-h);
		min-height: var(--dwb-ds-control-h);
	}

	/* WooCommerce-Block-Filter (Overlay) */
	body.dwbds-on .wc-block-product-filters__open-overlay,
	body.dwbds-on .wc-block-product-filters__close-overlay {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: var(--dwb-ds-control-h);
		min-height: var(--dwb-ds-control-h);
	}
	body.dwbds-on .wc-block-product-filter-checkbox-list__label {
		display: flex;
		align-items: center;
		min-height: var(--dwb-ds-control-h);
	}
	body.dwbds-on .wc-block-product-filter-checkbox-list__show-more-button,
	body.dwbds-on .wc-block-product-filter-price-slider .text input[type="text"] {
		min-height: var(--dwb-ds-control-h);
	}

	/* ---- Produktseite ---- */
	/* Tabs (Beschreibung/Bewertungen, 23px) */
	body.dwbds-on .woocommerce-tabs ul.tabs li a {
		display: flex;
		align-items: center;
		min-height: var(--dwb-ds-control-h);
	}
	/* CommerceKit-Swatches (38px; Original setzt für .button-fluid min-height:auto mit 0,5,1) */
	body.dwbds-on .cgkit-as-wrap .cgkit-attribute-swatches .cgkit-attribute-swatch button.cgkit-swatch.button-fluid {
		min-height: var(--dwb-ds-control-h);
	}

	/* Mengen-Stepper: Pfeile 34×22 übereinander → zwei 44×44-Felder nebeneinander
	   [ Menge | ˅ | ˄ ]. Nur Geometrie; Klick-Handler (Shoptimizer) unverändert. */
	body.dwbds-on.single-product form.cart div.quantity.buttons_added {
		display: flex;
		margin-right: var(--dwb-ds-space-2);
	}
	body.dwbds-on.single-product form.cart div.quantity.buttons_added .quantity-nav {
		position: static;
		display: flex;
		width: auto;
		height: var(--dwb-ds-control-h);
	}
	body.dwbds-on.single-product form.cart div.quantity.buttons_added .quantity-button {
		position: relative;
		inset: auto;
		width: var(--dwb-ds-control-h);
		height: var(--dwb-ds-control-h);
		margin-block: -1px; /* über den 1px-Rahmen der Nav ziehen → volle 44px Trefferfläche */
	}
	body.dwbds-on.single-product form.cart div.quantity.buttons_added input.qty {
		width: var(--dwb-ds-control-h);
	}
	/* Shoptimizer: Button float + margin-left 40px + width calc(100% - 90px) → an breiteren Stepper anpassen */
	body.dwbds-on.single-product form.cart div.quantity.buttons_added ~ .single_add_to_cart_button {
		margin-left: 0;
		width: calc(100% - var(--dwb-ds-control-h) * 3 - var(--dwb-ds-space-4)); /* Stepper 132 + Rahmen + 8px Abstand */
	}
	body.dwbds-on.single-product form.cart div.quantity.buttons_added .quantity-down { order: 1; }
	body.dwbds-on.single-product form.cart div.quantity.buttons_added .quantity-up { order: 2; }

	/* ---- Warenkorb (nur Trefferflächen, keine Logik) ---- */
	/* Entfernen-Icon 14×14: unsichtbare 44px-Fläche über ::after (Icon liegt auf ::before) */
	body.dwbds-on table.cart td.product-remove a.remove {
		position: relative;
	}
	body.dwbds-on table.cart td.product-remove a.remove::after {
		content: "";
		position: absolute;
		inset: calc(var(--dwb-ds-space-4) * -1); /* 14 + 2 × 16 = 46px */
	}
	/* Menge im Warenkorb: [ − 44 | 1 | + 44 ] statt 26×25-Feldern */
	body.dwbds-on table.cart td.product-quantity div.quantity.buttons_added {
		width: auto;
		min-width: calc(var(--dwb-ds-control-h) * 3);
		height: auto;
		padding-block: 0;
		align-items: center;
	}
	body.dwbds-on table.cart td.product-quantity div.quantity .quantity-nav {
		inset: 0;
		width: auto;
		height: auto;
	}
	body.dwbds-on table.cart td.product-quantity div.quantity .quantity-button {
		top: 0;
		width: var(--dwb-ds-control-h);
		height: 100%;
	}
	body.dwbds-on table.cart td.product-quantity div.quantity .quantity-button.quantity-down { left: 0; right: auto; }
	body.dwbds-on table.cart td.product-quantity div.quantity .quantity-button.quantity-up { right: 0; left: auto; }
	/* Elementor-Warenkorb-Widget fixiert min-/max-height 28px (0,4,0) */
	body.dwbds-on table.cart td.product-quantity div.quantity input.qty,
	body.dwbds-on .elementor-widget-woocommerce-cart .woocommerce table.cart td.product-quantity input.input-text.qty {
		width: var(--dwb-ds-control-h);
		height: var(--dwb-ds-control-h);
		min-height: var(--dwb-ds-control-h);
		max-height: none;
	}
}
