/**
 * Image Gallery Styles
 * สไตล์สำหรับแกลเลอรี่รูปภาพในหน้ารายละเอียดสินค้า
 */

/* Main Image Container */
.product-images .main-image {
    position: relative;
    overflow: hidden;
}

.product-images .main-image img {
    transition: transform 0.3s ease, opacity 0.15s ease;
}

.product-images .main-image:hover img {
    transform: scale(1.05);
}

/* Navigation Arrows */
.product-images .main-image button {
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.product-images .main-image button:hover {
    transform: scale(1.1);
}

/* Image Counter */
.product-images .main-image .absolute.bottom-4.right-4 {
    backdrop-filter: blur(4px);
    font-weight: 500;
}

/* Zoom Icon */
.product-images .main-image .absolute.top-4.right-4 {
    backdrop-filter: blur(4px);
}

/* Thumbnail Container */
.thumbnail-container {
    position: relative;
}

.thumbnail-images {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

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

.thumbnail-images img {
    transition: all 0.3s ease;
    min-width: 80px;
    min-height: 80px;
}

.thumbnail-images img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.thumbnail-images img.thumbnail-active {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

/* Thumbnail Navigation Buttons */
.thumbnail-container button {
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.thumbnail-container button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Modal Styles */
#imageModal {
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

#imageModal.show {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal Image */
#modalImage {
    transition: opacity 0.3s ease;
    max-height: calc(100vh - 200px);
}

/* Modal Navigation */
#imageModal button {
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

#imageModal button:hover {
    transform: scale(1.1);
}

/* Modal Thumbnails */
.modal-thumbnail {
    transition: all 0.3s ease;
    opacity: 0.7;
}

.modal-thumbnail:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-thumbnail.border-white {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Loading Animation */
#modalLoading {
    backdrop-filter: blur(4px);
}

#modalLoading .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-images .main-image {
        height: 300px;
    }
    
    .product-images .main-image img {
        height: 300px;
    }
    
    .thumbnail-images img {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
    }
    
    .modal-thumbnail {
        width: 48px;
        height: 48px;
    }
    
    #imageModal .absolute.top-4 {
        top: 1rem;
        left: 1rem;
        right: 1rem;
    }
    
    #imageModal .absolute.bottom-4 {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .product-images .main-image {
        height: 250px;
    }
    
    .product-images .main-image img {
        height: 250px;
    }
    
    .thumbnail-images img {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
    }
    
    .modal-thumbnail {
        width: 40px;
        height: 40px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .product-images .main-image img,
    .thumbnail-images img,
    .modal-thumbnail,
    #imageModal,
    #modalImage {
        transition: none;
    }
    
    .product-images .main-image:hover img {
        transform: none;
    }
    
    .thumbnail-images img:hover,
    .thumbnail-images img.thumbnail-active {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .thumbnail-images img {
        border-width: 3px;
    }
    
    .thumbnail-images img.thumbnail-active {
        border-color: #000;
    }
    
    .modal-thumbnail.border-white {
        border-color: #fff;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
    }
}

/* Print Styles */
@media print {
    #imageModal {
        display: none !important;
    }
    
    .product-images .main-image button,
    .thumbnail-container button {
        display: none !important;
    }
}