/* =========================================================
 * Hetian Gold Shop Template v1.3.6 — 輕量收藏功能
 * 深紅 #6D0609 + 禾田金色 #B38A3B；不依賴任何第三方 Wishlist 外掛。
 * ========================================================= */

/* ===== WordPress 選單：只透過 .hgst-favorites-menu 顯示收藏數量，不控制選單結構 ===== */
a.hgst-favorites-menu,
.hgst-favorites-menu > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.hgst-favorites-menu .hgst-favorites-count {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #6D0609;
    color: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
}

.hgst-favorites-menu .hgst-favorites-count:not(.has-items) {
    background: #9a9087;
}

/* 已登入會員尚未取得 Server Canonical state 時，Badge 不得以空／0 假裝沒有收藏。 */
.hgst-favorites-menu .hgst-favorites-count.is-pending {
    display: none;
}

/* ===== 商品單頁：加入購物車按鈕右側愛心 ===== */
.single-product form.cart .hgst-single-favorite-wrap {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 10px;
}

/* 售完／不可購買商品未輸出 form.cart 時，由 PHP fallback 在商品摘要下補上愛心。 */
.single-product .hgst-single-favorite-fallback {
    display: flex;
    align-items: center;
    margin: 14px 0 0;
}

.single-product .hgst-single-favorite-fallback .hgst-favorite-button {
    margin: 0;
}

.hgst-favorite-button {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 1px solid #B38A3B;
    border-radius: 50%;
    background-color: #ffffff;
    color: #B38A3B;
    box-shadow: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    line-height: 1;
    text-align: center;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.hgst-favorite-button:hover,
.hgst-favorite-button:focus-visible {
    border-color: #6D0609;
    background: #fff8ec;
    color: #6D0609;
    outline: none;
    transform: translateY(-1px);
}

.hgst-favorite-button:focus-visible {
    outline: 2px solid rgba(109, 6, 9, .35);
    outline-offset: 2px;
}

/* 已收藏：深紅實心圓 + 明確白色 Unicode 實心愛心（♡ / ♥）。
 * 對 icon 明確設定 color 與 -webkit-text-fill-color，避免 Safari 或主題字色覆寫後只剩圓框。 */
.hgst-favorite-button.is-favorited {
    border-color: #6D0609 !important;
    background-color: #6D0609 !important;
    color: #ffffff !important;
}

.hgst-favorite-button.is-favorited .hgst-favorite-icon {
    display: block !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
    font-weight: 700;
    opacity: 1 !important;
    visibility: visible !important;
}

.hgst-favorite-button.is-favorited:hover,
.hgst-favorite-button.is-favorited:focus-visible {
    border-color: #4a0406 !important;
    background-color: #4a0406 !important;
    color: #ffffff !important;
}

.hgst-favorite-button.is-favorited:hover .hgst-favorite-icon,
.hgst-favorite-button.is-favorited:focus-visible .hgst-favorite-icon {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
}

.hgst-favorite-button:disabled,
.hgst-favorite-button.is-initializing {
    cursor: wait;
    opacity: .55;
    transform: none;
}

.hgst-favorite-button:disabled:hover {
    border-color: #B38A3B;
    background: #ffffff;
    color: #B38A3B;
}

.hgst-favorite-button.is-favorited:disabled:hover {
    border-color: #6D0609 !important;
    background-color: #6D0609 !important;
    color: #ffffff !important;
}

.hgst-favorite-button.is-favorited:disabled:hover .hgst-favorite-icon {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
}

/* 本外掛使用 Unicode ♡ / ♥，不是 SVG、Font Awesome 或 CSS pseudo-element。 */
.hgst-favorite-icon {
    display: block;
    color: inherit;
    -webkit-text-fill-color: currentColor;
    font-size: 25px;
    font-style: normal;
    font-weight: 400;
    line-height: 1;
    pointer-events: none;
}

/* ===== 商品列表：商品圖片右上角愛心 ===== */
.hgst-product-card {
    position: relative;
}

.hgst-product-card > .hgst-favorite-button--archive {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 20px;
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 2px 8px rgba(26, 20, 20, .10);
}

.hgst-product-card > .hgst-favorite-button--archive .hgst-favorite-icon {
    font-size: 23px;
}

/* ===== 我的收藏頁 ===== */
.hgst-favorites-page {
    max-width: 1500px;
    margin: 0 auto;
    padding: 50px 20px 70px;
    color: #1a1414;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    box-sizing: border-box;
}

/* [hgst_favorites banner_url="..."] 直接使用商品列表的 .hgst-hero-banner；
 * 僅補上收藏頁所需的下方間距，不另建第二套 Banner 版型。 */
.hgst-favorites-page .hgst-favorites-banner {
    max-width: 1100px;
    margin: 0 auto 32px;
}

.hgst-favorites-page .hgst-favorites-banner img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.hgst-favorites-page-header {
    margin: 0 0 32px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e7dfd5;
    text-align: center;
}

.hgst-favorites-page-header h2 {
    margin: 0 0 10px;
    color: #6D0609;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.35;
}

.hgst-favorites-page-header p {
    margin: 0;
    color: #756d66;
    font-size: 15px;
    line-height: 1.7;
}

.hgst-favorites-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 0 -10px -20px;
}

