/* ===== WooCommerce Product Archive ===== */

/* Hero Banner */

.wc-archive-hero{
    background: linear-gradient(135deg, rgba(70,205,207,.08) 0%, rgba(151,227,228,.12) 100%);
    padding: 48px 0 30px;
    border: 1px solid rgba(70,205,207,.12);
    border-radius: 20px;
    box-shadow: 0 8px 18px rgba(47, 177, 179, .1);
}

.wc-archive-hero .woocommerce-ordering{
    margin:0;
}
.wc-archive-title {
    font-family: 'Montserrat', 'Noto Sans TC', sans-serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    text-align: center;
    color: var(--ink, #1a1a2e);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.wc-archive-desc {
    font-size: 0.95rem;
    opacity: 0.9;
    margin: 0 0 16px;
    max-width: 640px;
    line-height: 1.5;
}

/* Toolbar */
.wc-archive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding:0 38px;
    flex-wrap: wrap;
}

.wc-archive-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Override WooCommerce ordering select */
.wc-archive-toolbar .orderby {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    color: rgba(70,205,207,1);
    border: 1px solid rgba(70,205,207,0.5);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    background-size: 14px;
}

.wc-archive-toolbar .orderby option {
    background: rgba(70,205,207,1);
    color: #fff;
}

/* Body */
.wc-archive-body {
    padding: 24px 0 50px;
}
.woocommerce a.added_to_cart{
    width: 100%;
    text-align: center;
    padding: 0;
    margin-bottom: 20px;
    display: none;
}

/* Remove WC native spacing */
.wc-page{
    padding: 50px 0;
}
.wc-page .woocommerce,
.wc-archive-body .woocommerce {
    margin: 0;
    padding: 0;
}

.wc-archive-body .container > ul.products {
    margin: 0 !important;
    padding: 0 !important;
}

/* WC native adds ::before/::after pseudo elements with content for clearing */
.wc-archive-body ul.products::before,
.wc-archive-body ul.products::after {
    display: none !important;
}

/* WC layout: remove default margins on archive & single */
.wc-archive-body div.product,
section.related div.product,
section.up-sells, section.upsells div.product {
    float: none !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}

/* ===== Product Grid Override (global for all product lists) ===== */

/* Remove default WC grid spacing */
.wc-archive-body ul.products,
section.related ul.products,
section.up-sells, section.upsells ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 28px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.wc-archive-body .products.columns-4,
section.related .products.columns-4,
section.up-sells, section.upsells .products.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.wc-archive-body .products.columns-3,
section.related .products.columns-3,
section.up-sells, section.upsells .products.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wc-archive-body .products.columns-2,
section.related .products.columns-2,
section.up-sells, section.upsells .products.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* Product Card - global */
.wc-archive-body li.product,
section.related li.product,
section.up-sells, section.upsells li.product {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    position: relative;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(23,57,58,0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(23,57,58,0.06);
    display: flex;
    flex-direction: column;
}

.wc-archive-body li.product:hover,
section.related li.product:hover,
section.up-sells, section.upsells li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(23,57,58,0.13);
}

/* Product Image */
.wc-archive-body li.product a.woocommerce-loop-product__link,
section.related li.product a.woocommerce-loop-product__link,
section.up-sells, section.upsells li.product a.woocommerce-loop-product__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wc-archive-body li.product img,
section.related li.product img,
section.up-sells, section.upsells li.product img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.wc-archive-body li.product:hover img,
section.related li.product:hover img,
section.up-sells, section.upsells li.product:hover img {
    transform: scale(1.04);
}

/* Sale Badge */
.woocommerce ul.products li.product .onsale{
    top:10px;
    right:10px;
    margin:0;
}
.wc-archive-body span.onsale,
section.related span.onsale,
section.up-sells, section.upsells span.onsale {
    position: absolute;
    z-index: 2;
    background: var(--brand);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 99px;
    line-height: 1.4;
    min-width: auto;
    min-height: auto;
}

/* Product Title */
.wc-archive-body h2.woocommerce-loop-product__title,
section.related h2.woocommerce-loop-product__title,
section.up-sells, section.upsells h2.woocommerce-loop-product__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #222;
    padding: 14px 16px!important;
    margin: 0;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 50px; /* 確保標題高度一致 */
}
.wc-archive-body .price ins,
section.related .price ins,
section.up-sells, section.upsells .price ins,
.woocommerce:where(body:not(.woocommerce-uses-block-theme)) ul.products li.product .price{
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--brand)!important;
}
.woocommerce ul.products li.product .price del{
    color: #999;
}
/* Price */
.wc-archive-body .price,
section.related .price,
section.up-sells, section.upsells .price {
    padding: 0 16px 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #46CDCF;
    min-height: 36px; /* 確保價格區域高度一致 */
}

