/* --- 全局設置 --- */
* { 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);
    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; }

/* 圖片 */
.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; 
    margin-top: auto; 
}

.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; 
}

.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; 
}