/* ===========================================================
   INTERMAX PREMIUM – ILOŚCI PRODUKTÓW 1.0.5
   Pojedynczy rząd: [ −  1  + ] [ Dodaj do koszyka ]
   TYLKO w listach produktów; bez zmian na karcie produktu.
   =========================================================== */

/* Ten sam poziom i ta sama wysokość co zwykłe przyciski.
   Układ siatki nie może przenieść przycisku do drugiego wiersza. */
.woocommerce ul.products li.product .imx-shop-qty,
.woocommerce-page ul.products li.product .imx-shop-qty,
ul.products li.product .imx-shop-qty {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 64px;
    align-items: stretch !important;
    justify-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 64px !important;
    height: 64px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: both !important;
}

.woocommerce ul.products li.product .imx-shop-qty *,
ul.products li.product .imx-shop-qty * {
    box-sizing: border-box;
}

/* Z aktywnym JS licznik i przycisk mają osobne, stałe kolumny.
   Proporcje dopasowują się do dostępnej szerokości kafelka. */
html.imx-shop-qty-ready .woocommerce ul.products li.product .imx-shop-qty,
html.imx-shop-qty-ready .woocommerce-page ul.products li.product .imx-shop-qty,
html.imx-shop-qty-ready ul.products li.product .imx-shop-qty {
    grid-template-columns: clamp(80px, 27%, 92px) minmax(0, 1fr) !important;
}

/* Bez JavaScript pozostaje zwykły WooCommerce „Dodaj do koszyka”. */
.imx-shop-qty .imx-shop-qty__picker {
    display: none !important;
}
html.imx-shop-qty-ready .woocommerce ul.products li.product .imx-shop-qty__picker,
html.imx-shop-qty-ready ul.products li.product .imx-shop-qty__picker {
    display: flex !important;
}
.woocommerce ul.products li.product .imx-shop-qty__picker,
ul.products li.product .imx-shop-qty__picker {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #c8d9ed !important;
    background: #fff !important;
    border-radius: 10px !important;
    overflow: hidden;
    box-shadow: none !important;
}
.woocommerce ul.products li.product .imx-shop-qty__minus,
.woocommerce ul.products li.product .imx-shop-qty__plus,
ul.products li.product .imx-shop-qty__minus,
ul.products li.product .imx-shop-qty__plus {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 30% !important;
    width: 30% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #123252 !important;
    box-shadow: none !important;
    font: 700 20px/1 Arial, sans-serif !important;
    text-decoration: none !important;
    cursor: pointer;
    touch-action: manipulation;
}
.woocommerce ul.products li.product .imx-shop-qty__minus:hover:not(:disabled),
.woocommerce ul.products li.product .imx-shop-qty__plus:hover:not(:disabled),
ul.products li.product .imx-shop-qty__minus:hover:not(:disabled),
ul.products li.product .imx-shop-qty__plus:hover:not(:disabled) {
    background: #eaf3ff !important;
    color: #075dca !important;
}
.imx-shop-qty .imx-shop-qty__minus:disabled,
.imx-shop-qty .imx-shop-qty__plus:disabled {
    opacity: .34;
    cursor: not-allowed;
}
.woocommerce ul.products li.product .imx-shop-qty__number,
.woocommerce .imx-shop-qty .imx-shop-qty__number,
ul.products li.product .imx-shop-qty__number {
    display: block !important;
    flex: 1 1 40% !important;
    width: 40% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 1px !important;
    border: 0 !important;
    outline-offset: -3px;
    border-radius: 0 !important;
    background: #fff !important;
    color: #112c4d !important;
    text-align: center !important;
    box-shadow: none !important;
    font: 700 16px/1.2 Arial, sans-serif !important;
    -moz-appearance: textfield;
    appearance: textfield;
}
.imx-shop-qty .imx-shop-qty__number::-webkit-inner-spin-button,
.imx-shop-qty .imx-shop-qty__number::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Jednolita typografia na zwykłych przyciskach oraz przy liczniku.
   Na żadnym kafelku nie zwiększamy pogrubienia ani nie łamiemy napisu. */
