/* ==========================================================================
   AI Layout Templates — acodesign-product-grid
   Scoped via Container (.acodesign-products-wrapper) for ALL loops (native & shortcode)
   ========================================================================== */

/* ======================================================
   Template: Standard Card
   ====================================================== */
.acodesign-products-wrapper.acd-layout-standard ul.products li.product .acodesign-floating-icons-wrapper .acodesign-floating-cart-wrapper {
    display: flex !important;
    width: 100%;
    margin-top: auto;
}

/* ======================================================
   Template: Button Always Visible (PC Desktop)
   ====================================================== */
@media (min-width: 769px) {
    /* Action icons (Wishlist, QV, Compare) show on hover */
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product .acodesign-floating-icons-wrapper {
        opacity: 0;
        transition: all 0.3s ease !important;
    }
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:hover .acodesign-floating-icons-wrapper {
        opacity: 1 !important;
    }

    /* Make cards stretch to equal height and push button to the bottom */
    .acodesign-products-wrapper.acd-layout-button-visible ul.products {
        align-items: stretch !important;
    }
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product {
        display: flex !important;
        flex-direction: column !important;
    }
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product .acodesign-template-cart-wrapper {
        margin-top: auto !important;
        padding-top: 12px !important;
        text-align: center !important;
        width: 100% !important;
    }

    /* Main Add to Cart button is ALWAYS VISIBLE on PC - render outer wrapper */
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-template-cart-wrapper {
        display: block !important;
    }

    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-template-cart-wrapper .button,
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-template-cart-wrapper .add_to_cart_button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: static !important;
        transform: none !important;
        background-color: var(--acd-btn-bg, #131728) !important;
        color: var(--acd-btn-text, #ffffff) !important;
        padding: 10px 20px !important;
        border-radius: 4px !important;
        width: 85% !important;
        margin: 0 auto !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        height: 42px !important;
        min-height: 42px !important;
        line-height: 1 !important;
    }

    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-template-cart-wrapper .button:hover,
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-template-cart-wrapper .add_to_cart_button:hover {
        background-color: var(--acd-btn-hover-bg, #000000) !important;
        color: var(--acd-btn-hover-text, #ffffff) !important;
    }

    /* Hide redundant cart icon in floating wrapper AND hide inner button */
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product .acodesign-floating-icons-wrapper .acodesign-floating-cart-wrapper,
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-image-wrapper > .button,
    .acodesign-products-wrapper.acd-layout-button-visible ul.products li.product:not(.acodesign-style-3) .acodesign-image-wrapper > .add_to_cart_button {
        display: none !important;
    }
}

/* ======================================================
   Template: Horizontal Card
   ====================================================== */
.acodesign-products-wrapper.acd-layout-horizontal ul.products li.product {
    display: grid !important;
    grid-template-columns: 140px 1fr !important;
    gap: 14px;
    align-items: start;
}
.acodesign-products-wrapper.acd-layout-horizontal ul.products li.product .acodesign-image-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}
.acodesign-products-wrapper.acd-layout-horizontal ul.products li.product .acodesign-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
}
@media (max-width: 600px) {
    .acodesign-products-wrapper.acd-layout-horizontal ul.products li.product {
        grid-template-columns: 100px 1fr !important;
        gap: 10px;
    }
}

/* ======================================================
   Template: Minimal Clean
   ====================================================== */
.acodesign-products-wrapper.acd-layout-minimal ul.products li.product {
    border: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 12px;
}
.acodesign-products-wrapper.acd-layout-minimal ul.products li.product .acodesign-image-wrapper {
    border-radius: 6px;
    overflow: hidden;
}

/* ======================================================
   Template: Overlay Dark
   ====================================================== */
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product {
    position: relative !important;
    overflow: hidden !important;
    min-height: 320px !important;
}
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product .acodesign-image-wrapper {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0;
    width: 100% !important;
    height: 100% !important;
}
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product .acodesign-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.05) 100%);
    z-index: 1;
}
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product .acodesign-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product .acodesign-product-loop-title,
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product .price,
.acodesign-products-wrapper.acd-layout-overlay ul.products li.product .acodesign-category {
    color: #fff !important;
    position: relative !important;
    z-index: 2;
}

/* ======================================================
   Template: Centered
   ====================================================== */
.acodesign-products-wrapper.acd-layout-centered ul.products li.product {
    text-align: center !important;
}
.acodesign-products-wrapper.acd-layout-centered ul.products li.product .acodesign-image-wrapper {
    margin: 0 auto !important;
    width: 85% !important;
    border-radius: 50% !important;
    overflow: hidden;
}
.acodesign-products-wrapper.acd-layout-centered ul.products li.product .acodesign-image-wrapper img {
    object-fit: cover !important;
}

/* ======================================================
   Template: Compact List
   ====================================================== */
.acodesign-products-wrapper.acd-layout-compact ul.products li.product {
    display: grid !important;
    grid-template-columns: 80px 1fr !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 8px !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}
.acodesign-products-wrapper.acd-layout-compact ul.products li.product .acodesign-image-wrapper {
    width: 80px !important;
    height: 80px !important;
    overflow: hidden;
}
.acodesign-products-wrapper.acd-layout-compact ul.products li.product .acodesign-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* ======================================================
   Template: Masonry Grid
   ====================================================== */
.acodesign-products-wrapper.acd-layout-masonry ul.products {
    column-count: 4;
    column-gap: 16px;
}
.acodesign-products-wrapper.acd-layout-masonry ul.products li.product {
    break-inside: avoid !important;
    margin-bottom: 16px !important;
    display: block !important;
}
.acodesign-products-wrapper.acd-layout-masonry ul.products li.product .acodesign-image-wrapper {
    width: 100%;
    overflow: hidden;
}
.acodesign-products-wrapper.acd-layout-masonry ul.products li.product .acodesign-image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: cover !important;
}
@media (max-width: 767px) {
    .acodesign-products-wrapper.acd-layout-masonry ul.products {
        column-count: 2;
    }
}
