/* 
 * Hetian Gold Shop Template Styles
 * 風格參考：金長山 - 深紅背景 + 白色內容區 + 寬版大圖
 */

/* ===================== 整體外層背景 ===================== */
/* 我們只在 shortcode 內部加上深紅背景，不影響 header/footer */
.hgst-outer-wrapper {
    background-color: #6D0609; /* 金長山的深紅色 */
    padding: 0;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

/* ===================== Banner 大圖 ===================== */
.hgst-hero-banner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

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

/* ===================== 主內容區 (白色背景) ===================== */
.hgst-shop-container {
    max-width: 1600px; /* 放寬以容納更多篩選器 */
    width: 100%;
    margin: 0 auto;
    padding: 80px 0;
    background-color: #ffffff;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    color: #1a1414;
    box-sizing: border-box;
}

/* 內部容器限制最大寬度 */
.hgst-inner-container {
    display: flex;
    flex-wrap: nowrap;
    max-width: 1500px; /* 放寬以容納更多篩選器 */
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ===================== 左側邊欄：情境分類 ===================== */
.hgst-sidebar {
    width: 285px; /* col-lg-3 的寬度 */
    flex-shrink: 0;
    padding: 0 20px;
    box-sizing: border-box;
}

.hgst-sidebar-inner {
    width: 245px;
}

.hgst-tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hgst-tag-item {
    padding: 0;
    height: 86px;
    line-height: 28.8px;
    cursor: pointer;
    font-size: 16px;
    color: #1a1414;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.hgst-tag-item:last-child {
    border-bottom: none;
}

.hgst-tag-item:hover,
.hgst-tag-item.active {
    color: #6D0609; /* hover 時變成深紅色 */
    font-weight: 500;
}

.hgst-tag-item.active::after {
    content: '>';
    font-size: 16px;
    color: #6D0609;
    font-weight: 400;
}

/* ===================== 右側主要內容 ===================== */
.hgst-main-content {
    flex: 1;
    min-width: 0;
    padding-left: 50px; /* 左側分類與右側內容之間的間距 */
}

/* ===================== SKU 搜尋列 ===================== */
.hgst-sku-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 10px;
}

.hgst-sku-search-row label {
    font-size: 16px;
    color: #1a1414;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.hgst-sku-search-input {
    width: 320px;
    max-width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #dddddd;
    border-radius: 2px;
    background-color: #ffffff;
    color: #555555;
    font-size: 15px;
    box-sizing: border-box;
}

.hgst-sku-search-input:focus {
    outline: none;
    border-color: #6D0609;
}

.hgst-sku-search-btn,
.hgst-sku-clear-btn {
    height: 40px;
    padding: 0 18px;
    border-radius: 2px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hgst-sku-search-btn {
    color: #ffffff;
    background-color: #6D0609;
    border: 1px solid #6D0609;
}

.hgst-sku-search-btn:hover {
    background-color: #4a0406;
    border-color: #4a0406;
}

.hgst-sku-clear-btn {
    color: #6D0609;
    background-color: #ffffff;
    border: 1px solid #6D0609;
}

.hgst-sku-clear-btn:hover {
    background-color: #fdf5f5;
}

/* ===================== 上方篩選區 ===================== */
.hgst-filter-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px; /* 稍微縮小間距以確保同一行 */
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 40px;
}

.hgst-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.hgst-filter-group label {
    font-size: 16px;
    color: #1a1414;
    font-weight: 500;
    margin: 0;
}

.hgst-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #dddddd;
    border-radius: 2px;
    background-color: #ffffff;
    color: #555555;
    font-size: 15px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    cursor: pointer;
    min-width: 120px;
    height: 40px;
}

.hgst-select:focus {
    outline: none;
    border-color: #6D0609;
}

.hgst-disabled-filter {
    opacity: 0.5;
}

.hgst-disabled-filter .hgst-select {
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.hgst-separator {
    color: #999999;
    font-size: 14px;
}

/* ===================== 商品網格 ===================== */
.hgst-product-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 0 -10px -20px; /* 金長山的負 margin 技巧 */
}

