/**
 * Enhanced Image Gallery with Thumbnails
 * Modern, responsive image gallery with smooth transitions
 */

.product-images {
    position: relative;
}

.main-image {
    position: relative;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.image-thumbnails {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 transparent;
}

.image-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.image-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.image-thumbnails::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.image-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.thumbnail {
    position: relative;
    width: 80px;
    height: 80px;
    min-width: 80px;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    flex-shrink: 0;
}

.thumbnail:hover {
    border-color: #146eb4;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(20, 110, 180, 0.2);
}

.thumbnail.active {
    border-color: #146eb4;
    box-shadow: 0 0 0 3px rgba(20, 110, 180, 0.1);
}

.thumbnail.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #146eb4;
    border-radius: 6px;
    pointer-events: none;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumbnail:hover img {
    transform: scale(1.1);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .main-image {
        min-height: 300px;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }
    
    .image-thumbnails {
        gap: 0.5rem;
        padding: 0.25rem;
    }
}

/* Loading state */
.main-image.loading {
    opacity: 0.6;
}

.main-image.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #146eb4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Zoom indicator */
.zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 12px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.main-image:hover .zoom-icon {
    opacity: 1;
}

/* Fullscreen gallery view */
.gallery-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gallery-fullscreen.active {
    display: flex;
}

.gallery-fullscreen-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.gallery-fullscreen-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-nav.prev {
    left: 20px;
}

.gallery-nav.next {
    right: 20px;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

