/* --- 全局設置 --- */
* {
    box-sizing: border-box;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    padding: 20px;
    margin: 0;
    color: #444;
    line-height: 1.6;
    background-color: #faf9f8;
}

/* --- Header --- */
.header-info {
    margin-bottom: 20px;
    padding: 25px;
    background-color: #fff;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.header-info h1 {
    margin-top: 0;
    font-size: 1.5em;
    color: #333;
    margin-bottom: 10px;
}

.intro-text {
    margin-bottom: 15px;
}

.order-section {
    background-color: #fffaf5;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #d4b29f;
}

.order-title {
    font-weight: bold;
    color: #8b6e5e;
    margin-bottom: 8px;
}

.order-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.95em;
}

.order-steps li {
    margin-bottom: 6px;
}

/* --- 頁籤導航 (Tabs) --- */
.tab-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    gap: 15px;
}

.tab-btn {
    padding: 12px 30px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    background-color: #fff;
    color: #888;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.tab-btn.active {
    border-color: #8b6e5e;
    background-color: #8b6e5e;
    color: #fff;
    box-shadow: 0 4px 10px rgba(139, 110, 94, 0.3);
}

.tab-btn:hover:not(.active) {
    border-color: #d4b29f;
    color: #8b6e5e;
}

/* 內容區塊控制 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- 產品列表 --- */
.product-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.product-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background-color: #fff;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    position: relative;
    /* 為了定位愛心按鈕 */
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* 愛心收藏按鈕 */
.heart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: transform 0.2s;
}

.heart-btn:hover {
    transform: scale(1.1);
}

.heart-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #ccc;
    stroke-width: 2;
    transition: all 0.2s;
}

/* 已收藏狀態 */
.heart-btn.liked .heart-icon {
    fill: #e65555;
    stroke: #e65555;
}

.heart-btn.loaded {
    opacity: 1;
}

/* 商品主檔表 - 商品角標 (左上角) */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background: rgba(139, 110, 94, 0.95);
    color: #fff;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    /* 避免干擾底下圖片點擊或滑動 */
    letter-spacing: 1px;
}

/* 圖片 */
.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fcfcfc;
    position: relative;
    overflow: hidden;
    cursor: default;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

/* 內容 */
.product-details {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    margin-bottom: 15px;
    font-size: 1.15em;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
    cursor: default;
}

/* 變體區塊 */
/* --- 1. 變體區塊整體設定 (保留) --- */
.variant-info {
    font-size: 0.9em;
    color: #666;
}

.variant-info strong {
    display: block;
    margin-bottom: 10px;
    font-weight: normal;
    color: #888;
    font-size: 0.9em;
}

/* --- 2. 標籤容器 (修改) --- */
/* 改成 block 讓 inline-block 的標籤自然排列換行 */
.variant-group {
    display: block;
    /* 舊的 display: flex; gap: 8px; 可以拿掉，因為下面標籤有設 margin */
}

/* --- 3. 變體標籤 (可愛膠囊風 - 新增) --- */
.variant-tag {
    display: inline-block;
    /* 讓標籤像積木一樣排列 */
    padding: 5px 12px;
    /* 內距稍微胖一點比較可愛 */
    border: 1px solid #ebdcd6;
    /* 很淺的暖粉棕色邊框 */
    border-radius: 50px;
    /* ★ 關鍵：改成圓潤的膠囊狀 */
    background-color: #fff;
    /* 白底看起來比較乾淨 */
    color: #7a6256;
    /* 深暖棕色文字 */
    font-size: 0.85em;
    margin-right: 6px;
    /* 標籤之間的距離 */
    margin-bottom: 8px;
    cursor: default;
    /* ★ 關鍵：滑鼠移過去「不會」變手型，看起來就不像按鈕 */
    letter-spacing: 0.5px;
    /* 字距稍微寬一點點 */
}

/* 強調款式名稱 (加粗的部分) */
.variant-tag b {
    color: #8b6e5e;
    font-weight: 700;
}

/* --- 售完狀態 --- */
.variant-tag.out-of-stock {
    background-color: #f7f7f7;
    /* 淺灰底 */
    border-color: #eeeeee;
    /* 幾乎看不見的灰邊框 */
    color: #cccccc;
    /* 淺灰色文字 */
    text-decoration: line-through;
    /* 刪除線 */
}

.variant-tag.out-of-stock b {
    color: #cccccc;
}

/* --- 分頁樣式 --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    margin-bottom: 40px;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination.is-loading {
    pointer-events: none;
    /* 讓滑鼠無法再點擊任何裡面的按鈕 */
    opacity: 0.5;
    /* 讓整個分頁區塊變半透明，提示使用者「載入中」 */
    cursor: wait;
    /* 滑鼠變成轉圈圈 */
}

.page-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 38px;
    height: 38px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #555;
    text-decoration: none;
    border-radius: 50%;
    font-size: 1em;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-btn:hover {
    background-color: #f5eee9;
    border-color: #d4b29f;
    color: #8b6e5e;
    transform: translateY(-1px);
}

.page-btn.active {
    background-color: #8b6e5e;
    border-color: #8b6e5e;
    color: #fff;
    font-weight: bold;
    pointer-events: none;
}

.page-arrow {
    border-radius: 8px;
    padding: 0 14px;
    width: auto;
    font-weight: bold;
    color: #8b6e5e;
}

