/* ==========================================================================
   HM Category / Shop Archive — product card styling
   Matches homepage .hm-product-grid look & feel
   ========================================================================== */

/* ---- Product grid: 3 columns desktop, 2 tablet, 1 mobile ---- */
body.post-type-archive-product ul.products,
body.post-type-archive-product ul.products[class*="columns-"],
body.tax-product_cat ul.products,
body.tax-product_cat ul.products[class*="columns-"],
body.woocommerce-shop ul.products,
body.woocommerce-shop ul.products[class*="columns-"] {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
}

@media (max-width: 991px) {
    body.post-type-archive-product ul.products,
    body.post-type-archive-product ul.products[class*="columns-"],
    body.tax-product_cat ul.products,
    body.tax-product_cat ul.products[class*="columns-"],
    body.woocommerce-shop ul.products,
    body.woocommerce-shop ul.products[class*="columns-"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    body.post-type-archive-product ul.products,
    body.post-type-archive-product ul.products[class*="columns-"],
    body.tax-product_cat ul.products,
    body.tax-product_cat ul.products[class*="columns-"],
    body.woocommerce-shop ul.products,
    body.woocommerce-shop ul.products[class*="columns-"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
}

/* Force product width to fill grid cell */
body.post-type-archive-product ul.products li.product,
body.tax-product_cat ul.products li.product,
body.woocommerce-shop ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

/* ---- Hide sorting bar + result count ---- */
.woocommerce-result-count,
.woocommerce-ordering {
    display: none !important;
}

/* ---- Sidebar: hide strikethrough prices ---- */
.widget_products .product_list_widget del,
.widget_recently_viewed_products .product_list_widget del,
.widget_top_rated_products .product_list_widget del,
.sidebar del,
#secondary del,
aside del {
    display: none !important;
}

.widget_products .product_list_widget ins,
.widget_recently_viewed_products .product_list_widget ins,
.widget_top_rated_products .product_list_widget ins,
.sidebar ins,
#secondary ins,
aside ins {
    text-decoration: none !important;
    background: none !important;
}

/* ---- Product cards — border, rounded, clean ---- */
body.post-type-archive-product ul.products li.product,
body.tax-product_cat ul.products li.product,
body.woocommerce-shop ul.products li.product {
    padding: 12px !important;
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column !important;
    transition: box-shadow 0.2s ease !important;
}

/* Kill Shoptimizer ::before shadow overlay */
body.post-type-archive-product ul.products li.product::before,
body.post-type-archive-product ul.products li.product:hover::before,
body.tax-product_cat ul.products li.product::before,
body.tax-product_cat ul.products li.product:hover::before,
body.woocommerce-shop ul.products li.product::before,
body.woocommerce-shop ul.products li.product:hover::before {
    display: none !important;
    content: none !important;
}

/* ---- Image wrapper ---- */
body.post-type-archive-product li.product .woocommerce-image__wrapper,
body.tax-product_cat li.product .woocommerce-image__wrapper,
body.woocommerce-shop li.product .woocommerce-image__wrapper {
    overflow: hidden !important;
    border-radius: 8px !important;
    position: relative !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body.post-type-archive-product li.product .woocommerce-image__wrapper img,
body.tax-product_cat li.product .woocommerce-image__wrapper img,
body.woocommerce-shop li.product .woocommerce-image__wrapper img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    position: static !important;
    display: block !important;
}

/* ---- Hide sale/discount badges (-18%, -14% etc) ---- */
body.post-type-archive-product li.product .sale-item,
body.post-type-archive-product li.product .product-label,
body.post-type-archive-product li.product span.onsale,
body.post-type-archive-product li.product .onsale,
body.post-type-archive-product li.product .type-bubble,
body.tax-product_cat li.product .sale-item,
body.tax-product_cat li.product .product-label,
body.tax-product_cat li.product span.onsale,
body.tax-product_cat li.product .onsale,
body.tax-product_cat li.product .type-bubble,
body.woocommerce-shop li.product .sale-item,
body.woocommerce-shop li.product .product-label,
body.woocommerce-shop li.product span.onsale,
body.woocommerce-shop li.product .onsale,
body.woocommerce-shop li.product .type-bubble {
    display: none !important;
}

/* ---- Hide category labels (Oleje, Olejki, ...) ---- */
body.post-type-archive-product li.product .product__categories,
body.post-type-archive-product li.product p.product__categories,
body.tax-product_cat li.product .product__categories,
body.tax-product_cat li.product p.product__categories,
body.woocommerce-shop li.product .product__categories,
body.woocommerce-shop li.product p.product__categories {
    display: none !important;
}

/* ---- Hide strikethrough price in product cards ---- */
body.post-type-archive-product li.product .price del,
body.tax-product_cat li.product .price del,
body.woocommerce-shop li.product .price del {
    display: none !important;
}

body.post-type-archive-product li.product .price ins,
body.tax-product_cat li.product .price ins,
body.woocommerce-shop li.product .price ins {
    text-decoration: none !important;
    font-weight: 700 !important;
    background: none !important;
}

/* ---- Product title ---- */
body.post-type-archive-product li.product .woocommerce-loop-product__title,
body.post-type-archive-product li.product .woocommerce-loop-product__title a,
body.tax-product_cat li.product .woocommerce-loop-product__title,
body.tax-product_cat li.product .woocommerce-loop-product__title a,
body.woocommerce-shop li.product .woocommerce-loop-product__title,
body.woocommerce-shop li.product .woocommerce-loop-product__title a {
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #333 !important;
}

/* ---- Card inner layout — push button to bottom ---- */
body.post-type-archive-product li.product .woocommerce-card__header,
body.tax-product_cat li.product .woocommerce-card__header,
body.woocommerce-shop li.product .woocommerce-card__header {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

body.post-type-archive-product li.product .woocommerce-card__header .price,
body.tax-product_cat li.product .woocommerce-card__header .price,
body.woocommerce-shop li.product .woocommerce-card__header .price {
    margin-top: auto !important;
}

/* ---- Add to cart button — rounded, full width ---- */
body.post-type-archive-product li.product a.add_to_cart_button,
body.post-type-archive-product li.product a.button,
body.post-type-archive-product ul.products li.product .button,
body.tax-product_cat li.product a.add_to_cart_button,
body.tax-product_cat li.product a.button,
body.tax-product_cat ul.products li.product .button,
body.woocommerce-shop li.product a.add_to_cart_button,
body.woocommerce-shop li.product a.button,
body.woocommerce-shop ul.products li.product .button {
    position: static !important;
    margin-top: auto !important;
    width: 100% !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 12px 20px !important;
    transition: all 0.2s ease !important;
}

body.post-type-archive-product li.product .button:hover,
body.post-type-archive-product li.product .add_to_cart_button:hover,
body.tax-product_cat li.product .button:hover,
body.tax-product_cat li.product .add_to_cart_button:hover,
body.woocommerce-shop li.product .button:hover,
body.woocommerce-shop li.product .add_to_cart_button:hover {
    opacity: 0.9 !important;
    border-radius: 10px !important;
    background-color: #3f880b !important;
    color: #fff !important;
}

/* Hide "View cart" link after adding */
body.post-type-archive-product ul.products li.product .added_to_cart,
body.tax-product_cat ul.products li.product .added_to_cart,
body.woocommerce-shop ul.products li.product .added_to_cart {
    display: none !important;
}

/* Loading + added state */
body.post-type-archive-product li.product .add_to_cart_button.loading,
body.tax-product_cat li.product .add_to_cart_button.loading,
body.woocommerce-shop li.product .add_to_cart_button.loading {
    opacity: 0.7 !important;
    pointer-events: none !important;
}

body.post-type-archive-product li.product .add_to_cart_button.added,
body.tax-product_cat li.product .add_to_cart_button.added,
body.woocommerce-shop li.product .add_to_cart_button.added {
    opacity: 1 !important;
}

/* ---- PLP carousel container resets ---- */
body.post-type-archive-product li.product .shoptimizer-plp-carousel-container,
body.post-type-archive-product li.product .shoptimizer-plp-image-wrapper,
body.tax-product_cat li.product .shoptimizer-plp-carousel-container,
body.tax-product_cat li.product .shoptimizer-plp-image-wrapper,
body.woocommerce-shop li.product .shoptimizer-plp-carousel-container,
body.woocommerce-shop li.product .shoptimizer-plp-image-wrapper {
    overflow: hidden !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    position: relative !important;
    aspect-ratio: auto !important;
}

/* ---- Mobile: compact button ---- */
@media (max-width: 600px) {
    body.post-type-archive-product li.product a.add_to_cart_button,
    body.post-type-archive-product li.product a.button,
    body.post-type-archive-product ul.products li.product .button,
    body.tax-product_cat li.product a.add_to_cart_button,
    body.tax-product_cat li.product a.button,
    body.tax-product_cat ul.products li.product .button,
    body.woocommerce-shop li.product a.add_to_cart_button,
    body.woocommerce-shop li.product a.button,
    body.woocommerce-shop ul.products li.product .button {
        font-size: 9px !important;
        padding: 10px 8px !important;
        letter-spacing: 0.3px !important;
        white-space: nowrap !important;
    }

    body.post-type-archive-product ul.products li.product,
    body.tax-product_cat ul.products li.product,
    body.woocommerce-shop ul.products li.product {
        padding: 8px !important;
    }
}