.wc-archive-body .price del {
    font-size: 0.82rem;
    opacity: 0.45;
    font-weight: 400;
    color: #999;
    margin-right: 5px;
}

.wc-archive-body .price ins {
    text-decoration: none;
    color: #e74c3c;
    font-weight: 700;
}

/* 無價格時的佔位符（保持對齊） */
.wc-archive-body li.product:not(:has(.price)),
section.related li.product:not(:has(.price)),
section.up-sells, section.upsells li.product:not(:has(.price)) {
    /* 爲沒有價格的產品添加佔位空間 */
}

.wc-archive-body li.product:not(:has(.price)) .wc-loop-sku,
section.related li.product:not(:has(.price)) .wc-loop-sku,
section.up-sells, section.upsells li.product:not(:has(.price)) .wc-loop-sku {
    padding-bottom: 46px; /* 補償價格區域的高度 */
}

/* Add to Cart Button - global */
.wc-archive-body a.button,
section.related a.button,
section.up-sells, section.upsells a.button {
    display: block;
    margin: 0 16px 16px;
    text-align: center;
    width: calc(100% - 32px);
    padding: 10px 16px;
    background: transparent;
    color: #46CDCF;
    border: 2px solid #46CDCF;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wc-archive-body a.button:hover,
section.related a.button:hover,
section.up-sells, section.upsells a.button:hover {
    background: #46CDCF;
    color: #fff;
}

.wc-archive-body a.button.loading,
section.related a.button.loading,
section.up-sells, section.upsells a.button.loading {
    opacity: 0.7;
}

.wc-archive-body a.button.added,
section.related a.button.added,
section.up-sells, section.upsells a.button.added {
    background: #2fb1b3;
    color: #fff;
    border-color: #2fb1b3;
}

/* ===== 產品循環操作按鈕（詢倠按鈕） ===== */
.wc-loop-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
    margin-top: auto; /* 自動推到底部 */
}

