/* 燈箱樣式 */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.show {
    opacity: 1;
}

.lightbox-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 10003;
    padding: 10px;
    line-height: 1;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    transform: scale(1.1);
}

.lightbox-image-container {
    position: relative;
    display: block;
    width: 100%;
    height: 80vh;
    overflow: hidden;
    text-align: center;
}

#lightbox-image {
    height: 100% !important;
    width: auto !important;
    max-width: none !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 auto !important;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    z-index: 10002;
    padding: 0;
    line-height: 1;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 50px;
}

.lightbox-next {
    right: 50px;
}

/* 燈箱縮圖列表 */
.lightbox-thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 0 20px;
    max-width: 90vw;
    overflow-x: auto;
    scrollbar-width: thin;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.lightbox-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.lightbox-thumb:hover {
    opacity: 0.8;
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

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

@media (max-width: 768px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .lightbox-prev {
        left: 20px;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 25px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-thumb {
        width: 65px;
        height: 50px;
    }
    
    .lightbox-thumbnails {
        gap: 8px;
        padding: 0 15px;
    }
    
    /* 手機版燈箱圖片樣式 - 以寬度為主，不隱藏超出部分 */
    .lightbox-image-container {
        height: auto !important;
        overflow: visible !important;
    }
    
    #lightbox-image {
        height: auto !important;
        width: 100% !important;
        max-width: 100vw !important;
        object-fit: contain !important;
    }
    
    .lightbox-content {
        width: 95vw !important;
        height: auto !important;
        max-height: 95vh !important;
    }
}

/* 主圖片和縮圖導航樣式 */
.main-image {
    height: 660px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
}

.main-image img {
    height: 100% !important;
    width: auto !important;
    max-width: none !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 auto !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* 產品頁面的圖片置中 */
.product-image-slider .item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100%;
}

.product-image-slider .item img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 auto !important;
}

.thumbnail-container {
    margin-top: 10px;
    min-height: 80px;
    position: relative;
    display: block !important;
}

.thumbnails-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}

.thumbnails-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.thumbnail-item {
    flex: 0 0 auto;
    width: 100px;
    height: 70px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thumbnail-item:hover {
    opacity: 0.8;
}

.thumbnail-item.active {
    border-color: #007bff;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 導航箭頭樣式 */
.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    z-index: 3;
    padding: 0;
    line-height: 1;
}

.image-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.image-nav:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

/* 縮圖導航按鈕樣式 */
.thumbnail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

.thumbnail-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.thumbnail-nav:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

.thumbnail-prev {
    left: 10px;
}

.thumbnail-next {
    right: 10px;
}
