/**
 * ZephyrGalleryElla Styles
 * Version: 1.0.0
 */

/* استایل‌های عمومی گالری */
.woocommerce-product-gallery__image a {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.woocommerce-product-gallery__image a:hover {
    text-decoration: none !important;
}


/* Container اصلی گالری */
.woocommerce-product-gallery {
    position: relative !important;
}

/* ========== FlexSlider Animation Speed & Smoothness ========== */
.flexslider,
.flexslider .slides,
.flexslider .slides > li,
.woocommerce-product-gallery__wrapper,
.flex-viewport {
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    -moz-transition: -moz-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    -ms-transition: -ms-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    -o-transition: -o-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.flexslider .slides > li img,
.woocommerce-product-gallery__image {
    transition: opacity 0.35s ease-out !important;
    -webkit-transition: opacity 0.35s ease-out !important;
    -moz-transition: opacity 0.35s ease-out !important;
    -ms-transition: opacity 0.35s ease-out !important;
    -o-transition: opacity 0.35s ease-out !important;
}

/* جلوگیری از افکت آبی هنگام کلیک */
.woocommerce-product-gallery__wrapper,
.woocommerce-product-gallery__wrapper *,
.zephyr-gallery-clickable-area,
.zephyr-gallery-clickable-area *,
.zephyr-gallery-arrow,
.zephyr-gallery-arrow * {
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    outline: none !important;
    -webkit-focus-ring-color: transparent !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.woocommerce-product-gallery__wrapper:active,
.woocommerce-product-gallery__wrapper:focus,
.zephyr-gallery-clickable-area:active,
.zephyr-gallery-clickable-area:focus,
.zephyr-gallery-arrow:active,
.zephyr-gallery-arrow:focus {
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* جلوگیری از highlight مرورگر */
.woocommerce-product-gallery__wrapper::selection,
.zephyr-gallery-clickable-area::selection,
.zephyr-gallery-arrow::selection {
    background: transparent !important;
}

/* جلوگیری از focus outline روی کلیک */
.zephyr-gallery-clickable-area:focus {
    outline: 0 !important;
}

.zephyr-gallery-arrow:focus,
.zephyr-gallery-arrow-prev:focus,
.zephyr-gallery-arrow-next:focus {
    outline: 0 !important;
    border: 1px solid #E3E3E3 !important;
}

/* ناحیه کلیک‌پذیر بزرگتر */
.zephyr-gallery-clickable-area {
    position: absolute !important;
    top: 20% !important;
    height: 60% !important;
    width: 60px !important;
    z-index: 998 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    transition: opacity 0.2s ease !important;
    background: transparent !important;
    touch-action: pan-y !important;
}

/* در موبایل هم فعال باشد */
@media (hover: none) and (pointer: coarse) {
    .zephyr-gallery-clickable-area {
        pointer-events: auto !important; /* فعال در موبایل */
    }
    
    .zephyr-gallery-arrow {
        pointer-events: auto !important;
    }
}

.zephyr-gallery-clickable-area:hover {
    background: transparent !important;
}

.zephyr-gallery-clickable-area:active {
    background: transparent !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

/* جلوگیری از blue highlight در Chrome/Safari */
.zephyr-gallery-clickable-area,
.zephyr-gallery-arrow {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    -webkit-tap-highlight-color: transparent !important;
}

.zephyr-gallery-clickable-area-left {
    left: 0 !important;
    right: auto !important;
}

.zephyr-gallery-clickable-area-right {
    right: 0 !important;
    left: auto !important;
}

/* RTL Support for clickable areas */
[dir="rtl"] .zephyr-gallery-clickable-area-left,
.zephyr-gallery-rtl .zephyr-gallery-clickable-area-left {
    right: 0 !important;
    left: auto !important;
}

[dir="rtl"] .zephyr-gallery-clickable-area-right,
.zephyr-gallery-rtl .zephyr-gallery-clickable-area-right {
    left: 0 !important;
    right: auto !important;
}

/* استایل فلش‌های ناوبری - Minimal Design */
.zephyr-gallery-arrow,
.zephyr-gallery-arrow-prev,
.zephyr-gallery-arrow-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #E3E3E3 !important;
    color: #1A1A1A !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    line-height: 1 !important;
    padding: 0 !important;
    z-index: 999 !important;
    transition: all 0.2s ease !important;
    opacity: 0.8 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    font-family: Arial, sans-serif !important;
    pointer-events: auto !important;
    margin: 0 !important;
    outline: none !important;
}

.zephyr-gallery-arrow:hover,
.zephyr-gallery-arrow-prev:hover,
.zephyr-gallery-arrow-next:hover {
    background: #FFFFFF !important;
    border-color: #E3E3E3 !important;
    opacity: 1 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.zephyr-gallery-arrow:active,
.zephyr-gallery-arrow-prev:active,
.zephyr-gallery-arrow-next:active {
    transform: translateY(-50%) scale(0.95) !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    border-color: #E3E3E3 !important;
}

.zephyr-gallery-arrow.disabled,
.zephyr-gallery-arrow.disabled:hover,
.zephyr-gallery-arrow-prev.disabled,
.zephyr-gallery-arrow-prev.disabled:hover,
.zephyr-gallery-arrow-next.disabled,
.zephyr-gallery-arrow-next.disabled:hover {
    opacity: 0.25 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: rgba(255, 255, 255, 0.5) !important;
    border-color: #E3E3E3 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.zephyr-gallery-arrow-prev {
    left: 15px !important;
    right: auto !important;
}

.zephyr-gallery-arrow-next {
    right: 15px !important;
    left: auto !important;
}

/* RTL Support */
[dir="rtl"] .zephyr-gallery-arrow-prev,
.zephyr-gallery-rtl .zephyr-gallery-arrow-prev {
    right: 15px !important;
    left: auto !important;
}

[dir="rtl"] .zephyr-gallery-arrow-next,
.zephyr-gallery-rtl .zephyr-gallery-arrow-next {
    left: 15px !important;
    right: auto !important;
}

/* موبایل */
@media (max-width: 768px) {
    .zephyr-gallery-arrow,
    .zephyr-gallery-arrow-prev,
    .zephyr-gallery-arrow-next {
        width: 32px !important;
        height: 32px !important;
        font-size: 18px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid #E3E3E3 !important;
    }
    
    .zephyr-gallery-arrow-prev {
        left: 10px !important;
        right: auto !important;
    }
    
    .zephyr-gallery-arrow-next {
        right: 10px !important;
        left: auto !important;
    }
    
    [dir="rtl"] .zephyr-gallery-arrow-prev {
        right: 10px !important;
        left: auto !important;
    }
    
    [dir="rtl"] .zephyr-gallery-arrow-next {
        left: 10px !important;
        right: auto !important;
    }
}

/* ========== Lightbox Styles ========== */
.zephyr-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* حذف کامل scrollbar */
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
    scrollbar-color: transparent transparent !important; /* Firefox */
}

/* حذف کامل scrollbar در Webkit browsers (Chrome, Safari, etc.) */
.zephyr-lightbox-overlay::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

.zephyr-lightbox-overlay::-webkit-scrollbar-track {
    display: none !important;
    background: transparent !important;
}

.zephyr-lightbox-overlay::-webkit-scrollbar-thumb {
    display: none !important;
    background: transparent !important;
}

.zephyr-lightbox-overlay.active {
    display: block;
    opacity: 1;
}

.zephyr-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #ffffff;
}

.zephyr-lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    background: #ffffff;
}

.zephyr-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: #000000;
    font-size: 40px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    line-height: 50px;
    z-index: 1000001;
    padding: 0;
}

.zephyr-lightbox-close:hover {
    opacity: 0.7;
}

/* Desktop - Horizontal Slider */
@media (min-width: 769px) {
    .zephyr-lightbox-overlay {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        overscroll-behavior-x: contain;
        scroll-padding-left: 0;
        scroll-padding-right: 0;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .zephyr-lightbox-overlay::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .zephyr-lightbox-container {
        flex-direction: row;
        padding: 0;
        width: auto;
        height: 100%;
        min-width: 100%;
        align-items: center;
        justify-content: flex-start;
        display: flex;
        transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .zephyr-lightbox-image {
        width: 100vw;
        height: 100vh;
        min-width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        object-fit: contain;
        object-position: center center;
        display: block;
        flex-shrink: 0;
        scroll-snap-align: center;
        scroll-snap-stop: always;
        scroll-margin-left: 0;
        scroll-margin-right: 0;
        transition: opacity 0.35s ease-out;
        -webkit-transition: opacity 0.35s ease-out;
    }
}

/* Mobile - Vertical Slider */
@media (max-width: 768px) {
    .zephyr-lightbox-overlay {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior: contain;
        scroll-snap-type: y mandatory;
        scroll-behavior: smooth;
        scroll-padding-top: 0;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .zephyr-lightbox-overlay::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .zephyr-lightbox-container {
        flex-direction: column;
        padding: 0;
        min-height: 100vh;
        align-items: stretch;
        justify-content: flex-start;
        display: flex;
        transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .zephyr-lightbox-image-wrapper {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        flex-shrink: 0;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        scroll-margin-top: 0;
        position: relative;
        touch-action: auto;
    }
    
    .zephyr-lightbox-image-wrapper.zooming,
    .zephyr-lightbox-image-wrapper.panning {
        touch-action: none !important; /* Disable all touch actions when zooming/panning */
    }
    
    .zephyr-lightbox-image {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        max-width: 100%;
        max-height: 100vh;
        object-fit: contain;
        object-position: center center;
        display: block;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        will-change: transform;
        transform-origin: center center;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        transition: opacity 0.35s ease-out;
        -webkit-transition: opacity 0.35s ease-out;
    }

    .zephyr-lightbox-close {
        top: 15px;
        right: 15px;
        color: #000000;
        font-size: 35px;
        position: fixed;
        z-index: 1000001;
}
}

body.zephyr-lightbox-open,
html.zephyr-lightbox-open {
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

body.zephyr-lightbox-open::-webkit-scrollbar,
html.zephyr-lightbox-open::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

body.zephyr-lightbox-open {
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
}

/* ========== Thumbnails Styles ========== */
.zephyr-lightbox-thumbnails {
    position: fixed;
    z-index: 1000002;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
    scroll-behavior: smooth;
    /* سرعت بیشتر برای scroll thumbnail */
    scroll-margin: 0;
}

.zephyr-lightbox-thumbnails::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.zephyr-lightbox-thumbnail {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
    background: #ffffff;
    flex-shrink: 0;
    box-sizing: border-box;
}

.zephyr-lightbox-thumbnail:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.zephyr-lightbox-thumbnail.active {
    opacity: 1;
    border-color: #000000;
    transform: scale(1.1);
    transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.zephyr-lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 2px;
}

/* Desktop - Horizontal Thumbnails (Bottom Center) */
@media (min-width: 769px) {
    .zephyr-lightbox-thumbnails {
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 40px);
        width: auto;
        min-width: 300px;
        height: 120px;
        min-height: 120px;
        max-height: 120px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 15px 20px;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
        /* سرعت بیشتر برای scroll thumbnail (250ms) */
        scroll-padding-left: 0;
        scroll-padding-right: 0;
    }

    .zephyr-lightbox-thumbnails::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
    
    .zephyr-lightbox-thumbnail {
        width: 90px;
        height: 90px;
        min-width: 90px;
        min-height: 90px;
        flex-shrink: 0;
        border-radius: 6px;
        overflow: hidden;
        scroll-snap-align: center;
        transition: transform 0.2s ease;
    }
    
    .zephyr-lightbox-thumbnail:hover {
        transform: scale(1.08);
    }
    
    .zephyr-lightbox-thumbnail.active {
        transform: scale(1.15);
    }
}

/* Mobile - Vertical Thumbnails (Left Center) */
@media (max-width: 768px) {
    .zephyr-lightbox-thumbnails {
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        max-height: calc(100vh - 40px);
        height: auto;
        min-height: 200px;
        width: 76px;
        min-width: 76px;
        max-width: 76px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 6px;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
        overflow-x: hidden !important;
        overflow-y: auto;
        scroll-behavior: smooth;
        scroll-snap-type: y proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
        overflow: -moz-scrollbars-none;
        box-sizing: border-box;
    }
    
    .zephyr-lightbox-thumbnails::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .zephyr-lightbox-thumbnail {
        width: 64px;
        min-width: 64px;
        max-width: 64px;
        height: 64px;
        min-height: 64px;
        max-height: 64px;
        border-radius: 6px;
        overflow: hidden;
        flex-shrink: 0;
        scroll-snap-align: center;
        transition: transform 0.2s ease, border-color 0.3s ease;
        margin: 0;
        box-sizing: border-box;
        display: block;
        position: relative;
        contain: layout style paint;
    }
    
    .zephyr-lightbox-thumbnail:hover {
        transform: scale(1.08);
    }
    
    .zephyr-lightbox-thumbnail.active {
        transform: scale(1.15);
    }
    
    .zephyr-lightbox-thumbnail img {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        max-height: 100% !important;
        object-fit: cover;
        display: block;
        border-radius: 4px;
    }
}