.woocommerce ul.products li.product a.add_to_cart_button,
.woocommerce-page ul.products li.product a.add_to_cart_button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 64px !important;
    min-height: 64px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    white-space: nowrap !important;
}
.imx-shop-qty__button-short { display: none !important; }

/* Dokładnie jeden rząd. Celowo wygrywa z regułami motywu, które
   ustawiają przycisk na 100% szerokości i spychają go pod licznik. */
.woocommerce ul.products li.product .imx-shop-qty > a.add_to_cart_button,
.woocommerce-page ul.products li.product .imx-shop-qty > a.add_to_cart_button,
ul.products li.product .imx-shop-qty > a.add_to_cart_button {
    grid-column: 1;
    grid-row: 1;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: none !important;
    float: none !important;
    clear: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
    padding: 7px 8px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    background: #0b65cd !important;
    color: #fff !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    box-shadow: none !important;
}
html.imx-shop-qty-ready .woocommerce ul.products li.product .imx-shop-qty > a.add_to_cart_button,
html.imx-shop-qty-ready .woocommerce-page ul.products li.product .imx-shop-qty > a.add_to_cart_button,
html.imx-shop-qty-ready ul.products li.product .imx-shop-qty > a.add_to_cart_button {
    grid-column: 2 !important;
}
.woocommerce ul.products li.product .imx-shop-qty > a.add_to_cart_button:hover,
ul.products li.product .imx-shop-qty > a.add_to_cart_button:hover {
    background: #084eae !important;
    color: #fff !important;
}

/* Natywny odnośnik „Zobacz koszyk” WooCommerce, jeśli zostanie dodany
   po AJAX, zajmuje całą szerokość pod elementami zakupowymi. */
.woocommerce ul.products li.product .imx-shop-qty > a.added_to_cart,
ul.products li.product .imx-shop-qty > a.added_to_cart {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    position: absolute !important;
    top: 100%;
    left: 0;
    width: 100% !important;
    padding: 3px !important;
    margin: 0 !important;
    font-size: 12px;
    text-align: center;
}
.woocommerce ul.products li.product .imx-shop-qty,
ul.products li.product .imx-shop-qty {
    position: relative;
}

.imx-shop-qty button:focus-visible,
.imx-shop-qty input:focus-visible,
.imx-shop-qty a:focus-visible {
    outline: 2px solid #0b65cf !important;
    outline-offset: 2px;
}

/* Skrócona etykieta zależy od REALNEJ szerokości kafelka, a nie
   od szerokości całego monitora. Wąska kolumna na desktopie też działa. */
.imx-shop-qty { container: imx-qty / inline-size; }
@container imx-qty (max-width: 225px) {
    .imx-shop-qty > a.add_to_cart_button .imx-shop-qty__button-full {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }
    .imx-shop-qty > a.add_to_cart_button .imx-shop-qty__button-short {
        display: inline !important;
    }
}

@media (max-width: 640px) {
    .woocommerce ul.products li.product a.add_to_cart_button,
    .woocommerce-page ul.products li.product a.add_to_cart_button {
        height: 58px !important;
        min-height: 58px !important;
        font-size: 12px !important;
        line-height: 1.2 !important;
        padding: 5px !important;
    }
    .woocommerce ul.products li.product .imx-shop-qty,
    ul.products li.product .imx-shop-qty {
        grid-template-rows: 58px;
        height: 58px !important;
        min-height: 58px !important;
        gap: 6px !important;
    }
    .woocommerce ul.products li.product .imx-shop-qty__picker,
    ul.products li.product .imx-shop-qty__picker {
        height: 58px !important;
        min-height: 58px !important;
    }
    .woocommerce ul.products li.product .imx-shop-qty > a.add_to_cart_button,
    ul.products li.product .imx-shop-qty > a.add_to_cart_button {
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
        font-size: 12px !important;
        padding: 5px 4px !important;
    }
    .woocommerce ul.products li.product .imx-shop-qty__minus,
    .woocommerce ul.products li.product .imx-shop-qty__plus,
    ul.products li.product .imx-shop-qty__minus,
    ul.products li.product .imx-shop-qty__plus {
        font-size: 18px !important;
    }
}
/* Na ekranach skrajnie wąskich nie ma miejsca na dwie klikalne
   kontrolki obok siebie. Wraca wtedy pojedynczy, czytelny przycisk;
   wybór wielu sztuk pozostaje dostępny na karcie produktu. */
