/* =========================================
   Modern Product Gallery Styles
   ========================================= */

/* Gallery Container */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    position: relative;
}

/* Main Image Container */
.gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: zoom-in;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-main:hover .gallery-main-image {
    transform: scale(1.02);
}

/* Image Counter Badge */
.gallery-counter {
    position: absolute;
    bottom: var(--space-4);
    left: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    color: white;
    font-size: var(--text-sm);
    font-weight: 600;
}

.gallery-counter i {
    font-size: var(--text-xs);
}

/* Navigation Arrows */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--text-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
    border: none;
}

.gallery-main:hover .gallery-nav {
    opacity: 1;
}

.gallery-nav:hover {
    background: var(--primary-500);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
}

.gallery-nav:disabled:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    transform: translateY(-50%);
}

.gallery-nav.prev {
    left: var(--space-4);
}

.gallery-nav.next {
    right: var(--space-4);
}

/* Fullscreen Button */
.gallery-fullscreen {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    color: white;
    font-size: var(--text-base);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
    border: none;
}

.gallery-main:hover .gallery-fullscreen {
    opacity: 1;
}

.gallery-fullscreen:hover {
    background: var(--primary-500);
    transform: scale(1.1);
}

/* Product Badge */
.gallery-badge {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
}

.gallery-badge.new {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.gallery-badge.used {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* Thumbnail Strip */
.gallery-thumbs {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    padding: var(--space-2);
    margin: calc(-1 * var(--space-2));
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-300) transparent;
}

.gallery-thumbs::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
    background: var(--primary-300);
    border-radius: 3px;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    opacity: 0.6;
    background: none;
    padding: 0;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumb:hover {
    opacity: 1;
    border-color: var(--primary-300);
}

.gallery-thumb:hover img {
    transform: scale(1.1);
}

.gallery-thumb.active {
    opacity: 1;
    border-color: var(--primary-500);
    box-shadow: 0 4px 15px rgba(0, 180, 180, 0.3);
}

/* Single Image State */
.product-gallery.single-image .gallery-nav,
.product-gallery.single-image .gallery-counter,
.product-gallery.single-image .gallery-thumbs {
    display: none;
}

/* =========================================
   Lightbox Styles
   ========================================= */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--space-8);
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-4);
}

.lightbox-counter {
    color: white;
    font-size: var(--text-base);
    font-weight: 600;
}

.lightbox-actions {
    display: flex;
    gap: var(--space-2);
}

.lightbox-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: var(--text-lg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-close:hover {
    background: #ef4444;
}

.lightbox-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
    transition: transform 0.3s ease;
}

.lightbox-image.zoomed {
    cursor: zoom-out;
    transform: scale(1.5);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: var(--text-xl);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-nav:hover {
    background: var(--primary-500);
}

.lightbox-nav.prev {
    left: var(--space-4);
}

.lightbox-nav.next {
    right: var(--space-4);
}

.lightbox-thumbs {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    padding-top: var(--space-4);
    overflow-x: auto;
    max-width: 100%;
}

.lightbox-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    opacity: 0.5;
    background: none;
    padding: 0;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lightbox-thumb:hover {
    opacity: 0.8;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: var(--primary-500);
}

/* =========================================
   No Images Placeholder
   ========================================= */

.gallery-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: var(--radius-2xl);
    color: var(--text-muted);
    gap: var(--space-4);
}

.gallery-placeholder i {
    font-size: 4rem;
    opacity: 0.3;
}

.gallery-placeholder span {
    font-size: var(--text-base);
    font-weight: 500;
}

/* =========================================
   Responsive Styles
   ========================================= */

@media (max-width: 992px) {
    .gallery-main {
        aspect-ratio: 3/2;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: var(--text-base);
        opacity: 1;
    }

    .gallery-fullscreen {
        opacity: 1;
    }

    .gallery-thumb {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 768px) {
    .gallery-main {
        aspect-ratio: 1;
        border-radius: var(--radius-xl);
    }

    .gallery-nav {
        width: 36px;
        height: 36px;
    }

    .gallery-nav.prev {
        left: var(--space-2);
    }

    .gallery-nav.next {
        right: var(--space-2);
    }

    .gallery-thumb {
        width: 60px;
        height: 60px;
    }

    .lightbox-content {
        padding: var(--space-4);
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .lightbox-thumb {
        width: 50px;
        height: 50px;
    }
}

/* =========================================
   Touch/Swipe Support Indicator
   ========================================= */

@media (hover: none) {
    .gallery-nav {
        opacity: 1;
        width: 40px;
        height: 40px;
    }

    .gallery-fullscreen {
        opacity: 1;
    }
}

/* =========================================
   Animation Keyframes
   ========================================= */

@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-main-image.fade-in {
    animation: galleryFadeIn 0.3s ease forwards;
}

@keyframes lightboxZoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-overlay.active .lightbox-content {
    animation: lightboxZoomIn 0.3s ease forwards;
}

