/* Enhanced Product Gallery Styles */

.product-gallery {
    max-width: 100%;
}

.thumbnails-container {
    padding: 0;
}

.thumbnail-nav {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 8px;
    opacity: 0.7;
}

.thumbnail-nav:hover {
    opacity: 1;
    border-color: #007bff;
    transform: scale(1.05);
}

.thumbnail-nav.active {
    opacity: 1;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.main-product-image {
    transition: opacity 0.3s ease;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.main-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.image-nav-btn {
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image-container:hover .image-nav-btn {
    opacity: 0.8;
}

.image-nav-btn:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

/* Mobile-first responsive design */
@media (max-width: 991.98px) {
    /* Stack thumbnails horizontally on mobile/tablet */
    .thumbnails-container {
        justify-content: center;
        overflow-x: auto;
        padding: 10px 0;
        margin-bottom: 15px;
    }

    .thumbnail-nav {
        min-width: 80px;
    }

    .main-product-image {
        height: 400px !important;
    }

    .image-nav-btn {
        opacity: 0.9;
    }
}

@media (min-width: 992px) {
    /* Vertical thumbnail layout on desktop */
    .thumbnails-container {
        max-height: 500px;
        overflow-y: auto;
        padding-right: 10px;
    }

    .thumbnails-container::-webkit-scrollbar {
        width: 4px;
    }

    .thumbnails-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }

    .thumbnails-container::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 2px;
    }

    .thumbnails-container::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* Loading and lazy loading states */
.main-product-image.loading {
    opacity: 0.6;
    filter: blur(2px);
    transition: all 0.3s ease;
}

.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy:not(.lazy) {
    opacity: 1;
}

/* Placeholder for lazy images */
img[src*="data:image/svg+xml"] {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
}

/* Zoom hint */
.main-image-container::after {
    content: "🔍 Click to zoom";
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.main-image-container:hover::after {
    opacity: 1;
}

/* Touch-friendly improvements */
@media (hover: none) {
    .thumbnail-nav {
        opacity: 1;
    }

    .image-nav-btn {
        opacity: 0.7;
    }

    .main-image-container::after {
        content: "👆 Tap to zoom";
    }
}

/* Animation for image transitions */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.main-product-image {
    animation: fadeIn 0.3s ease;
}

/* Focus styles for accessibility */
.thumbnail-nav:focus,
.image-nav-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .thumbnail-nav.active {
        border-color: #000;
        box-shadow: 0 0 0 2px #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .thumbnail-nav,
    .main-product-image,
    .image-nav-btn {
        transition: none;
    }

    .main-product-image {
        animation: none;
    }
}