/**
 * Modern Product Gallery Styles
 * Stylish and Modern Design with Lightbox Popup
 */

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

.novo-modern-gallery {
    position: relative;
    width: 100%;
}

.novo-gallery-main-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.novo-gallery-main-container:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* ============================================
   MAIN IMAGE STYLES
   ============================================ */

.woocommerce-product-gallery__wrapper {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fafafa;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woocommerce-product-gallery__image {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide all gallery images except the first one */
.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:not(:first-child) {
    display: none !important;
}

.woocommerce-product-gallery__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    background: #fff;
}

.woocommerce-product-gallery__image:hover img {
    transform: scale(1.05);
}

.woocommerce-product-gallery__image a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

/* ============================================
   ZOOM INDICATOR OVERLAY
   ============================================ */

.novo-zoom-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.novo-gallery-main-container:hover .novo-zoom-indicator {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

.novo-zoom-indicator svg {
    width: 20px;
    height: 20px;
    color: #333;
    flex-shrink: 0;
}

.novo-zoom-indicator span {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* ============================================
   THUMBNAILS STYLES
   ============================================ */

.flex-control-thumbs,
.flex-control-nav {
    display: flex !important;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
    -webkit-overflow-scrolling: touch;
}

.flex-control-thumbs::-webkit-scrollbar,
.flex-control-nav::-webkit-scrollbar {
    height: 4px;
}

.flex-control-thumbs::-webkit-scrollbar-track,
.flex-control-nav::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.flex-control-thumbs::-webkit-scrollbar-thumb,
.flex-control-nav::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.flex-control-thumbs::-webkit-scrollbar-thumb:hover,
.flex-control-nav::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.flex-control-thumbs li,
.flex-control-nav li {
    flex: 0 0 90px;
    width: 90px;
    height: 90px;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.flex-control-thumbs li:hover,
.flex-control-nav li:hover {
    border-color: #ddd;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.flex-control-thumbs li.flex-active-slide,
.flex-control-nav li.flex-active-slide {
    border-color: #1a1a1a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.flex-control-thumbs li.flex-active-slide::after,
.flex-control-nav li.flex-active-slide::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.flex-control-thumbs li.flex-active-slide::before,
.flex-control-nav li.flex-active-slide::before {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.flex-control-thumbs li img,
.flex-control-nav li img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.flex-control-thumbs li:hover img,
.flex-control-nav li:hover img {
    transform: scale(1.1);
}

/* ============================================
   LIGHTBOX/POPUP STYLES
   ============================================ */

.novo-lightbox-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
    background: rgba(0, 0, 0, 0) !important;
    backdrop-filter: blur(0px);
    z-index: 9999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: zoom-out;
    overflow: auto !important;
    box-sizing: border-box !important;
}

.novo-lightbox-overlay.active {
    background: rgba(0, 0, 0, 0.95) !important;
    backdrop-filter: blur(10px);
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.novo-lightbox-container {
    position: relative !important;
    max-width: 95vw !important;
    max-height: 95vh !important;
    width: 100% !important;
    height: 100% !important;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: auto !important;
    z-index: 10000000 !important;
    padding: 0 80px !important;
    box-sizing: border-box !important;
}

@media (max-width: 768px) {
    .novo-lightbox-container {
        padding: 0 !important;
    }
}

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

.novo-lightbox-image {
    max-width: calc(100% - 100px) !important;
    max-height: 95vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 12px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
    animation: lightboxFadeIn 0.4s ease;
    margin: 0 auto !important;
    flex-shrink: 0 !important;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.novo-lightbox-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 48px !important;
    height: 48px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: none !important;
    border-radius: 50% !important;
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #333 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000001 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.novo-lightbox-close:hover {
    background: #fff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.novo-lightbox-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* Navigation Arrows */
.novo-lightbox-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #333 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000001 !important;
    opacity: 0.8;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.novo-lightbox-nav:hover {
    background: #fff !important;
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.novo-lightbox-nav.prev {
    left: 20px !important;
    right: auto !important;
}

.novo-lightbox-nav.next {
    right: 20px !important;
    left: auto !important;
}

.novo-lightbox-nav svg {
    width: 24px;
    height: 24px;
}

.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 !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000001 !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

/* 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: spin 0.8s linear infinite;
    z-index: 5;
}

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

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

@media (max-width: 768px) {
    .novo-gallery-main-container {
        border-radius: 16px;
        margin-bottom: 15px;
    }
    
    .woocommerce-product-gallery__wrapper {
        aspect-ratio: 1;
    }
    
    .novo-zoom-indicator {
        bottom: 15px;
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .novo-zoom-indicator svg {
        width: 18px;
        height: 18px;
    }
    
    .novo-zoom-indicator span {
        font-size: 12px;
    }
    
    .flex-control-thumbs li,
    .flex-control-nav li {
        flex: 0 0 70px;
        width: 70px;
        height: 70px;
        border-radius: 10px;
    }
    
    .novo-lightbox-container {
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .novo-lightbox-close {
        top: 10px !important;
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
        z-index: 10000002 !important;
    }
    
    .novo-lightbox-nav {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        position: absolute !important;
    }
    
    .novo-lightbox-nav.prev {
        left: 10px !important;
        right: auto !important;
    }
    
    .novo-lightbox-nav.next {
        right: 10px !important;
        left: auto !important;
    }
    
    .novo-lightbox-image {
        max-width: 100% !important;
        max-height: 100vh !important;
        width: auto !important;
        height: auto !important;
    }
    
    .novo-lightbox-counter {
        bottom: 10px !important;
        font-size: 12px !important;
        padding: 6px 12px !important;
        z-index: 10000002 !important;
    }
}

@media (max-width: 480px) {
    .flex-control-thumbs li,
    .flex-control-nav li {
        flex: 0 0 60px;
        width: 60px;
        height: 60px;
    }
    
    .novo-zoom-indicator {
        padding: 8px 12px;
    }
    
    .novo-zoom-indicator span {
        display: none;
    }
}

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

html[dir="rtl"] .novo-lightbox-close {
    right: auto;
    left: 0;
}

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

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

@media (max-width: 768px) {
    html[dir="rtl"] .novo-lightbox-close {
        right: auto;
        left: 10px;
    }
    
    html[dir="rtl"] .novo-lightbox-nav.prev {
        right: auto;
        left: 10px;
    }
    
    html[dir="rtl"] .novo-lightbox-nav.next {
        left: auto;
        right: 10px;
    }
}

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

.novo-lightbox-overlay:focus-within {
    outline: none;
}

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

/* Prevent body scroll when lightbox is open */
body.novo-lightbox-open {
    overflow: hidden !important;
    padding-right: 0 !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

body.novo-lightbox-open * {
    pointer-events: none;
}

body.novo-lightbox-open .novo-lightbox-overlay,
body.novo-lightbox-open .novo-lightbox-overlay * {
    pointer-events: auto !important;
}