/* ===================== 商品卡片 ===================== */
.hgst-product-card {
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
    padding: 0 10px;
    margin-bottom: 40px;
    box-sizing: border-box;
    text-align: center;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.hgst-product-card:hover {
    transform: translateY(-3px);
}

.hgst-product-link {
    text-decoration: none !important;
    color: inherit;
    display: block;
}

.hgst-product-link:hover,
.hgst-product-link:visited,
.hgst-product-link:active {
    text-decoration: none !important;
}

.hgst-product-link *,
.hgst-product-link *:hover,
.hgst-product-link *:visited,
.hgst-product-link *:active {
    text-decoration: none !important;
}

/* 商品圖片 - 大圖 */
.hgst-product-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 比例正方形 */
    margin-bottom: 20px;
    background-color: #ffffff;
    overflow: hidden;
}

.hgst-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
    box-sizing: border-box;
}

/* 無圖時隱藏破圖 icon */
.hgst-product-image img[src=""],
.hgst-product-image img:not([src]) {
    visibility: hidden;
}

.hgst-out-of-stock {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 2px;
}

/* ===================== 商品資訊 ===================== */
.hgst-product-info {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hgst-product-weight {
    font-size: 16px;
    color: rgba(26, 20, 20, 0.6);
    margin-bottom: 8px;
    text-decoration: none !important;
}

.hgst-product-title {
    font-size: 18px;
    color: #1a1414;
    margin: 0 0 10px 0;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none !important;
}

.hgst-product-price {
    font-size: 16px;
    color: rgba(26, 20, 20, 0.6);
    font-weight: 400;
    text-decoration: none !important;
}

.hgst-product-price del {
    color: #999999;
    font-size: 14px;
    margin-right: 8px;
}

.hgst-product-price ins {
    text-decoration: none !important;
}

.hgst-product-price a {
    text-decoration: none !important;
    color: rgba(26, 20, 20, 0.6);
}

.hgst-loading, .hgst-no-products {
    width: 100%;
    text-align: center;
    padding: 80px 0;
    color: #777777;
    font-size: 16px;
}

/* ===================== 按鈕樣式 ===================== */
.hgst-product-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hgst-product-card:hover .hgst-product-actions {
    opacity: 1;
}

.hgst-btn {
    display: inline-block;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none !important;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.hgst-btn:hover {
    text-decoration: none !important;
}

.hgst-btn-outline {
    background-color: transparent;
    color: #6D0609;
    border-color: #6D0609;
}

.hgst-btn-outline:hover {
    background-color: #fdf5f5;
}

.hgst-btn-primary {
    background-color: #6D0609;
    color: #ffffff;
    border-color: #6D0609;
}

.hgst-btn-primary:hover {
    background-color: #4a0406;
    border-color: #4a0406;
}

/* ===================== 載入更多 ===================== */
.hgst-load-more-container {
    text-align: center;
    margin-top: 60px;
    padding-top: 30px;
    width: 100%;
}

#hgst-load-more-btn {
    padding: 12px 50px;
    font-size: 16px;
}

#hgst-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===================== 響應式設計 ===================== */
@media (max-width: 1024px) {
    .hgst-product-card {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    .hgst-outer-wrapper {
        background-color: #ffffff;
    }

    .hgst-shop-container {
        padding: 10px 0 20px;
    }

    .hgst-inner-container {
        flex-direction: column;
        padding: 0 12px;
    }

    /* === 左側情境分類：橫向滑動 === */
    .hgst-sidebar {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .hgst-sidebar-inner {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .hgst-tag-list {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        border-bottom: 1px solid #e0e0e0;
        gap: 0;
        margin: 0;
        padding: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .hgst-tag-list::-webkit-scrollbar {
        display: none;
    }

    .hgst-tag-item {
        flex: 0 0 auto;
        padding: 10px 16px;
        height: auto;
        line-height: 1.4;
        font-size: 14px;
        border-bottom: none;
    }

    .hgst-tag-item.active::after {
        display: none;
    }

    /* === 右側主內容區：移除左側 padding === */
    .hgst-main-content {
        padding-left: 0;
        padding-top: 0;
    }

    /* === 篩選區：緊湊橫向 + sticky === */
    .hgst-filter-header {
        position: sticky;
        top: 0;
        z-index: 20;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 0;
        margin: 0 0 10px 0;
        border-bottom: 1px solid #e0e0e0;
    }

    .hgst-filter-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
    }

    .hgst-filter-group label {
        flex-shrink: 0;
        width: auto;
        min-width: 56px;
        font-size: 13px;
        font-weight: 500;
        margin: 0;
        text-align: left;
    }

    .hgst-filter-group .hgst-select {
        flex: 1;
        min-width: 0;
        width: auto;
        height: 36px;
        font-size: 13px;
        padding: 0 26px 0 8px;
    }

    .hgst-filter-group .hgst-separator {
        display: inline;
        font-size: 12px;
        color: #999;
        flex-shrink: 0;
    }

    .hgst-sku-search-row {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        padding: 10px 0;
        margin-bottom: 0;
        width: 100%;
    }

    .hgst-sku-search-row label {
        flex: 0 0 auto;
        min-width: 56px;
        width: auto;
        font-size: 13px;
        font-weight: 500;
        margin: 0;
        text-align: left;
        white-space: nowrap;
    }

    .hgst-sku-search-input {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        max-width: none;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
    }

    .hgst-sku-search-btn {
        flex: 0 0 auto;
        height: 36px;
        padding: 0 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .hgst-sku-clear-btn {
        display: none !important;
    }

    /* === 商品網格：置中兩欄 === */
    .hgst-product-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        margin: 0;
        padding: 0;
    }

    .hgst-product-card {
        flex: 0 0 48%;
        max-width: 48%;
        padding: 0;
        margin-bottom: 16px;
        box-sizing: border-box;
    }

    .hgst-product-image {
        margin-bottom: 10px;
    }

    .hgst-product-title {
        font-size: 14px;
    }

    .hgst-product-weight {
        font-size: 12px;
    }

    .hgst-product-price {
        font-size: 14px;
    }

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

    .hgst-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .hgst-hero-banner img {
        max-height: 160px;
    }

    .hgst-load-more-container {
        margin-top: 24px;
        padding-top: 12px;
    }

    .hgst-loading, .hgst-no-products {
        padding: 40px 0;
    }
}

/* ===================== 手機版 SKU 搜尋緊湊版 v1.2.5 ===================== */
@media (max-width: 768px) {
    /* 縮短分類列與 SKU 搜尋列之間的空白 */
    .hgst-sidebar {
        margin-bottom: 8px !important;
    }

    .hgst-tag-list {
        margin-bottom: 0 !important;
    }

    /* SKU 搜尋列改為貼齊下方篩選列的緊湊高度 */
    .hgst-sku-search-row {
        padding: 0 !important;
        margin: 0 0 8px 0 !important;
        gap: 6px !important;
        line-height: 1.2 !important;
    }

    .hgst-sku-search-row label,
    .hgst-filter-group label {
        min-width: 56px !important;
        font-size: 13px !important;
        line-height: 36px !important;
    }

    .hgst-sku-search-input,
    .hgst-sku-search-btn,
    .hgst-filter-group .hgst-select {
        height: 36px !important;
        font-size: 13px !important;
        box-sizing: border-box !important;
    }

    .hgst-sku-search-input {
        padding: 0 8px !important;
    }

    .hgst-sku-search-btn {
        padding: 0 12px !important;
    }

    /* 縮短 SKU 搜尋列與篩選條件之間的距離 */
    .hgst-filter-header {
        padding: 0 0 8px 0 !important;
        margin: 0 0 10px 0 !important;
        gap: 6px !important;
    }
}


/* ===================== 單一商品頁黃金重量 Shortcode v1.2.6 ===================== */
.htg-single-product-weight {
    font-size: 18px;
    color: #666666;
    margin: 4px 0 10px;
    line-height: 1.6;
    letter-spacing: 0.03em;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

@media (max-width: 768px) {
    .htg-single-product-weight {
        font-size: 16px;
        margin: 3px 0 8px;
        line-height: 1.5;
    }
}
