/**
 * Product Gallery Styles
 *
 * Responsive image gallery with thumbnail navigation
 */

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

/* Main Image */
.gallery-main {
    width: 100%;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    aspect-ratio: 4 / 3;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Thumbnails Container */
.gallery-thumbnails {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gallery-thumbnails-wrapper {
    flex: 1;
    overflow: hidden;
    border-radius: 0.375rem;
}

.gallery-thumbnails-track {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 0.25rem 0;
}

.gallery-thumbnails-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Individual Thumbnail */
.gallery-thumbnail {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.gallery-thumbnail:hover {
    border-color: #d1d5db;
    transform: scale(1.05);
}

.gallery-thumbnail.active {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 1px var(--brand-500);
}

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

/* Navigation Buttons */
.gallery-nav {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.gallery-nav:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.gallery-nav:active {
    transform: scale(0.95);
}

.gallery-nav svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #374151;
}

.gallery-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tablet Styles */
@media (max-width: 1024px) {
    .gallery-thumbnail {
        width: 70px;
        height: 70px;
    }
}

/* Mobile Styles */
@media (max-width: 640px) {
    .gallery-main {
        aspect-ratio: 1 / 1;
        margin-bottom: 0.75rem;
    }

    .gallery-thumbnail {
        width: 60px;
        height: 60px;
    }

    .gallery-nav {
        width: 1.75rem;
        height: 1.75rem;
    }

    .gallery-nav svg {
        width: 1rem;
        height: 1rem;
    }

    .gallery-thumbnails {
        gap: 0.375rem;
    }

    .gallery-thumbnails-track {
        gap: 0.375rem;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .gallery-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Loading State */
.gallery-main-image[src=""],
.gallery-main-image:not([src]) {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility */
.gallery-thumbnail:focus,
.gallery-nav:focus {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .gallery-thumbnails,
    .gallery-nav {
        display: none;
    }

    .gallery-main {
        page-break-inside: avoid;
    }
}
