/* 整體頁面設計 */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f9;
    margin: 0;
    padding: 0;
    color: #333;
}

/* 主容器：左右佈局 */
.container {
    display: flex;
    justify-content: flex-start;
    padding: 20px;
    max-width: 1440px;
    margin: 0 auto;
}

/* 左側分類選單 */
.sidebar-left {
    list-style: none;
    padding: 0;
    margin-right: 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 240px;
}

.sidebar-left li {
    margin-bottom: 10px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #fff;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.category-link:hover {
    background-color: #f0f0f0;
}

/* 商品詳細內容區塊 */
.item-detail-container {
    flex: 1;
    padding: 20px;
}

/* 商品詳細區域 */
.item-detail {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.item-detail h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

/* 購物車訊息 */
.cart-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    text-align: center;
}

.cart-message.success {
    background-color: #d4edda;
    color: #155724;
}

.cart-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* 詳細內容區域 */
.detail-content {
    display: flex;
    gap: 20px;
}

/* 商品圖片 */
.item-image {
    flex: 1;
}

.item-image img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 5px;
    cursor: pointer; /* 添加指針，提示可點擊 */
}

/* 商品資訊 */
.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 描述 */
.description {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
}

.description h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

/* 標籤 */
.tags {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 14px;
    color: white;
}

.tag.new {
    background-color: #2ecc71;
}

.tag.sale {
    background-color: #e74c3c;
}

/* 規格區域 */
.specifications {
    margin-top: 10px;
}

.variant-selector {
    margin-bottom: 15px;
}

.variant-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.variant-btn {
    padding: 8px 15px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 16px;
}

.variant-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.variant-btn:hover:not(.active) {
    background-color: #e0e0e0;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
    margin: 10px 0;
}

.stock {
    font-size: 16px;
    color: #333;
    margin: 10px 0;
}

.accessory {
    font-size: 16px;
    color: #333;
}

.accessory a {
    color: #007bff;
    text-decoration: none;
    margin-left: 5px;
}

.accessory a:hover {
    text-decoration: underline;
}

/* 數量選擇器 */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 15px 0;
}

.quantity-btn {
    padding: 5px 10px;
    font-size: 16px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
}

.quantity-btn:hover {
    background-color: #e0e0e0;
}

.quantity-input {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 16px;
}

/* 操作按鈕區域 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.add-to-cart, .back-btn {
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    border: none;
}

.add-to-cart {
    background-color: #007bff;
    color: white;
}

.add-to-cart:hover {
    background-color: #0056b3;
}

.add-to-cart:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.back-btn {
    background-color: #6c757d;
    color: white;
}

.back-btn:hover {
    background-color: #5a6268;
}

/* 詳細介紹圖片 */
.detail-images {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.detail-images h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
}

.detail-images-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-images-gallery img {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 5px;
    cursor: pointer; /* 添加指針，提示可點擊 */
}

/* 相關產品區域 */
.related-products {
    margin-top: 40px;
}

.related-products h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #333;
}

.related-items {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
}

.related-item {
    width: 150px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.related-item:hover {
    transform: translateY(-5px);
}

.related-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 10px;
}

.related-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 5px 5px 0 0;
}

.related-item h3 {
    font-size: 16px;
    margin: 10px 0;
    color: #333;
}

.related-item .price {
    font-size: 14px;
    color: #e74c3c;
}

/* 圖片放大模態框 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.image-modal.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 5px;
    display: block;
    margin: auto;
}

.image-modal .close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 1001;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 10px;
    }

    .sidebar-left {
        display: none;
    }

    .detail-content {
        flex-direction: column;
    }

    .item-image img {
        max-width: 100%;
    }

    .related-items {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .related-item {
        max-width: 300px;
        margin: 0 auto;
    }

    .detail-images-gallery img {
        max-width: 100%;
    }

    .image-modal img {
        max-width: 95%;
        max-height: 95%;
        transform: translate3d(0px, 246px, 0px) scale3d(1, 1, 1);
    }
}