/**
 * Novo Gallery - Modern Product Image Gallery
 * Ultra-Modern Design with Smooth Zoom & Lightbox
 * Version: 2.0
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    --novo-gallery-radius: 16px;
    --novo-gallery-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
    --novo-gallery-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --novo-accent: #1a1a1a;
    --novo-accent-light: #3a3a3a;
    --novo-bg-light: #f8f9fa;
    --novo-overlay: rgba(0, 0, 0, 0.92);
}

/* ============================================
   MAIN GALLERY CONTAINER
   ============================================ */

.novo-gallery {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   MAIN IMAGE SECTION
   ============================================ */

.novo-gallery__main {
    position: relative;
    width: 100%;
    background: var(--novo-bg-light);
    border-radius: var(--novo-gallery-radius);
    overflow: hidden;
    cursor: zoom-in;
    box-shadow: var(--novo-gallery-shadow);
    transition: var(--novo-gallery-transition);
}

.novo-gallery__main:hover {
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.15);
}

/* Main Image Wrapper */
.novo-gallery__main-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

/* Main Image */
.novo-gallery__main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    will-change: transform;
}

.novo-gallery__main:hover .novo-gallery__main-img {
    transform: scale(1.03);
}

/* Zoom Lens (Inner Zoom on Hover) */
.novo-gallery__lens {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.1);
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 50;
    transform: translate(-50%, -50%);
}

.novo-gallery__main.zooming .novo-gallery__lens {
    opacity: 1;
    visibility: visible;
}

/* Zoom Hint Badge */
.novo-gallery__zoom-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: var(--novo-gallery-transition);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

.novo-gallery__main:hover .novo-gallery__zoom-hint {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.novo-gallery__zoom-hint svg {
    width: 18px;
    height: 18px;
    color: var(--novo-accent);
}

.novo-gallery__zoom-hint span {
    font-size: 13px;
    font-weight: 600;
    color: var(--novo-accent);
    white-space: nowrap;
}

/* ============================================
   THUMBNAILS SECTION
   ============================================ */

.novo-gallery__thumbs {
    display: flex;
    gap: 12px;
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.novo-gallery__thumbs::-webkit-scrollbar {
    display: none;
}

/* Individual Thumbnail */
.novo-gallery__thumb {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--novo-bg-light);
    border: 3px solid transparent;
    position: relative;
    transition: var(--novo-gallery-transition);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.novo-gallery__thumb:hover {
    border-color: #ddd;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.novo-gallery__thumb.active {
    border-color: var(--novo-accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Active Checkmark */
.novo-gallery__thumb.active::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--novo-accent);
    border-radius: 50%;
    z-index: 2;
}

.novo-gallery__thumb.active::before {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

/* Thumbnail Image */
.novo-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    pointer-events: none;
}

.novo-gallery__thumb:hover img {
    transform: scale(1.1);
}

/* ============================================
   LIGHTBOX OVERLAY
   ============================================ */

.novo-lightbox {
    position: fixed;
    inset: 0;
    background: var(--novo-overlay);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    cursor: zoom-out;
    padding: 20px;
}

.novo-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Content */
.novo-lightbox__content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.novo-lightbox.active .novo-lightbox__content {
    transform: scale(1);
}

/* Lightbox Image */
.novo-lightbox__img {
    max-width: calc(100% - 120px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.3s ease;
}

/* Close Button */
.novo-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--novo-gallery-transition);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.novo-lightbox__close:hover {
    background: #fff;
    transform: rotate(90deg) scale(1.1);
}

.novo-lightbox__close svg {
    width: 24px;
    height: 24px;
    color: var(--novo-accent);
}

/* Navigation Arrows */
.novo-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--novo-gallery-transition);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.novo-lightbox__nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.novo-lightbox__nav.prev {
    left: 20px;
}

.novo-lightbox__nav.next {
    right: 20px;
}

.novo-lightbox__nav svg {
    width: 24px;
    height: 24px;
    color: var(--novo-accent);
}

.novo-lightbox__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.novo-lightbox__nav:disabled:hover {
    transform: translateY(-50%);
}

/* Image Counter */
.novo-lightbox__counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: var(--novo-accent);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* Loading Spinner */
.novo-lightbox__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: novo-spin 0.8s linear infinite;
    z-index: 5;
}

@keyframes novo-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Thumbnail Strip in Lightbox */
.novo-lightbox__thumbs {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    max-width: 90%;
    overflow-x: auto;
    scrollbar-width: none;
    z-index: 10;
}

.novo-lightbox__thumbs::-webkit-scrollbar {
    display: none;
}

.novo-lightbox__thumbs-item {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--novo-gallery-transition);
    border: 2px solid transparent;
}

.novo-lightbox__thumbs-item:hover {
    opacity: 0.8;
}

