/* ==========================================================================
   SHOP: nur auf Shop-, Kategorie-, Produkt-, Warenkorb- und Kassenseiten
   ========================================================================== */

/* --------------------------------------------------------------
   Warenkorb: Produktbilder
-------------------------------------------------------------- */
.woocommerce-cart table.cart td.product-thumbnail img {
    height: auto;
    max-width: none;
}
.woocommerce-cart table.cart td.product-thumbnail img[src^="data:image"] {
    width: 190px !important;
    aspect-ratio: auto !important;
}
.woocommerce-cart table.cart td.product-thumbnail img:not([src^="data:image"]) {
    width: 140px;
}

/* --------------------------------------------------------------
   Produktseite: Buttons "Produkt anpassen" und "In den Warenkorb"
-------------------------------------------------------------- */

/* Bereich, der den Anpassen-Button direkt enthält */
.single-product :has(> #fpd-start-customizing-button) {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
}

/* WooCommerce-Clearfix würde sonst einen leeren Abstand am Anfang erzeugen */
.single-product :has(> #fpd-start-customizing-button)::before,
.single-product :has(> #fpd-start-customizing-button)::after {
    display: none !important;
}

/* Verstecktes Mengenfeld (Einzelartikel) braucht keinen Platz */
.single-product :has(> #fpd-start-customizing-button) > .quantity:has(input[type="hidden"]) {
    display: none;
}

/* Sichtbares Mengenfeld mittig zu den Buttons */
.single-product :has(> #fpd-start-customizing-button) > .quantity:not(:has(input[type="hidden"])) {
    align-self: center;
    margin: 0 0 16px !important;
}

.single-product :has(> #fpd-start-customizing-button) > :is(#fpd-start-customizing-button, .single_add_to_cart_button) {
    flex: 1 1 200px;
    width: auto !important;
    float: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin: 0 0 16px !important;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    border-radius: 30px;
    box-shadow: none;
    transition: all 0.2s linear;
}

/* --------------------------------------------------------------
   Hintergrundbild (Shop, Kategorien, Produkte)
   Die Regel dazu wird aus inc/shop.php geschrieben, sobald in inc/config.php
   bei 'hintergrund_bild_id' die Nummer eines Bildes aus der Mediathek steht.
   Nur auf dem Computer; auf dem Handy bleibt die ruhige Farbfläche.
   Stärke des Schleiers: --meico-schleier in base.css.
-------------------------------------------------------------- */

/* --------------------------------------------------------------
   Felder ausblenden
-------------------------------------------------------------- */
.woocommerce-product-attributes-item--weight,
.woocommerce-checkout #billing_address_2_field,
.woocommerce-checkout #shipping_address_2_field {
    display: none !important;
}

/* --------------------------------------------------------------
   Versandarten (Kasse)
-------------------------------------------------------------- */
.woocommerce-checkout .woocommerce-shipping-methods li {
    display: grid !important;
    grid-template-columns: 24px auto;
    align-items: center;
    column-gap: 10px;
    margin-bottom: 10px;
}
.woocommerce-checkout .woocommerce-shipping-methods input[type="radio"] {
    margin: 0 !important;
    width: 18px;
    height: 18px;
}

/* --------------------------------------------------------------
   Produktkacheln und Grössenfeld
-------------------------------------------------------------- */
.woocommerce ul.products li.product {
    text-align: center !important;
}
.woocommerce ul.products li.product .button {
    display: block !important;
    margin: 0 auto !important;
}

/* Bild + Platz für Grössenfeld */
.woocommerce ul.products li.product .astra-shop-thumbnail-wrap {
    position: relative;
    margin-top: 26px;
}

.loop-size-field {
    position: absolute;
    top: -26px;
    left: 0;
    right: 0;
    z-index: 5;
    margin: 0;
    min-height: 18px;
    font-size: 14px;
    font-weight: 400;
    line-height: 18px;
    color: #6d6d6d;
    text-align: center;
}
.loop-size-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}
.loop-size-field select {
    display: block;
    margin: 0 auto;
    padding: 6px 10px;
    border-radius: 4px;
}
.loop-size-field .size-value {
    margin-left: 3px;
}

/* Textblock unten bündig */
.woocommerce ul.products li.product .astra-shop-summary-wrap,
.woocommerce ul.products li.product .product-details {
    margin-top: auto;
}

/* --------------------------------------------------------------
   Filter (Seitenleiste)
-------------------------------------------------------------- */
#secondary .widget select {
    width: 100% !important;
    padding: 6px 26px 6px 10px !important;
    font-size: 14px !important;
    color: #333 !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='8'%3E%3Cpolygon points='1,0 7,0 4,6' fill='gray'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 8px !important;
}

#secondary .widget .wpfButton {
    display: inline-block !important;
    min-width: 130px !important;
    padding: 8.9px 12px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.1 !important;
    color: #2c3e00 !important;
    background-color: var(--meico-gruen) !important;
    border: none !important;
    border-radius: 35px !important;
}
#secondary .widget .wpfClearButton {
    min-width: 170px !important;
    white-space: nowrap !important;
    text-transform: none !important;
}

/* Preisspanne, Zahlenfelder, Slider */
.wpfFilterDelimeter { margin: 0 2px !important; }
.wpfPriceRangeField,
#secondary .wpfFilterWrapper input.wpfPriceRangeField,
#secondary .wpfFilterWrapper input[type="number"] {
    width: 76px !important;
    min-width: 76px !important;
    box-sizing: border-box !important;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
    overflow: visible;
}
#secondary .wpfFilterWrapper input[type="number"]::-webkit-outer-spin-button,
#secondary .wpfFilterWrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#secondary .widget input[type="number"] { font-size: 15px !important; padding: 4px 6px !important; }
.wpfCurrencySymbol { font-size: 14px !important; }
.ui-slider { height: 4px !important; }
.ui-slider .ui-slider-handle { width: 14px !important; height: 14px !important; top: -5px !important; }