/* --- 願望清單樣式 --- */
.wishlist-empty {
    text-align: center;
    padding: 50px;
    color: #999;
    font-size: 1.1em;
}

.wishlist-actions {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #fffaf5;
    border-radius: 8px;
    color: #8b6e5e;
}

@media (max-width: 1024px) {
    .product-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    .header-info {
        padding: 20px;
    }

    .product-list {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .product-title {
        font-size: 1.25em;
    }

    .tab-btn {
        padding: 10px 20px;
        font-size: 1em;
    }
}

/* --- 新增：圖片輪播容器 --- */
.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    /* 保持正方形 */
    background-color: #fcfcfc;
    border-bottom: 1px solid #f0f0f0;
    overflow: hidden;
}

/* 左右滑動區域 */
.image-slider {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    /* 允許水平滾動 */
    scroll-snap-type: x mandatory;
    /* 核心：強制捕捉滾動位置 */
    scroll-behavior: smooth;
    /* 平滑滾動 */

    /* 隱藏滾動條 (Chrome, Safari, Opera) */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

.image-slider::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
}

/* 單張圖片項目 */
.slider-item {
    flex: 0 0 100%;
    /* 每個項目佔滿寬度 */
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    /* 滾動時對齊開頭 */
}

.slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- 小圓點樣式 --- */
.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.6);
    /* 增加一點背景讓圓點更清楚 */
    padding: 4px 8px;
    border-radius: 10px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #ccc;
    border-radius: 50%;
    transition: all 0.3s;
}

.dot.active {
    background-color: #8b6e5e;
    /* 您的主色調 */
    transform: scale(1.2);
}

/* --- 左右箭頭樣式 (預設隱藏，手機版不顯示) --- */
.slider-arrow {
    display: none;
    /* 手機版預設不顯示 */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    /* 半透明白底 */
    border: 1px solid #eee;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    font-size: 14px;
    color: #8b6e5e;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

/* 滑鼠移到按鈕上時的效果 */
.slider-arrow:hover {
    background-color: #8b6e5e;
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

.slider-arrow.prev {
    left: 10px;
}

.slider-arrow.next {
    right: 10px;
}

/* --- 電腦版/平板規則 (螢幕大於 768px 時顯示箭頭) --- */
@media (min-width: 768px) {
    .slider-arrow {
        display: flex;
        /* 強制顯示 (不需滑鼠滑過) */
    }
}

/* --- 橫向分類選單樣式 (膠囊按鈕) --- */

/* --- 1. 調整警語樣式 (加大距離) --- */
.header-info .warning-msg {
    display: block;
    /* 讓它變成區塊元素，才能吃 margin */
    margin-top: 24px;
    /* 距離上方的框框遠一點 */
    color: #8b6e5e;
    /* 顏色跟主題一致 (可選) */
    font-size: 14px;
    font-weight: 500;
}

/* (原本的 category-nav 保持 inline-flex 不變，配合上面的 text-align: center 就能置中) */
.category-nav {
    display: inline-flex;
    gap: 12px;
    padding: 0 10px;
    /* 移除任何 float 或 width: 100% 設定 */
}

.category-nav-wrapper {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 5px;
    margin-bottom: 15px;
    background-color: #fff;

    /* ★ 新增這行：讓內部的 inline-flex 元素置中 */
    text-align: center;

    -ms-overflow-style: none;
    scrollbar-width: none;
}


.category-nav-wrapper::-webkit-scrollbar {
    display: none;
}

.category-nav {
    display: inline-flex;
    gap: 12px;
    padding: 0 10px;
    /* 移除任何 float 或 width: 100% 設定 */
}

.cat-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 50px;
    /* 膠囊圓角 */
    border: 1px solid #e0e0e0;
    background-color: #fff;

    /* 文字顏色改為指定色 */
    color: #665145;

    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    /* 防止按鈕被壓縮 */
    line-height: 1.2;
}

.cat-btn:hover {
    background-color: #fcfcfc;
    border-color: #ccc;
}

/* 選中狀態 (深咖啡色背景) */
.cat-btn.active {
    background-color: #8b6e5e;
    color: #fff;
    border-color: #8b6e5e;
    box-shadow: 0 4px 6px rgba(139, 110, 94, 0.2);
}

/* 願望清單按鈕特別樣式 */
.cat-btn.wishlist-btn {
    color: #665145;
    /* 保持一致 */
}

.cat-btn.wishlist-btn.active {
    background-color: #fff;
    color: #d9534f;
    /* 點擊後變紅 */
    border-color: #d9534f;
    box-shadow: none;
}

/* 搜尋與篩選區塊 */
.search-filter-section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #bfa59a;
}

.filter-select {
    padding: 10px 30px 10px 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fcfcfc;
    font-size: 0.95em;
    color: #555;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23bfa59a%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px auto;
}

.search-btn {
    padding: 10px 20px;
    background-color: #bfa59a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: bold;
}

.search-btn:hover {
    background-color: #a88e84;
}

.clear-btn {
    padding: 10px 15px;
    color: #888;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s;
}

.clear-btn:hover {
    color: #e65555;
}

@media (max-width: 600px) {
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .search-btn {
        width: 100%;
    }
    .clear-btn {
        text-align: center;
    }
}