/**
 * JWD 全系列商品頁樣式
 * 目標：WooCommerce 全系列商品 / 商品分類 / 商品列表頁 / shortcode 內頁
 * 重點：不影響首頁 slider，所以所有主要選擇器都排除 body.home / body.front-page。
 */


/* Shortcode 頂部：顯示所有 xx 筆結果 + 預設排序 */
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-toolbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 20px !important;
    width: 100% !important;
    margin: 0 0 40px !important;
    padding: 0 !important;
    clear: both !important;
}

body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-result-count,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap p.woocommerce-result-count {
    float: none !important;
    color: #1f2937 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-ordering,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap form.woocommerce-ordering {
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-ordering select.orderby {
    width: auto !important;
    min-width: 190px !important;
    height: 46px !important;
    padding: 0 42px 0 18px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0 !important;
    background-color: #ffffff !important;
    color: #1f2937 !important;
    font-size: 16px !important;
    line-height: 46px !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer !important;
}

body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-ordering select.orderby:focus,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-ordering select.orderby:hover {
    border-color: #9ca3af !important;
}

/* Shortcode 專用排列 */
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products.jwd-aspp-products {
    display: grid !important;
    gap: 54px 42px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

body:not(.home):not(.front-page) .jwd-aspp-shortcode-columns-1 ul.products.jwd-aspp-products { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
body:not(.home):not(.front-page) .jwd-aspp-shortcode-columns-2 ul.products.jwd-aspp-products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
body:not(.home):not(.front-page) .jwd-aspp-shortcode-columns-3 ul.products.jwd-aspp-products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
body:not(.home):not(.front-page) .jwd-aspp-shortcode-columns-4 ul.products.jwd-aspp-products { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
body:not(.home):not(.front-page) .jwd-aspp-shortcode-columns-5 ul.products.jwd-aspp-products { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
body:not(.home):not(.front-page) .jwd-aspp-shortcode-columns-6 ul.products.jwd-aspp-products { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }

body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product {
    float: none !important;
    clear: none !important;
    width: auto !important;
    margin: 0 !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product,
body:not(.home):not(.front-page).woocommerce-page ul.products li.product,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product {
    position: relative !important;
    background: #ffffff !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    padding: 24px 18px 22px !important;
    transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease !important;
    overflow: visible !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product:hover,
body:not(.home):not(.front-page).woocommerce-page ul.products li.product:hover,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product:hover {
    border-color: #d9e1ea !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .11) !important;
    transform: translateY(-1px) !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .woocommerce-loop-product__link,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.woocommerce-LoopProduct-link,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .woocommerce-loop-product__link {
    display: block !important;
    text-decoration: none !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product img,
body:not(.home):not(.front-page).woocommerce-page ul.products li.product img,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 250px !important;
    object-fit: contain !important;
    object-position: center center !important;
    margin: 0 auto 22px !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product .woocommerce-loop-product__title,
body:not(.home):not(.front-page) .woocommerce ul.products li.product h2.woocommerce-loop-product__title,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .woocommerce-loop-product__title,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product h2.woocommerce-loop-product__title {
    color: #1f2937 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.45 !important;
    letter-spacing: .02em !important;
    text-align: left !important;
    padding: 0 !important;
    margin: 0 0 24px !important;
    min-height: 58px !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product .price,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .price {
    display: block !important;
    color: #344054 !important;
    font-size: 21px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    text-align: left !important;
    margin: 0 0 22px !important;
}

/* 相容 WooCommerce 預設按鈕、Elementor 商品按鈕、以及 JWD shortcode 雙按鈕 */
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-buttons,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-shortcode-buttons,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .jwd-aspp-shortcode-buttons {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 0 !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product a.button,
body:not(.home):not(.front-page) .woocommerce ul.products li.product button.button,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .added_to_cart,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-buy-now,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-btn,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-buttons a,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-shortcode-buttons a,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.button,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .jwd-aspp-shortcode-buttons a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
    width: calc(50% - 6px) !important;
    min-width: 0 !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 8px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #008000 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: .02em !important;
    text-align: center !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    transition: background-color .18s ease, color .18s ease, transform .18s ease !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product > a.button,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .add_to_cart_button,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .product_type_simple,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .product_type_variable {
    margin-right: 10px !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-shortcode-buttons .add_to_cart_button,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .jwd-aspp-shortcode-buttons .add_to_cart_button {
    margin-right: 0 !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product a.button:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product button.button:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .added_to_cart:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-buy-now:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-btn:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-buttons a:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-shortcode-buttons a:hover,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.button:hover,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .jwd-aspp-shortcode-buttons a:hover,
body:not(.home):not(.front-page) .woocommerce ul.products li.product a.button:focus,
body:not(.home):not(.front-page) .woocommerce ul.products li.product button.button:focus,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-buy-now:focus,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-btn:focus,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.button:focus {
    background: #84bd3f !important;
    color: #ffffff !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.home):not(.front-page) .woocommerce ul.products li.product a.button:active,
body:not(.home):not(.front-page) .woocommerce ul.products li.product button.button:active,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-buy-now:active,
body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-btn:active,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.button:active {
    background: #6fab33 !important;
    color: #ffffff !important;
    transform: translateY(1px) !important;
}

/* WooCommerce AJAX 加入購物車後常會出現「查看購物車」；為避免多一顆破版，先隱藏。 */
body:not(.home):not(.front-page) .woocommerce ul.products li.product .added_to_cart.wc-forward,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .added_to_cart.wc-forward {
    display: none !important;
}

/* 有些主題會把第二顆按鈕換行，這裡強制它們維持同列。 */
body:not(.home):not(.front-page) .woocommerce ul.products li.product .button + .jwd-aspp-buy-now,
body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .button + .jwd-aspp-buy-now {
    margin-left: 0 !important;
}

@media (max-width: 1180px) {
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products.jwd-aspp-products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 42px 28px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product img,
    body:not(.home):not(.front-page).woocommerce-page ul.products li.product img,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product img {
        height: 220px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product .woocommerce-loop-product__title,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product h2.woocommerce-loop-product__title,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .woocommerce-loop-product__title,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product h2.woocommerce-loop-product__title {
        font-size: 18px !important;
    }
}

@media (max-width: 767px) {

    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-toolbar {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 14px !important;
        margin-bottom: 30px !important;
    }

    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-ordering,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap .jwd-aspp-ordering select.orderby {
        width: 100% !important;
    }


    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products.jwd-aspp-products {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
        gap: 34px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product,
    body:not(.home):not(.front-page).woocommerce-page ul.products li.product,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product {
        padding: 22px 14px 20px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product img,
    body:not(.home):not(.front-page).woocommerce-page ul.products li.product img,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product img {
        height: 220px !important;
        margin-bottom: 18px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product .woocommerce-loop-product__title,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product h2.woocommerce-loop-product__title,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .woocommerce-loop-product__title,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product h2.woocommerce-loop-product__title {
        font-size: 19px !important;
        line-height: 1.45 !important;
        min-height: auto !important;
        margin-bottom: 20px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product .price,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .price {
        font-size: 20px !important;
        margin-bottom: 20px !important;
    }

    body:not(.home):not(.front-page) .woocommerce ul.products li.product a.button,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product button.button,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-buy-now,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-btn,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-buttons a,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-shortcode-buttons a,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.button,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .jwd-aspp-shortcode-buttons a {
        height: 46px !important;
        min-height: 46px !important;
        font-size: 15px !important;
        padding: 0 6px !important;
    }
}

@media (max-width: 390px) {
    body:not(.home):not(.front-page) .woocommerce ul.products li.product a.button,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product button.button,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-buy-now,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-btn,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-spc-archive-buttons a,
    body:not(.home):not(.front-page) .woocommerce ul.products li.product .jwd-aspp-shortcode-buttons a,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product a.button,
    body:not(.home):not(.front-page) .jwd-aspp-shortcode-wrap ul.products li.product .jwd-aspp-shortcode-buttons a {
        font-size: 13px !important;
    }
}
