/* M15 Shop Mods */

/* Force show add to cart buttons — nadpisanie Kadence woo-archive-action-on-hover */
.woocommerce ul.products li.product .product-action-wrap,
.woocommerce ul.products.woo-archive-action-on-hover li.product .product-action-wrap,
.woocommerce ul.products.woo-archive-action-on-hover li.product:hover .product-action-wrap {
    opacity: 1 !important;
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    transition: none !important;
    margin-top: auto !important;
    padding: 12px 0 0 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Disable hover lift animation */
.woocommerce ul.products li.product .content-bg,
.woocommerce ul.products li.product .product-details,
.woocommerce ul.products li.product .entry-content-wrap,
.woocommerce ul.products li.product:hover .content-bg,
.woocommerce ul.products li.product:hover .product-details,
.woocommerce ul.products li.product:hover .entry-content-wrap {
    transform: none !important;
    transition: none !important;
    margin-top: 0 !important;
    top: auto !important;
}

.woocommerce ul.products li.product:hover {
    transform: none !important;
}

/* Product card layout — rowna wysokosc kafelkow i wyrownanie przyciskow */
.woocommerce ul.products li.product {
    display: flex !important;
    flex-direction: column !important;
}

.woocommerce ul.products li.product .product-details,
.woocommerce ul.products li.product .entry-content-wrap {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}

/* Cena zawsze na dole, przed przyciskiem */
.woocommerce ul.products li.product .price {
    margin-top: auto !important;
}

/* Uniform image height */
.woocommerce ul.products li.product .woocommerce-loop-image-link {
    display: block;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
}

.woocommerce ul.products li.product .woocommerce-loop-image-link img,
.woocommerce ul.products li.product img.attachment-woocommerce_thumbnail {
    width: 100% !important;
    height: 220px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block;
    transition: transform 0.3s ease;
}

.woocommerce ul.products li.product:hover .woocommerce-loop-image-link img {
    transform: scale(1.03);
}

/* Product title */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: #15425f !important;
    margin: 10px 0 2px !important;
    text-align: center !important;
    height: 95px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

/* Price */
.woocommerce ul.products li.product .price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #c5b091 !important;
    margin: -2px 0 0 !important;
    text-align: center !important;
}

/* Quantity + Button row */
.m15-qty-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 10px;
    border-radius: 8px;
    overflow: visible;
    border: 2px solid #15425f;
    position: relative;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
}

.m15-qty-wrap .m15-add-to-cart-btn {
    border-radius: 0 6px 6px 0 !important;
}

.m15-qty-dropdown {
    border-radius: 6px 0 0 6px;
}

/* Custom qty dropdown */
.m15-qty-dropdown {
    position: relative;
    width: 56px;
    min-width: 56px;
    border-right: 2px solid #15425f;
    background: #f5f2ea;
    cursor: pointer;
    user-select: none;
}

.m15-qty-current {
    padding: 6px 6px;
    font-size: 12px;
    font-weight: 700;
    color: #15425f;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    box-sizing: border-box;
}

.m15-qty-arrow {
    font-size: 9px;
    margin-left: 1px;
}

.woocommerce ul.products li.product,
.woocommerce ul.products li.product .content-bg,
.woocommerce ul.products li.product .entry-content-wrap,
.woocommerce ul.products li.product .product-details {
    overflow: visible !important;
}

.m15-qty-options {
    display: none;
    position: absolute;
    top: 100%;
    left: -2px;
    right: -2px;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 2px solid #15425f;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.m15-qty-options li {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #15425f;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
}

.m15-qty-options li:hover {
    background: #f5f2ea;
}

.m15-qty-options li.m15-qty-active {
    background: #15425f;
    color: #fff;
}

.m15-qty-options li:last-child {
    border-radius: 0 0 6px 6px;
}

.m15-qty-dropdown.m15-qty-open .m15-qty-options {
    display: block;
}

.m15-qty-dropdown.m15-qty-open .m15-qty-arrow {
    transform: rotate(180deg);
}

.m15-qty-dropdown.m15-qty-open {
    background: #ebe7dc;
    z-index: 50;
}

.m15-qty-dropdown.m15-qty-open + .m15-add-to-cart-btn {
    z-index: 1;
}

.m15-add-to-cart-btn {
    flex: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 4px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    line-height: 1.2 !important;
    background: #15425f !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    transition: background 0.2s;
    text-transform: uppercase;
    overflow: hidden;
    min-height: 36px;
}

.m15-add-to-cart-btn .m15-btn-text,
.m15-add-to-cart-btn .m15-btn-loading {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m15-add-to-cart-btn:hover {
    background: #1a5a80 !important;
    color: #fff !important;
}

.m15-add-to-cart-btn.m15-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Variable products (WYBIERZ OPCJE) */
.woocommerce ul.products li.product a.button:not(.m15-add-to-cart-btn):not(.m15-continue-shopping) {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 35px !important;
    box-sizing: border-box !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
    background: transparent !important;
    color: #15425f !important;
    border: 2px solid #15425f !important;
    border-radius: 8px !important;
    margin-top: 10px;
    transition: all 0.2s;
    text-transform: uppercase;
    white-space: nowrap;
}

.woocommerce ul.products li.product a.button:not(.m15-add-to-cart-btn):not(.m15-continue-shopping):hover {
    background: #15425f !important;
    color: #fff !important;
}

/* Continue Shopping button */
.m15-continue-shopping {
    display: inline-block !important;
    background: transparent !important;
    color: #15425f !important;
    border: 2px solid #15425f !important;
    border-radius: 5px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4 !important;
    width: 100%;
    box-sizing: border-box;
}

.m15-continue-shopping:hover {
    background: #15425f !important;
    color: #fff !important;
}

.m15-continue-wrap {
    margin-top: 10px;
    width: 100%;
}

.m15-delivery-info {
    margin: 14px 0 0;
    padding: 12px 14px;
    background: #f5f2ea;
    border-left: 3px solid #c5b091;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #15425f;
}

/* Added to cart popup */
.m15-added-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.m15-added-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.m15-added-popup-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 320px;
    max-width: 90vw;
}

