/* ===================================
   IMAGE GALLERY COMPONENT
   Mobile: Swipeable carousel with dots
   Desktop: Main image with arrow navigation
   =================================== */

/* Gallery Container */
.product-gallery {
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* ===================================
   MOBILE GALLERY (Swipeable)
   =================================== */

@media (max-width: 768px) {
    .gallery-swiper {
        position: relative;
        width: 100%;
        overflow: hidden;
        touch-action: pan-y pinch-zoom;
        cursor: grab;
    }

    .gallery-swiper.dragging {
        cursor: grabbing;
    }

    .gallery-images-container {
        display: flex;
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        will-change: transform;
    }

    .gallery-images-container.no-transition {
        transition: none;
    }

    .gallery-image {
        flex-shrink: 0;
        width: 100%;
        height: auto;
        object-fit: cover;
        border-radius: 15px;
        display: block;
    }

    /* Dots Indicator */
    .gallery-dots {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem 0;
        margin-top: 0.5rem;
    }

    .gallery-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(139, 69, 19, 0.3);
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .gallery-dot.active {
        width: 24px;
        border-radius: 4px;
        background: var(--color-gold);
    }

    .gallery-dot:hover {
        background: rgba(139, 69, 19, 0.5);
    }

    /* Hide arrows on mobile */
    .gallery-arrow {
        display: none;
    }
}

/* ===================================
   DESKTOP GALLERY (Arrow Navigation)
   =================================== */

@media (min-width: 769px) {
    .product-gallery {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Main Image */
    .gallery-main-image-container {
        width: 100%;
        border-radius: 15px;
        overflow: hidden;
        background: var(--color-cream);
        position: relative;
    }

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

    .gallery-main-image.fade-in {
        animation: fadeInImage 0.3s ease;
    }

    /* Navigation Arrows */
    .gallery-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.9);
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
        transition: all 0.3s ease;
        color: var(--color-primary);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }

    .gallery-arrow:hover {
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transform: translateY(-50%) scale(1.1);
    }

    .gallery-arrow-prev {
        left: 1rem;
    }

    .gallery-arrow-next {
        right: 1rem;
    }

    /* Hide mobile elements on desktop */
    .gallery-swiper {
        display: none;
    }

    .gallery-dots {
        display: none;
    }
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeInImage {
    from {
        opacity: 0.5;
    }
    to {
        opacity: 1;
    }
}

/* Loading State */
.gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: var(--color-cream);
    border-radius: 15px;
}

.gallery-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-gold);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===================================
   UTILITY CLASSES
   =================================== */

.gallery-image-wrapper {
    position: relative;
    width: 100%;
}

/* Image badge (e.g., "Main", "Back view") */
.gallery-image-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* No images state */
.gallery-no-images {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: var(--color-cream);
    border-radius: 15px;
    color: rgba(44, 24, 16, 0.5);
    font-size: 1rem;
}

/* Product Page Gallery Constraints */
.product-gallery-wrapper .gallery-main-image {
    max-height: 600px;
    object-fit: contain;
}

@media (max-width: 768px) {
    .product-gallery-wrapper .gallery-main-image,
    .product-gallery-wrapper .gallery-image {
        max-height: 400px;
        object-fit: contain;
    }
}
