/* Product cards woocommerce/content-product.php (extracted from style.css) */
span.e_title {
    display: block;
    font-size: 14px;
    font-weight: 400;
}

/* Desktop product title clamping - REMOVED TRUNCATION */
a.product-title .e_heading {
    font-weight: 700;
    font-size: 18px;
    line-height: 24px;
    margin-bottom: 4px;
}

a.product-title,
.product-actions .price-net {
    font-weight: 700;
    font-size: 18px;
    line-height: 24px;
}

/* Cena netto nigdy się nie łamie */
.product-actions .price-net,
span.price-net {
    white-space: nowrap;
    display: inline-block;
}

.product-actions .product-add-to-cart {
    flex: 0 0 auto;
    max-width: 175px;
}

.product-actions del {
    font-size: 14px;
    font-weight: 400;
}

li.product-card .title-part {
    /* grow to fill the gap between thumbnail and footer */
    flex: 1 1 auto;
    /* if you want some breathing room: */
    margin-bottom: 0.5em;
    /* Reduced from 1em */
}

/* your <li> wrapper */
li.product-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: auto;
    padding: 12px;
}

li.product-card .product-thumb {
    padding: 18px;
}

.product-symbol {
    opacity: 50%;
    font-size: 12px;
    line-height: 21px;
}

.product-label {
    font-size: 12px;
    font-weight: 700;
    line-height: 12px;
    background-color: #fff;
    margin-top: -14px;
}

.product-label.new {
    color: #FF7300;
}

.product-label.sale {
    color: #F00;
}

/* Tag-based product labels */
.product-label.promocja {
    color: #ef4444;
    /* red */
}

.product-label.eco {
    color: #10b981;
    /* green */
}

.product-label.bestseller {
    color: #f59e0b;
    /* orange */
}

.product-label.nowosc {
    color: #3b82f6;
    /* blue */
}

.product-label.polecany {
    color: #8b5cf6;
    /* violet */
}

.product-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.2rem;
    margin-top: auto;
    padding-top: 8px;
}

.product-price {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 48px);
    min-width: 0;
}

/* Add to Cart Button - Responsive Text/Icon Display */
.woocommerce ul.products li.product-card .product-actions .product-add-to-cart a.button.add_to_cart_button,
.woocommerce ul.products li.product-card .product-actions a.button {
    /* Applied to generic buttons (like View More) too */
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 12px 12px;
    border: 1px solid #000;
    border-radius: 999px;
    background-color: #fff;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    color: #000;
    transition: background-color .3s, color .3s, border-color .3s;
    justify-content: center;
    white-space: nowrap;
    width: auto;
    min-width: auto;
    box-sizing: border-box;
    letter-spacing: normal;
    text-transform: none;
}

.woocommerce li.product-card .product-actions .product-add-to-cart a.button.add_to_cart_button:hover,
.woocommerce li.product-card .product-actions a.button:hover {
    background-color: #000 !important;
    color: #fff !important;
}

/* Ikona SVG w przycisku "Dodaj do koszyka" */
.product-actions .product-add-to-cart .add-to-cart-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.product-actions .product-add-to-cart .add-to-cart-icon svg {
    width: 20px;
    height: 20px;
    transition: filter 0.3s;
}