.m15-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    width: 28px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    color: #999;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.m15-popup-close:hover {
    color: #15425f;
    background: #f0f0f0;
}

.m15-added-msg {
    font-size: 18px;
    font-weight: 600;
    color: #15425f;
    margin-bottom: 20px;
}

.m15-added-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.m15-go-to-cart {
    display: inline-block !important;
    background: #15425f !important;
    color: #fff !important;
    border: 2px solid #15425f !important;
    border-radius: 6px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4 !important;
    width: 100%;
    box-sizing: border-box;
}

.m15-go-to-cart:hover {
    background: #0a2e42 !important;
    border-color: #0a2e42 !important;
}

/* Category sidebar */
.m15-category-sidebar {
    padding: 15px;
    background: #f5f2ea;
    border-radius: 10px;
}

.m15-cat-title {
    color: #15425f;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #c5b091;
}

.m15-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.m15-cat-item {
    position: relative;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.m15-cat-item a {
    color: #15425f;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    display: block;
    padding: 4px 0;
}

.m15-cat-item a:hover {
    color: #c5b091;
}

.m15-cat-active > a {
    font-weight: 700;
    color: #c5b091;
}

.m15-cat-toggle {
    position: absolute;
    right: 0;
    top: 10px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #15425f;
    border: 1px solid #15425f;
    border-radius: 50%;
}

.m15-cat-count {
    color: #999;
    font-size: 12px;
    font-weight: 400;
}

.m15-cat-children {
    display: none;
    list-style: none;
    margin: 0;
    padding: 4px 0 4px 16px;
}

.m15-cat-child a {
    font-size: 13px;
    font-weight: 400;
}

/* Continue shopping bottom */
.m15-continue-shopping-bottom {
    text-align: center;
    margin-top: 20px;
    padding: 15px 0;
}

/* Scroll to top button */
.m15-scroll-top {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 42px;
    background: #15425f;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s, background 0.2s;
    opacity: 0;
}

.m15-scroll-top::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 10px solid #fff;
    margin-top: -2px;
}

.m15-scroll-top.m15-scroll-visible {
    display: flex;
    opacity: 1;
}

.m15-scroll-top:hover {
    background: #0a2e42;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {

    /* Kategorie: kompaktowe chipsy w rzedzie */
    .m15-category-sidebar {
        margin-bottom: 8px !important;
        padding: 6px 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
    }

    .m15-cat-title {
        display: none !important;
    }

    .m15-cat-list {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    .m15-cat-item {
        padding: 0 !important;
        border-bottom: none !important;
        flex-shrink: 0;
    }

    .m15-cat-item a {
        display: block !important;
        padding: 6px 12px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        background: #f5f2ea !important;
        border-radius: 16px !important;
        border: none !important;
        white-space: nowrap;
        color: #15425f !important;
        line-height: 1.3 !important;
    }

    .m15-cat-item a:hover,
    .m15-cat-active > a {
        background: #15425f !important;
        color: #fff !important;
    }

    .m15-cat-toggle,
    .m15-cat-children,
    .m15-cat-count {
        display: none !important;
    }

    /* Przycisk koszyka na mobile */
    .m15-qty-wrap {
        border-width: 1.5px;
    }

    .m15-qty-dropdown {
        width: 50px;
        border-right-width: 1.5px;
    }

    .m15-qty-current {
        font-size: 11px;
        padding: 4px;
    }

    .m15-add-to-cart-btn {
        min-height: 34px;
        padding: 0 8px !important;
        font-size: 18px !important;
    }

    /* Kontener sklepu — pelna szerokosc, brak overflow */
    .m15-shop-layout {
        max-width: 100vw !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        padding: 0 8px !important;
    }

    .m15-shop-products {
        min-width: 0 !important;
        overflow: hidden !important;
        max-width: 100% !important;
    }

    /* SIATKA: 2 kolumny na mobile */
    .woocommerce ul.products,
    .elementor-widget-woocommerce-products ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        display: grid !important;
        gap: 8px !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .woocommerce ul.products li.product {
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Obrazki produktow */
    .woocommerce ul.products li.product .woocommerce-loop-image-link img,
    .woocommerce ul.products li.product img.attachment-woocommerce_thumbnail {
        height: 150px !important;
    }

    /* Tytul produktu */
    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        font-size: 11px !important;
        height: 54px;
        -webkit-line-clamp: 3;
        margin: 6px 4px 2px !important;
    }

    /* Cena */
    .woocommerce ul.products li.product .price {
        font-size: 14px !important;
        margin: 2px 0 !important;
    }

    /* Popup */
    .m15-added-popup-inner {
        min-width: auto;
        width: 90vw;
        padding: 24px 20px;
    }

    /* Ukryj pluginy nakladajace sie na przyciski */
    .accessibility-onetap-widget,
    .grecaptcha-badge {
        bottom: 70px !important;
    }
}

/* Hide default WooCommerce "added to cart" notice (replaced by m15 popup) */
.woocommerce-message,
.wc-block-components-notice-banner.is-success,
.wc-block-store-notices .wc-block-components-notice-banner {
    display: none !important;
}