/* Grössenauswahl "Finkli Grösse wählen" nur bei Finkli */
body:not(.term-echtleder-finkli) .wpfFilterWrapper[data-get-attribute="wpf_filter_groesse"] {
    display: none !important;
}

/* --------------------------------------------------------------
   Filter auf dem Handy: Knopf "Filter" und Vollbild-Fenster
   (vorher war die Seitenleiste auf dem Handy ganz ausgeblendet)
-------------------------------------------------------------- */
.meico-filter-toggle {
    display: none;
}

/* Seitenleiste auf dem Handy zunächst versteckt */
body.ast-header-break-point.woocommerce .woocommerce-sidebar,
body.ast-header-break-point.woocommerce #secondary {
    display: none !important;
}

body.ast-header-break-point.woocommerce .meico-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin: 0 0 16px;
    padding: 0 20px;
    border: 2px solid var(--meico-dunkel);
    border-radius: 30px;
    background: #fff;
    color: var(--meico-dunkel);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
body.ast-header-break-point.woocommerce .meico-filter-toggle[aria-expanded="true"] {
    background: var(--meico-gruen);
}

/* Geöffnet: Filter füllt den Bildschirm */
body.ast-header-break-point.woocommerce.meico-filter-open #secondary {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 99999;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 72px 20px 110px;
    background: #fff;
}
body.meico-filter-open {
    overflow: hidden;
}

.meico-filter-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100000;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--meico-dunkel);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.meico-filter-done {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 16px;
    z-index: 100000;
    min-height: 52px;
    border: 0;
    border-radius: 30px;
    background: var(--meico-gruen);
    color: var(--meico-dunkel);
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.meico-filter-close,
.meico-filter-done {
    display: none;
}
body.meico-filter-open .meico-filter-close,
body.meico-filter-open .meico-filter-done {
    display: block;
}

/* Hinweis in der Angebote-Ansicht */
.meico-angebote-hinweis{margin:0 0 16px;font-weight:600}
.meico-angebote-hinweis a{margin-left:8px}

/* Filter-Taste: moderner, dunkle Kapsel mit limettengrünem Symbol */
body.ast-header-break-point.woocommerce .meico-filter-toggle {
    border-color: var(--meico-dunkel);
    background: var(--meico-dunkel);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 64, 64, .22);
    transition: background-color .2s, color .2s, transform .2s;
}
body.ast-header-break-point.woocommerce .meico-filter-toggle svg {
    color: var(--meico-gruen);
}
body.ast-header-break-point.woocommerce .meico-filter-toggle:hover,
body.ast-header-break-point.woocommerce .meico-filter-toggle[aria-expanded="true"] {
    background: var(--meico-gruen);
    border-color: var(--meico-gruen);
    color: var(--meico-dunkel);
}
body.ast-header-break-point.woocommerce .meico-filter-toggle:hover svg,
body.ast-header-break-point.woocommerce .meico-filter-toggle[aria-expanded="true"] svg {
    color: var(--meico-dunkel);
}

/* Filter-Leiste: Filter-Knopf plus "Zurücksetzen", wenn ein Filter gesetzt ist */
.meico-filter-leiste {
    display: contents;
}
body.ast-header-break-point.woocommerce .meico-filter-leiste {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}
body.ast-header-break-point.woocommerce .meico-filter-leiste .meico-filter-toggle {
    flex: 1 1 auto;
    width: auto;
    margin: 0;
}
.meico-filter-reset {
    display: none;
}
body.ast-header-break-point.woocommerce .meico-filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 18px;
    border: 2px solid var(--meico-dunkel);
    border-radius: 30px;
    background: #fff;
    color: var(--meico-dunkel);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s, color .2s;
}
body.ast-header-break-point.woocommerce .meico-filter-reset[hidden] {
    display: none;
}
body.ast-header-break-point.woocommerce .meico-filter-reset:hover,
body.ast-header-break-point.woocommerce .meico-filter-reset:focus-visible {
    background: var(--meico-dunkel);
    color: #fff;
}
/* Filter gesetzt: Knopf hellgrün gefüllt */
body.ast-header-break-point.woocommerce .meico-filter-toggle.ist-aktiv {
    background: var(--meico-gruen);
    border-color: var(--meico-dunkel);
    color: var(--meico-dunkel);
}
body.ast-header-break-point.woocommerce .meico-filter-toggle.ist-aktiv svg {
    color: var(--meico-dunkel);
}

/* Filter-Fenster auf dem Handy: Knopf "Ergebnisse anzeigen" immer sichtbar.
   Der Knopf klebt unten im Fenster selbst (sticky) und hängt nicht mehr am Bildschirmrand.
   Das Fenster hat unten Platz für die Leiste des Browsers. */
body.ast-header-break-point.woocommerce.meico-filter-open #secondary {
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-bottom: 24px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
body.meico-filter-open #secondary .meico-filter-done {
    position: sticky;
    left: auto;
    right: auto;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    margin-top: auto;
    width: 100%;
    flex: 0 0 auto;
    min-height: 52px;
    z-index: 100000;
}
/* Abstand über dem Knopf, damit er den letzten Filter nicht verdeckt, und Platz unter dem Knopf für die Browser-Leiste */
body.meico-filter-open #secondary::after {
    content: "";
    flex: 0 0 56px;
}