.hgst-favorites-grid .hgst-product-card {
    position: relative;
}

.hgst-favorites-grid .hgst-product-actions {
    opacity: 1;
}

.hgst-favorites-grid .hgst-favorite-actions {
    align-items: center;
}

.hgst-favorites-grid .hgst-favorite-button--favorites-page {
    width: auto;
    min-width: 122px;
    height: auto;
    min-height: 35px;
    padding: 6px 14px;
    border-radius: 2px;
    gap: 7px;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    font-size: 13px;
}

.hgst-favorites-grid .hgst-favorite-button--favorites-page::after {
    content: "取消收藏";
}

.hgst-favorites-grid .hgst-favorite-button--favorites-page .hgst-favorite-icon {
    font-size: 19px;
}

.hgst-favorites-empty,
.hgst-favorites-loading {
    width: 100%;
    margin: 0;
    padding: 70px 20px;
    color: #756d66;
    font-size: 16px;
    line-height: 1.8;
    text-align: center;
    box-sizing: border-box;
}

.hgst-favorites-empty::before {
    content: "♡";
    display: block;
    margin-bottom: 12px;
    color: #B38A3B;
    font-family: Arial, sans-serif;
    font-size: 38px;
    line-height: 1;
}

.hgst-favorites-empty-state {
    width: 100%;
    padding: 64px 20px;
    text-align: center;
    box-sizing: border-box;
}

.hgst-favorites-empty-icon {
    display: block;
    margin-bottom: 12px;
    color: #B38A3B;
    font-family: Arial, sans-serif;
    font-size: 42px;
    line-height: 1;
}

.hgst-favorites-empty-state h3 {
    margin: 0 0 8px;
    color: #6D0609;
    font-size: 21px;
    font-weight: 600;
}

.hgst-favorites-empty-state p {
    margin: 0 0 22px;
    color: #756d66;
    font-size: 15px;
}

.hgst-favorites-shop-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid #6D0609;
    background: #6D0609;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .2s ease, border-color .2s ease;
    box-sizing: border-box;
}

.hgst-favorites-shop-link:hover,
.hgst-favorites-shop-link:focus-visible {
    border-color: #4a0406;
    background: #4a0406;
    color: #ffffff;
}

/* ===== 不阻塞閱讀的輕量通知 ===== */
.hgst-favorites-notice {
    position: fixed;
    z-index: 100000;
    right: 20px;
    bottom: 20px;
    max-width: calc(100vw - 40px);
    padding: 11px 16px;
    border-radius: 2px;
    background: #6D0609;
    color: #ffffff;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 7px 22px rgba(26, 20, 20, .20);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease;
}

.hgst-favorites-notice.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hgst-favorites-retry {
    margin: 0 0 0 8px;
    padding: 2px 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.hgst-favorites-retry:hover,
.hgst-favorites-retry:focus-visible {
    opacity: .8;
    outline: none;
}

@media (max-width: 768px) {
    a.hgst-favorites-menu,
    .hgst-favorites-menu > a {
        gap: 5px;
    }

    .hgst-favorites-menu .hgst-favorites-count {
        min-width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .single-product form.cart .hgst-single-favorite-wrap {
        margin-left: 7px;
    }

    .single-product .hgst-single-favorite-fallback {
        margin-top: 10px;
    }

    .hgst-favorite-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .hgst-favorite-icon {
        font-size: 23px;
    }

    .hgst-product-card > .hgst-favorite-button--archive {
        top: 8px;
        right: 8px;
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .hgst-product-card > .hgst-favorite-button--archive .hgst-favorite-icon {
        font-size: 20px;
    }

    .hgst-favorites-page {
        padding: 28px 12px 45px;
    }

    .hgst-favorites-page .hgst-favorites-banner {
        margin-bottom: 22px;
    }

    .hgst-favorites-empty-state {
        padding: 44px 14px;
    }

    .hgst-favorites-empty-state h3 {
        font-size: 19px;
    }

    .hgst-favorites-empty-state p {
        font-size: 14px;
    }

    .hgst-favorites-page-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .hgst-favorites-page-header h2 {
        font-size: 22px;
    }

    .hgst-favorites-page-header p {
        font-size: 13px;
    }

    .hgst-favorites-grid {
        justify-content: space-between;
        margin: 0;
    }

    .hgst-favorites-grid .hgst-product-card {
        flex: 0 0 48%;
        max-width: 48%;
        padding: 0;
        margin-bottom: 18px;
    }

    .hgst-favorites-grid .hgst-product-actions {
        flex-direction: column;
        gap: 6px;
        margin-top: 10px;
    }

    .hgst-favorites-grid .hgst-favorite-button--favorites-page {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    .hgst-favorites-empty,
    .hgst-favorites-loading {
        padding: 48px 15px;
        font-size: 14px;
    }

    .hgst-favorites-notice {
        right: 12px;
        bottom: 12px;
        max-width: calc(100vw - 24px);
        font-size: 13px;
    }
}