/* "View More" specific styling - mimic Add to Cart icon but with 'i' */
.woocommerce li.product-card .product-actions a.button:not(.add_to_cart_button)::before {
    content: "i";
    font-family: serif;
    /* Usage of serif for "i" often looks better as an icon */
    font-weight: bold;
    font-style: italic;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background-color: var(--wp--preset--color--theme-palette-3, #000);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    margin-right: 0;
    /* text has gap */
    transition: filter 0.3s;
}

.woocommerce li.product-card .product-actions a.button:not(.add_to_cart_button):hover::before {
    filter: invert(1);
    /* Invert to match button hover black->white if needed, or keep distinct */
}

/* Ensure Add to Cart keeps its own icon logic */
.woocommerce .product-actions .product-add-to-cart .button.add_to_cart_button::before {
    content: "";
    /* Reset content for add to cart which uses background-image */
}


/* Desktop: Show both icon and text */
@media screen and (min-width: 768px) {
    .woocommerce ul.products.woo-archive-btn-button li.product-card .product-actions .product-add-to-cart .add-to-cart-text {
        display: inline;
    }

    .woocommerce ul.products.woo-archive-btn-button li.product-card .product-actions .product-add-to-cart .add-to-cart-icon {
        display: flex;
        align-items: center;
    }
}

/* Common Text Styles */
p.price-net-gross {
    margin-block-start: 0em;
    margin-block-end: 0em;
}

.product-price p.price-net-gross {
    text-align: left;
    font-size: 14px;
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

li p.price-net-gross {
    text-align: left;
    font-size: 14px;
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Container query for responsive button text */
li.product-card .product-actions {
    container-type: inline-size;
}

@container (max-width: 260px) {

    /* Ukryj tekst przycisku gdy jest za mało miejsca - zostaw tylko ikonę */
    .woocommerce .product-actions .product-add-to-cart .add-to-cart-text {
        display: none !important;
    }

    .woocommerce .product-actions .product-add-to-cart .button.add_to_cart_button,
    .woocommerce .product-actions a.button {
        padding: 12px !important;
        gap: 0 !important;
    }

    /* Icon pozostaje widoczna */
    .woocommerce .product-actions .product-add-to-cart .add-to-cart-icon {
        display: flex !important;
    }

    /* Keep the icon visible even when text is hidden for non-add-to-cart buttons */
    .woocommerce li.product-card .product-actions a.button:not(.add_to_cart_button)::before {
        margin-right: 0;
    }

    /* Dla przycisków bez custom ikony SVG - ukryj tekst przez font-size */
    .woocommerce .product-actions a.button:not(.add_to_cart_button) {
        font-size: 0 !important;
        line-height: 0;
        overflow: hidden;
        gap: 0 !important;
    }
}

/* Disable Cart spin after adding to cart */
x.woocommerce ul.products li.product .button.added,
span.kadence-svg-iconset.svg-baseline {
    display: none !important;
}

/* Add to cart buttons - ikona SVG jest w szablonie woocommerce/loop/add-to-cart.php */
.woocommerce .product-actions .product-add-to-cart .button.add_to_cart_button::before {
    display: none !important;
}

/* Ikona SVG w przycisku - hover efekt */
.woocommerce .product-actions .product-add-to-cart .button.add_to_cart_button:hover .add-to-cart-icon svg {
    filter: brightness(0) invert(1);
}

a.added_to_cart.wc-forward {
    white-space: pre-line;
    max-width: 100px;
    padding-bottom: 0 !important;
    text-align: center;
}

li.product .button.added {
    height: 0 !important;
    padding: 0 !important;
    width: 0 !important;
    overflow: hidden;
    border: 0 !important;
}

/* ------------------------------------------- */
/* Unified Mobile Archive Layout (< 768px) */
/* ------------------------------------------- */
@media (max-width: 768px) {

    /* Force archive loops to a single column across Kadence variants */
    .woocommerce ul.products.woo-archive-loop,
    .woocommerce ul.products.grid-cols,
    .woocommerce ul.products.grid-ss-col-2,
    .woocommerce ul.products.grid-sm-col-3,
    .woocommerce ul.products.grid-lg-col-4,
    .woocommerce ul.products.product-archive {
        grid-template-columns: 1fr !important;
    }

    /* Card lays out as image left, content right */
    .woocommerce ul.products li.product-card {
        display: grid !important;
        grid-template-columns: 112px minmax(0, 1fr) !important;
        gap: 8px;
        /* Reduced gap */
        align-items: start;
        width: 100%;
        padding: 6px;
        /* Reduced mobile padding */
    }

    .woocommerce ul.products li.product-card .product-thumb {
        grid-column: 1;
        grid-row: 1;
        position: relative;
        width: 112px;
        height: 112px;
        justify-self: start;
        align-self: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .woocommerce ul.products li.product-card .product-thumb a,
    .woocommerce ul.products li.product-card .product-thumb img {
        display: block;
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Place labels container in the grid below the image */
    .woocommerce ul.products li.product-card .product-labels {
        grid-column: 1;
        grid-row: 2;
        margin-top: 4px;
        justify-self: center;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    /* Reset label styling for mobile (no absolute) */
    .product-card .product-label {
        position: static;
        border-radius: 999px;
        background: #fff;
        padding: 2px 6px;
        font-size: 10px;
        line-height: 1;
        border: 1px solid #eee;
        margin-top: 0;
        /* Override desktop negative margin */
    }

    .woocommerce ul.products li.product-card .title-part {
        grid-column: 2 / -1;
        grid-row: 1;
        margin-bottom: 4px;
        align-self: center;
        /* Align title vertically with image center if desired, or top: align-self: start; */
    }

    .woocommerce ul.products li.product-card .product-actions {
        grid-column: 2 / -1;
        grid-row: 2;
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        /* changed from flex-end to center to align with labels? or keep flex-end */
        align-self: start;
        /* align with labels row */
        justify-content: space-between;
        gap: 8px;
        margin-top: 0;
        /* Let grid gap handle it? or keep small */
        /* margin-top: 0; */
    }

    .woocommerce ul.products li.product-card .product-price {
        max-width: 100%;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Tweak title sizes for compact layout */
    li a.product-title .e_heading,
    li.product a.product-title {
        font-size: 16px;
        line-height: 1.05;
        /* Updated as requested */
        margin-bottom: 2px;
        /* Removed visual truncation */
    }

    li a span.e_title {
        font-size: 12px;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    li p.price-net-gross {
        margin-block-start: 0;
        margin-block-end: 0;
        line-height: 1.2;
    }

    .woocommerce li.product-card .product-actions .product-add-to-cart a.button.add_to_cart_button,
    .woocommerce li.product-card .product-actions a.button {
        padding: 10px 12px;
    }
}

/* Very small screens */
@media screen and (max-width: 400px) {
    li.product-card {
        padding: 4px;
    }

    li a.product-title .e_heading,
    li.product a.product-title {
        font-size: 14px;
    }
}