.wc-loop-actions .btn {
    flex: 1;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

/* 產品編號樣式 */
.wc-loop-sku {
    padding: 0 16px 8px;
    font-size: 0.78rem;
    color: #999;
    font-weight: 500;
}

/* No Results */
.no-posts {
    text-align: center;
    padding: 80px 20px;
}

.no-posts-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-posts h2 {
    font-size: 1.5rem;
    margin: 0 0 10px;
    color: #333;
}

.no-posts p {
    color: #777;
    margin-bottom: 24px;
}

/* Sub-categories */
.wc-archive-body ul.products > li.product-category {
    background: linear-gradient(135deg, #6ed8d9 0%, #97e3e4 100%);
    border-radius: 16px;
    overflow: hidden;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-archive-body li.product-category a {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    padding: 30px;
}

.wc-archive-body li.product-category mark {
    background: none;
    color: inherit;
    font-style: normal;
}

.wc-archive-body li.product-category .count {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 6px;
}

/* Pagination */
.wc-archive-body nav.woocommerce-pagination {
    margin-top: 44px;
    text-align: center;
}

.wc-archive-body nav.woocommerce-pagination ul {
    display: inline-flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.wc-archive-body nav.woocommerce-pagination li {
    float: none;
    margin: 0;
}

.wc-archive-body nav.woocommerce-pagination a,
.wc-archive-body nav.woocommerce-pagination span {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    color: #333;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.wc-archive-body nav.woocommerce-pagination a:hover {
    border-color: #46CDCF;
    color: #46CDCF;
}

.wc-archive-body nav.woocommerce-pagination span.current {
    background: #46CDCF;
    color: #fff;
    border-color: #46CDCF;
}

/* Mobile */
@media (max-width: 1024px) {
    .wc-archive-body .products.columns-4,
    section.related .products.columns-4,
    section.up-sells, section.upsells .products.columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .wc-archive-hero {
        padding: 32px 0 24px;
    }

    .wc-archive-title {
        font-size: 1.5rem;
    }

    .wc-archive-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .wc-archive-body ul.products,
    section.related ul.products,
    section.up-sells, section.upsells ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px;
    }

    .wc-archive-body li.product img,
    section.related li.product img,
    section.up-sells, section.upsells li.product img {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .wc-archive-body ul.products,
    section.related ul.products,
    section.up-sells, section.upsells ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* ===== Related / Upsells on Product Single Page ===== */
section.related,
section.up-sells, section.upsells {
    padding: 50px 0;
    margin-top: 0;
    background: #f8fbfc;
}

/* Constrain width like .container */
section.related > h2,
section.related > ul.products,
section.up-sells, section.upsells > h2,
section.up-sells, section.upsells > ul.products {
    max-width: min(var(--container, 1200px), calc(100% - 84px));
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

section.related h2,
section.up-sells, section.upsells h2 {
    margin: 0 0 20px;
    color: var(--ink);
    font-family: "Montserrat", "Noto Sans TC", sans-serif;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.12;
    letter-spacing: -.03em;
    padding: 0px 4px;
}

section.related h2::after,
section.up-sells, section.upsells h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 3px;
    background: var(--brand);
    border-radius: 2px;
}

/* Reset WC native styles on related/upsells */
section.related .woocommerce,
section.up-sells, section.upsells .woocommerce {
    margin: 0 !important;
    padding: 0 !important;
}

section.related ul.products::before,
section.related ul.products::after,
section.up-sells, section.upsells ul.products::before,
section.up-sells, section.upsells ul.products::after {
    display: none !important;
}

/* Force product grid for custom related sections */
.wc-page section.related ul.products,
.wc-page section.related .products.columns-4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 28px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.wc-page section.related li.product {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    position: relative !important;
    background: #fff !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 12px rgba(23,57,58,0.07) !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease !important;
    border: 1px solid rgba(23,57,58,0.06) !important;
}

.wc-page section.related li.product:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 32px rgba(23,57,58,0.13) !important;
}

.wc-page section.related li.product img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.35s ease !important;
}

.wc-page section.related li.product:hover img {
    transform: scale(1.04) !important;
}

.wc-page section.related li.product a.woocommerce-loop-product__link {
    display: block !important;
    text-decoration: none !important;
    color: inherit !important;
}

.wc-page section.related li.product h2.woocommerce-loop-product__title {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #222 !important;
    padding: 10px 16px 6px 16px !important;
    margin: 0 !important;
    line-height: 1.45 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.wc-page section.related li.product .price {
    display: block !important;
    padding: 0 16px 10px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #46CDCF !important;
}

@media (max-width: 1024px) {
    .wc-page section.related .products.columns-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    section.related,
    section.up-sells, section.upsells {
        padding: 36px 0;
    }
    section.related h2,
    section.up-sells, section.upsells h2 {
        font-size: 1.3rem;
        margin-bottom: 24px;
    }
    .wc-page section.related .products.columns-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
    }
    .wc-page section.related li.product img {
        height: 150px !important;
    }
}

@media (max-width: 480px) {
    .wc-page section.related .products.columns-4 {
        grid-template-columns: 1fr !important;
    }
}

/* FlexSlider viewport — 由 style.css 主畫廊樣式控制，這裏只做最小兼容 */
.flex-viewport{
    border-radius: inherit;
}

/* 縮略圖行 — 不加額外邊框，由主樣式統一控制 */
.woocommerce div.product div.images .flex-control-thumbs li{
    padding: 0;
}
.woocommerce img.alignnone{
    border-radius: 16px;
}
.woocommerce:where(body:not(.woocommerce-uses-block-theme)) div.product p.price, .woocommerce:where(body:not(.woocommerce-uses-block-theme)) div.product span.price{
    color: var(--brand-3);
}
.woocommerce span.onsale{
    background-color:var(--brand-3);
    padding: .8em;
    top: -1.4em;
    left: -1.6em;
}
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit.alt, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button.alt, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button.alt, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button.alt{
    background-color:var(--brand-3);
}
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit.alt:hover, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button.alt:hover, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button.alt:hover, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button.alt:hover, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit.alt:hover, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button.alt:hover, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button.alt:hover, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button.alt:hover{
    background-color:var(--text);
}
.woocommerce div.product div.images .flex-control-thumbs li img.flex-active, .woocommerce div.product div.images .flex-control-thumbs li img:hover{
    border: 2px solid var(--brand-3);
}
.tagged_as{ margin: 0 0 0 20px;}
.woocommerce div.product form.cart::after, .woocommerce div.product form.cart::before{
    display: none;
}
.inquiry-overlay .inquiry-close-btn{
    padding: 0!important;
    top: -24px!important;
    right: -24px!important;
    width: 52px;
    height: 52px;
    background: #46CDCF!important;
    border: none;
    font-size: 34px!important;
    color: #fff!important;
}