@media (max-width: 360px) {
    html.imx-shop-qty-ready .woocommerce ul.products li.product .imx-shop-qty,
    html.imx-shop-qty-ready ul.products li.product .imx-shop-qty {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: 58px !important;
        min-height: 58px !important;
        height: 58px !important;
    }
    html.imx-shop-qty-ready .woocommerce ul.products li.product .imx-shop-qty__picker,
    html.imx-shop-qty-ready ul.products li.product .imx-shop-qty__picker {
        display: none !important;
    }
    html.imx-shop-qty-ready .woocommerce ul.products li.product .imx-shop-qty > a.add_to_cart_button,
    html.imx-shop-qty-ready ul.products li.product .imx-shop-qty > a.add_to_cart_button {
        grid-column: 1 !important;
        grid-row: 1 !important;
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
    }
}
/* KONIEC – INTERMAX PREMIUM – ILOŚCI PRODUKTÓW */

/* ==========================================================
   1.0.5 – Komunikat NA KAŻDYM KAFELKU (bez zmiany wysokości).
   Nakładka zajmuje wyłącznie miejsce przycisku i licznika;
   nie zasłania ceny ani zdjęcia i nie przesuwa kolejnych kafelków.
   ========================================================== */
.woocommerce ul.products li.product .imx-shop-qty__notice,
.woocommerce-page ul.products li.product .imx-shop-qty__notice,
ul.products li.product .imx-shop-qty__notice {
    position: absolute !important;
    inset: 0 !important;
    z-index: 15 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 7px 10px 7px 29px !important;
    margin: 0 !important;
    border: 1px solid #bddcc7 !important;
    border-left: 5px solid #21804b !important;
    border-radius: 10px !important;
    background: #f1fbf4 !important;
    color: #17462a !important;
    box-shadow: 0 3px 12px rgba(14,41,71,.13) !important;
    text-align: left !important;
    font: 600 12px/1.25 system-ui,-apple-system,"Segoe UI",Arial,sans-serif !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    box-sizing: border-box !important;
    pointer-events: none !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity .16s ease, visibility .16s ease;
}
.imx-shop-qty .imx-shop-qty__notice::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 9px;
    transform: translateY(-50%);
    color: #21804b;
    font: 800 17px/1 Arial,sans-serif;
}
.woocommerce ul.products li.product .imx-shop-qty__notice--warning,
.woocommerce-page ul.products li.product .imx-shop-qty__notice--warning,
ul.products li.product .imx-shop-qty__notice--warning {
    border-color: #f1b8b8 !important;
    border-left-color: #c93131 !important;
    background: #fff2f2 !important;
    color: #8b1c1c !important;
}
.imx-shop-qty .imx-shop-qty__notice--warning::before {
    content: '!';
    color: #c93131;
}
.woocommerce ul.products li.product .imx-shop-qty__notice--visible,
.woocommerce-page ul.products li.product .imx-shop-qty__notice--visible,
ul.products li.product .imx-shop-qty__notice--visible {
    opacity: 1;
    visibility: visible;
}
@media (max-width: 640px) {
    .woocommerce ul.products li.product .imx-shop-qty__notice,
    ul.products li.product .imx-shop-qty__notice {
        padding: 5px 5px 5px 21px !important;
        font-size: 10px !important;
        line-height: 1.15 !important;
    }
    .imx-shop-qty .imx-shop-qty__notice::before {
        left: 6px;
        font-size: 13px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .imx-shop-qty .imx-shop-qty__notice { transition: none; }
}
/* KONIEC – POWIADOMIENIA NA KAFELKACH 1.0.5 */
