/* Merida Mobile Product View Modes */

/* =========================================
   Carousel Mode (Legacy Vertical Card)
   ========================================= */

/* Scope legacy styles to the specific class */
.merida-mobile-carousel-legacy .product {
    /* Ensure the card takes full width in the carousel item context if needed, 
       but usually the carousel item width is controlled by the carousel script/CSS.
       Here we focus on the inner content styling. */
    width: 100%;
}

/* Legacy copy of Product cards woocommerce/content-product.php styles */
.merida-mobile-carousel-legacy span.e_title {
    display: block;
    font-size: 14px;
    font-weight: 400;
}

/* Desktop product title clamping - kept for reference/completeness if carousel used on desktop, 
   though this is primarily for mobile switch */
.merida-mobile-carousel-legacy a.product-title .e_heading {
    font-weight: 700;
    font-size: 18px;
    line-height: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.merida-mobile-carousel-legacy a.product-title .e_title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

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

.merida-mobile-carousel-legacy .product-actions del {
    font-size: 14px;
    font-weight: 400;
}

.merida-mobile-carousel-legacy 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: 1em;
}

/* your <li> wrapper */
.merida-mobile-carousel-legacy li.product-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: auto;
}

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

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

.merida-mobile-carousel-legacy .product-label.new {
    color: #FF7300;
}

.merida-mobile-carousel-legacy .product-label.sale {
    color: #F00;
}

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

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

.merida-mobile-carousel-legacy .product-label.bestseller {
    color: #f59e0b;
    /* orange */
}

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

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

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

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

/* Add to Cart Button - Responsive Text/Icon Display */
.woocommerce .merida-mobile-carousel-legacy li.product-card .product-actions .product-add-to-cart a.button.add_to_cart_button {
    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 !important;
    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 .merida-mobile-carousel-legacy li.product-card .product-actions .product-add-to-cart a.button.add_to_cart_button:hover {
    background-color: #000 !important;
    color: #fff !important;
}

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

.woocommerce .merida-mobile-carousel-legacy ul.products.woo-archive-btn-button li.product-card .product-actions .product-add-to-cart .add-to-cart-icon svg {
    width: 16px;
    height: 16px;
}

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

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

/* Woo Archive Mobile */

@media screen and (max-width: 768px) {

    .merida-mobile-carousel-legacy li a.product-title .e_heading,
    .merida-mobile-carousel-legacy li.product a.product-title {
        line-height: 1.2;
        font-size: 14px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 2px;
    }

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

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

    /* Force single item width with peek for legacy carousel on mobile */
    .merida-mobile-carousel-legacy .merida-carousel-track>li.product {
        width: 85% !important;
        max-width: 85% !important;
        flex: 0 0 85% !important;
        padding: 0 5px !important;
    }
}

.merida-mobile-carousel-legacy p.price-net-gross {
    margin-block-start: 0em;
    margin-block-end: 0em;
}

.merida-mobile-carousel-legacy .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%;
}

.merida-mobile-carousel-legacy 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 */
.merida-mobile-carousel-legacy li.product-card {
    container-type: inline-size;
}

@container (max-width: 285px) {
    .woocommerce .merida-mobile-carousel-legacy .product-actions .product-add-to-cart .button.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 .merida-mobile-carousel-legacy ul.products li.product .button.added,
.merida-mobile-carousel-legacy span.kadence-svg-iconset.svg-baseline {
    display: none !important;
}

/* Add to cart buttons */

.woocommerce .merida-mobile-carousel-legacy .product-actions .product-add-to-cart .button.add_to_cart_button::before {
    content: "";
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url(../../includes/products/single-product-customize/css/css-icons/cart-plus-solid-full.svg);
    transition: all 0.3s;
    display: inline-block;
    margin-right: 0;
}

.woocommerce .merida-mobile-carousel-legacy .product-actions .product-add-to-cart .button.add_to_cart_button:hover::before {
    filter: brightness(0) invert(1);
}

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

.merida-mobile-carousel-legacy li.product .button.added {
    height: 0 !important;
    padding: 0 !important;
    width: 0 !important;
    overflow: hidden;
    border: 0 !important;
}


/* =========================================
   Horizontal List Mode
   ========================================= */

@media screen and (max-width: 768px) {
    .merida-mobile-list-view .merida-products-carousel {
        /* Disable carousel layout styles if any */
        display: block;
        overflow: visible;
    }

    .merida-mobile-list-view .merida-carousel-track {
        /* Reset track styles to allow stacking */
        display: block !important;
        transform: none !important;
        width: auto !important;
        padding: 0 !important;
        /* Reset grid if it's using grid */
        grid-template-columns: 1fr !important;
    }

    /* Remove the right edge fade effect */
    .merida-mobile-list-view::after {
        display: none !important;
        content: none !important;
    }

    .merida-mobile-list-view .merida-carousel-track li.product {
        /* Force full width and stacking */
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-right: 0 !important;
        margin-bottom: 15px !important;
        display: block !important;
    }

    /* Hide carousel arrows in list view */
    .merida-mobile-list-view .merida-carousel-arrow {
        display: none !important;
    }
}