/**
 * VIME Product Gallery Widget Styles
 */

/* ==========================================================================
   Base Gallery Styles
   ========================================================================== */

.vime-product-gallery {
    position: relative;
    width: 100%;
}

.vime-product-gallery img {
    max-width: 100%;
    height: auto;
    display: block;
    width: 100%;
}

.vime-product-gallery a {
    display: block;
    position: relative;
    cursor: pointer;
}

/* ==========================================================================
   Slider Layout
   ========================================================================== */

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

.vime-gallery-main {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.vime-gallery-main-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

.vime-gallery-slide {
    display: none;
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.vime-gallery-slide.active {
    display: block;
    opacity: 1;
}

.vime-gallery-slide img {
    width: 100%;
    height: auto;
}

/* Navigation Arrows */
.vime-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.vime-gallery-nav:hover {
    transform: translateY(-50%) scale(1.1);
}

.vime-gallery-nav.vime-gallery-prev {
    left: 10px;
}

.vime-gallery-nav.vime-gallery-next {
    right: 10px;
}

.vime-gallery-nav i,
.vime-gallery-nav svg {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.vime-gallery-nav svg {
    fill: currentColor;
}

.vime-gallery-nav svg path {
    fill: currentColor;
}

/* Pagination Dots */
.vime-gallery-pagination {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.vime-pagination-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.vime-pagination-dot.active,
.vime-pagination-dot:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

/* Thumbnails */
.vime-gallery-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.vime-gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.vime-gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.vime-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.vime-gallery-thumbnail {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.vime-gallery-thumbnail:hover {
    opacity: 0.8;
}

.vime-gallery-thumbnail.active {
    opacity: 1;
    border-color: #333;
}

.vime-gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* External Thumbnails Widget */
.vime-gallery-thumbnails-external-wrapper {
    width: 100%;
}

.vime-gallery-thumbnails-external {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* External thumbnails inherit styles from source gallery */
.vime-gallery-thumbnails-external .vime-gallery-thumbnail {
    flex: 0 0 auto;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.vime-gallery-thumbnails-external .vime-gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide original thumbnails when external widget is present */
.vime-gallery-has-external-thumbnails .vime-gallery-thumbnails {
    display: none !important;
}

/* Thumbnail Positions */
.vime-gallery-slider-wrapper.vime-thumbnails-left,
.vime-gallery-slider-wrapper.vime-thumbnails-right {
    display: flex;
    gap: 20px;
}

.vime-gallery-slider-wrapper.vime-thumbnails-left {
    flex-direction: row-reverse;
}

.vime-gallery-slider-wrapper.vime-thumbnails-left .vime-gallery-thumbnails,
.vime-gallery-slider-wrapper.vime-thumbnails-right .vime-gallery-thumbnails {
    flex-direction: column;
    margin-top: 0;
    width: 100px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.vime-gallery-slider-wrapper.vime-thumbnails-left .vime-gallery-thumbnails::-webkit-scrollbar,
.vime-gallery-slider-wrapper.vime-thumbnails-right .vime-gallery-thumbnails::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.vime-gallery-slider-wrapper.vime-thumbnails-top .vime-gallery-thumbnails {
    order: -1;
    margin-top: 0;
}

.vime-gallery-slider-wrapper.vime-thumbnails-left,
.vime-gallery-slider-wrapper.vime-thumbnails-right {
    align-items: flex-start;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.vime-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.vime-gallery-grid .vime-gallery-item {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.vime-gallery-grid .vime-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   Masonry Layout
   ========================================================================== */

.vime-gallery-masonry {
    column-count: 3;
    column-gap: 10px;
}

.vime-gallery-masonry .vime-gallery-item {
    break-inside: avoid;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.vime-gallery-masonry .vime-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   Carousel Layout
   ========================================================================== */

.vime-gallery-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.vime-gallery-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    padding: 10px 0;
}

.vime-gallery-carousel::-webkit-scrollbar {
    height: 6px;
}

.vime-gallery-carousel::-webkit-scrollbar-track {
    background: transparent;
}

.vime-gallery-carousel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.vime-gallery-carousel .vime-gallery-item {
    flex: 0 0 auto;
    width: 300px;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.vime-gallery-carousel .vime-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   Stacked Layout
   ========================================================================== */

.vime-gallery-stacked {
    display: flex;
    flex-direction: column;
}

.vime-gallery-stacked .vime-gallery-item {
    width: 100%;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.vime-gallery-stacked .vime-gallery-item:last-child {
    margin-bottom: 0;
}

.vime-gallery-stacked .vime-gallery-item img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

/* Zoom In */
.vime-gallery-hover-zoom .vime-gallery-item:hover img,
.vime-gallery-hover-zoom .vime-gallery-main-image:hover img {
    transform: scale(1.1);
}

/* Zoom Out */
.vime-gallery-hover-zoom-out .vime-gallery-item img,
.vime-gallery-hover-zoom-out .vime-gallery-main-image img {
    transform: scale(1.1);
}

.vime-gallery-hover-zoom-out .vime-gallery-item:hover img,
.vime-gallery-hover-zoom-out .vime-gallery-main-image:hover img {
    transform: scale(1);
}

/* Opacity */
.vime-gallery-hover-opacity .vime-gallery-item:hover img,
.vime-gallery-hover-opacity .vime-gallery-main-image:hover img {
    opacity: 0.8;
}

/* Lift */
.vime-gallery-hover-lift .vime-gallery-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.vime-gallery-hover-lift .vime-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .vime-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .vime-gallery-masonry {
        column-count: 2;
    }

    .vime-gallery-carousel .vime-gallery-item {
        width: 250px;
    }

    .vime-gallery-slider-wrapper.vime-thumbnails-left,
    .vime-gallery-slider-wrapper.vime-thumbnails-right {
        flex-direction: column;
    }

    .vime-gallery-slider-wrapper.vime-thumbnails-left .vime-gallery-thumbnails,
    .vime-gallery-slider-wrapper.vime-thumbnails-right .vime-gallery-thumbnails {
        flex-direction: row;
        width: 100%;
        max-height: none;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .vime-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .vime-gallery-masonry {
        column-count: 2;
    }

    .vime-gallery-carousel .vime-gallery-item {
        width: 200px;
    }

    .vime-gallery-nav {
        width: 35px;
        height: 35px;
    }

    .vime-gallery-nav i {
        font-size: 16px;
    }

    .vime-gallery-thumbnail {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .vime-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .vime-gallery-masonry {
        column-count: 1;
        column-gap: 0;
    }

    .vime-gallery-carousel .vime-gallery-item {
        width: 150px;
    }

    .vime-gallery-nav {
        width: 30px;
        height: 30px;
    }

    .vime-gallery-nav i {
        font-size: 14px;
    }

    .vime-gallery-nav.vime-gallery-prev {
        left: 5px;
    }

    .vime-gallery-nav.vime-gallery-next {
        right: 5px;
    }

    .vime-gallery-thumbnail {
        width: 50px;
        height: 50px;
    }

    .vime-gallery-thumbnails {
        gap: 5px;
        margin-top: 10px;
    }
}

/* ==========================================================================
   Loading & Transitions
   ========================================================================== */

.vime-gallery-item,
.vime-gallery-slide,
.vime-gallery-thumbnail {
    position: relative;
}

.vime-gallery-item img,
.vime-gallery-slide img,
.vime-gallery-thumbnail img {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Image loading skeleton */
.vime-gallery-item:empty,
.vime-gallery-slide:empty,
.vime-gallery-thumbnail:empty {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==========================================================================
   Editor Preview Styles
   ========================================================================== */

.vime-product-gallery.elementor-preview {
    padding: 20px;
    background: #fff;
    border: 2px dashed #ddd;
    border-radius: 4px;
}

.vime-product-gallery.elementor-preview .vime-gallery-item img {
    opacity: 0.8;
}

/* ==========================================================================
   Video Styles
   ========================================================================== */

.vime-gallery-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

.vime-gallery-video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.vime-gallery-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.vime-gallery-video-hosted {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.vime-gallery-slide-video {
    background: #000;
}

/* Video thumbnail for thumbnails navigation */
.vime-gallery-thumbnail-video {
    position: relative;
}

.vime-gallery-thumbnail-video::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vime-gallery-thumbnail-video::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 52%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #333;
    z-index: 1;
}

/* Video overlay play button */
.vime-gallery-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.vime-gallery-video-play-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

.vime-gallery-video-play-button {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.vime-gallery-video-play-overlay:hover .vime-gallery-video-play-button {
    transform: scale(1.1);
}

.vime-gallery-video-play-button::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 25px;
    border-color: transparent transparent transparent #333;
    margin-left: 5px;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.vime-gallery-nav:focus,
.vime-gallery-thumbnail:focus,
.vime-pagination-dot:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.vime-gallery-nav:focus:not(:focus-visible),
.vime-gallery-thumbnail:focus:not(:focus-visible),
.vime-pagination-dot:focus:not(:focus-visible) {
    outline: none;
}

/* Screen reader only text */
.vime-gallery-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
