/**
 * WooCommerce Product Thumbnails Swiper Slider Styles
 * ol = swiper container, li = swiper-slide
 * With pagination dots (no arrows)
 */

/* Swiper Container (ol element) */
.flex-control-nav.flex-control-thumbs.swiper {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 5px 10px;
    margin: 15px 0 0 0;
    list-style: none;
}

.flex-control-nav.flex-control-thumbs .swiper-wrapper {
    display: flex;
    align-items: center;
}

/* Individual Thumbnail Slides (li elements) */
.flex-control-nav.flex-control-thumbs li.swiper-slide {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    width: auto;
    flex-shrink: 0;
}

.flex-control-nav.flex-control-thumbs li.swiper-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

/* Hover Effect */
.flex-control-nav.flex-control-thumbs li.swiper-slide:hover {
    border-color: #ddd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.flex-control-nav.flex-control-thumbs li.swiper-slide:hover::before {
    background: rgba(0, 0, 0, 0.1);
}

/* Active Thumbnail - WooCommerce's flex-active class */
.flex-control-nav.flex-control-thumbs li.flex-active,
.flex-control-nav.flex-control-thumbs li.thumbnail-active {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.flex-control-nav.flex-control-thumbs li.flex-active::before,
.flex-control-nav.flex-control-thumbs li.thumbnail-active::before {
    background: rgba(0, 123, 255, 0.1);
}

/* Thumbnail Images */
.flex-control-nav.flex-control-thumbs li.swiper-slide img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.flex-control-nav.flex-control-thumbs li.swiper-slide:hover img {
    transform: scale(1.05);
}

/* Hide Navigation Arrows */
.flex-control-nav.flex-control-thumbs ~ .swiper-button-next,
.flex-control-nav.flex-control-thumbs ~ .swiper-button-prev {
    display: none !important;
}

/* Pagination Dots */
.flex-control-nav.flex-control-thumbs ~ .swiper-pagination {
    position: relative;
    margin-top: 15px;
    text-align: center;
    bottom: auto;
}

.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #ddd;
    opacity: 1;
    margin: 0 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet:hover {
    background: #999;
    transform: scale(1.2);
}

.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active {
    background: #007bff;
    width: 24px;
    border-radius: 4px;
}

/* Dynamic Bullets Styling */
.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active-main {
    background: #007bff;
}

.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active-prev,
.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active-next {
    background: #80bdff;
}

.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active-prev-prev,
.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active-next-next {
    background: #cce5ff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .flex-control-nav.flex-control-thumbs.swiper {
        padding: 5px 10px;
    }
    
    .flex-control-nav.flex-control-thumbs ~ .swiper-pagination {
        margin-top: 12px;
    }
    
    .flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet {
        width: 7px;
        height: 7px;
        margin: 0 3px;
    }
    
    .flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active {
        width: 20px;
    }
}

@media (max-width: 480px) {
    .flex-control-nav.flex-control-thumbs.swiper {
        padding: 5px 10px;
        margin-top: 10px;
    }
    
    .flex-control-nav.flex-control-thumbs li.swiper-slide {
        border-width: 1px;
        border-radius: 6px;
    }
    
    .flex-control-nav.flex-control-thumbs ~ .swiper-pagination {
        margin-top: 10px;
    }
    
    .flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet {
        width: 6px;
        height: 6px;
        margin: 0 3px;
    }
    
    .flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet-active {
        width: 18px;
    }
}

/* Loading State */
.flex-control-nav.flex-control-thumbs.swiper-initialized {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.flex-control-nav.flex-control-thumbs.swiper:not(.swiper-initialized) {
    opacity: 0;
}

/* Smooth Transitions */
.flex-control-nav.flex-control-thumbs li.swiper-slide {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus State for Accessibility */
.flex-control-nav.flex-control-thumbs li.swiper-slide:focus,
.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Animation for active slide */
@keyframes slideActive {
    from {
        transform: scale(0.95);
    }
    to {
        transform: scale(1);
    }
}

.flex-control-nav.flex-control-thumbs li.flex-active {
    animation: slideActive 0.3s ease;
}

/* Override WooCommerce default positioning */
.flex-control-nav.flex-control-thumbs.swiper {
    bottom: auto;
    text-align: left;
}

html[dir="rtl"] .flex-control-nav.flex-control-thumbs.swiper,
body.rtl .flex-control-nav.flex-control-thumbs.swiper {
    text-align: right;
}

/* Animation for pagination dots */
@keyframes dotFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.flex-control-nav.flex-control-thumbs ~ .swiper-pagination .swiper-pagination-bullet {
    animation: dotFadeIn 0.3s ease;
}