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

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

@media (max-width: 600px) {
    .product-list {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

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

/* 購物車添加按鈕 */
.add-to-cart-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;
}

.add-to-cart-btn:hover {
    transform: scale(1.1);
}

.add-to-cart-btn .icon-active {
    display: none;
}

.add-to-cart-btn.added .icon-default {
    display: none;
}

.add-to-cart-btn.added .icon-active {
    display: block;
}

.add-to-cart-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;
}

@media (max-width: 600px) {
    .product-title {
        font-size: 1.25em;
    }
}

/* 變體區塊 */
.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;
}

.variant-group {
    display: block;
}

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

/* --- 圖片輪播容器 --- */
.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;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.image-slider::-webkit-scrollbar {
    display: none;
}

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

@media (min-width: 768px) {
    .slider-arrow {
        display: flex;
    }
}