.novo-lightbox__thumbs-item.active {
    opacity: 1;
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.novo-lightbox__thumbs-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* ============================================
   BODY STATE WHEN LIGHTBOX IS OPEN
   ============================================ */

body.novo-lightbox-active {
    overflow: hidden !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .novo-gallery__main {
        border-radius: 12px;
    }
    
    .novo-gallery__zoom-hint {
        display: none;
    }
    
    .novo-gallery__lens {
        display: none !important;
    }
    
    .novo-gallery__thumbs {
        gap: 10px;
    }
    
    .novo-gallery__thumb {
        flex: 0 0 65px;
        width: 65px;
        height: 65px;
        border-radius: 10px;
        border-width: 2px;
    }
    
    .novo-gallery__thumb.active::after,
    .novo-gallery__thumb.active::before {
        width: 16px;
        height: 16px;
        font-size: 9px;
        top: 4px;
        right: 4px;
    }
    
    .novo-lightbox__img {
        max-width: 100%;
        max-height: 80vh;
        border-radius: 8px;
    }
    
    .novo-lightbox__close {
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }
    
    .novo-lightbox__close svg {
        width: 20px;
        height: 20px;
    }
    
    .novo-lightbox__nav {
        width: 44px;
        height: 44px;
    }
    
    .novo-lightbox__nav.prev {
        left: 10px;
    }
    
    .novo-lightbox__nav.next {
        right: 10px;
    }
    
    .novo-lightbox__nav svg {
        width: 20px;
        height: 20px;
    }
    
    .novo-lightbox__counter {
        bottom: 20px;
        padding: 8px 18px;
        font-size: 13px;
    }
    
    .novo-lightbox__thumbs {
        bottom: 60px;
        padding: 8px;
        gap: 8px;
    }
    
    .novo-lightbox__thumbs-item {
        flex: 0 0 50px;
        width: 50px;
        height: 50px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .novo-gallery__thumb {
        flex: 0 0 55px;
        width: 55px;
        height: 55px;
    }
    
    .novo-lightbox__nav {
        width: 40px;
        height: 40px;
    }
    
    .novo-lightbox__nav svg {
        width: 18px;
        height: 18px;
    }
    
    .novo-lightbox__thumbs {
        display: none;
    }
}

/* ============================================
   RTL SUPPORT
   ============================================ */

html[dir="rtl"] .novo-lightbox__close {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .novo-lightbox__nav.prev {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .novo-lightbox__nav.next {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .novo-gallery__thumb.active::after,
html[dir="rtl"] .novo-gallery__thumb.active::before {
    right: auto;
    left: 6px;
}

@media (max-width: 768px) {
    html[dir="rtl"] .novo-lightbox__close {
        left: 15px;
    }
    
    html[dir="rtl"] .novo-lightbox__nav.prev {
        right: 10px;
    }
    
    html[dir="rtl"] .novo-lightbox__nav.next {
        left: 10px;
    }
    
    html[dir="rtl"] .novo-gallery__thumb.active::after,
    html[dir="rtl"] .novo-gallery__thumb.active::before {
        left: 4px;
    }
}

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

@keyframes novo-fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.novo-gallery__thumb {
    animation: novo-fadeIn 0.5s ease forwards;
    opacity: 0;
}

.novo-gallery__thumb:nth-child(1) { animation-delay: 0.05s; }
.novo-gallery__thumb:nth-child(2) { animation-delay: 0.1s; }
.novo-gallery__thumb:nth-child(3) { animation-delay: 0.15s; }
.novo-gallery__thumb:nth-child(4) { animation-delay: 0.2s; }
.novo-gallery__thumb:nth-child(5) { animation-delay: 0.25s; }
.novo-gallery__thumb:nth-child(6) { animation-delay: 0.3s; }
.novo-gallery__thumb:nth-child(7) { animation-delay: 0.35s; }
.novo-gallery__thumb:nth-child(8) { animation-delay: 0.4s; }

/* Smooth image transition */
.novo-gallery__main-img.changing {
    opacity: 0.4;
    transform: scale(0.98);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.novo-lightbox__close:focus,
.novo-lightbox__nav:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.novo-gallery__thumb:focus {
    outline: 3px solid var(--novo-accent);
    outline-offset: 2px;
}

/* ============================================
   HIDE DEFAULT WOOCOMMERCE GALLERY STYLES
   ============================================ */

.woocommerce-product-gallery {
    opacity: 1 !important;
    position: relative !important;
}

.woocommerce-product-gallery__wrapper {
    display: none !important;
}

.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery .flex-control-nav,
.woocommerce-product-gallery .flex-control-thumbs,
.woocommerce-product-gallery .flex-direction-nav {
    display: none !important;
}

/* Our gallery takes over */
.novo-gallery {
    display: flex !important;
}



