/**
 * Product Image Carousel Styles
 * Main carousel: 610 x 628 px
 */

/* Main Carousel Wrapper */
.ppservis-product-carousel-wrapper {
    width: 100%;
    max-width: 610px;
    margin: 0 auto;
}

/* Main Carousel Container */
.ppservis-main-carousel {
    position: relative;
    width: 100%;
    height: 628px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Carousel Track Container */
.carousel-track-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: pan-y pinch-zoom; /* Allow vertical scroll but handle horizontal swipes */
    -webkit-user-select: none;
    user-select: none; /* Prevent text selection during swipe */
}

/* Carousel Track */
.carousel-track {
    position: relative;
    height: 100%;
    width: 100%;
}

/* Carousel Slides */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease-in-out;
    will-change: transform; /* Optimize for smooth animations on mobile */
    opacity: 0; /* Hide all slides by default */
    visibility: hidden;
}

/* Show first slide while JavaScript loads */
.carousel-slide:first-child {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Once JavaScript initializes, show all slides (JS will handle positioning) */
.carousel-track.initialized .carousel-slide {
    opacity: 1;
    visibility: visible;
}

.carousel-slide img.carousel-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Heureka Review Slide */
.carousel-slide-heureka {
    background: #fff;
    padding: 40px;
}

.heureka-review-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
}

.carousel-arrow:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.carousel-arrow:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.carousel-arrow svg {
    width: 30px;
    height: 30px;
    color: #333;
}

.carousel-arrow svg path {
    fill: #333;
}

.carousel-arrow-prev {
    left: 16px;
}

.carousel-arrow-next {
    right: 16px;
}

/* Slide Counter */
.carousel-counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
    display: none;
}

/* Thumbnail Gallery */
.ppservis-thumbnail-gallery {
    position: relative;
    width: 100%;
    max-width: 610px;
    margin: 0 auto;
    min-height: 100px;
    display: flex;
    align-items: center;
}

/* Thumbnail Track Container */
.thumbnail-track-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    flex: 1;
}

.thumbnail-track-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Thumbnail Track */
.thumbnail-track {
    display: flex;
    gap: 12px;
    padding: 0 48px; /* Space for arrows */
}

/* Thumbnail Items */
.thumbnail-item {
    min-width: 100px;
    height: 100px;
    border: 1px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-item:hover {
    border-color: #ddd;
}

.thumbnail-item.active {
    border-color: #00688d;
}

.thumbnail-item img.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Heureka Thumbnail */
.thumbnail-heureka .heureka-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}

.thumbnail-heureka svg {
    width: 32px;
    height: 32px;
    color: #FFD500;
}

.thumbnail-heureka span {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

/* Thumbnail Navigation Arrows */
.thumbnail-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
}

.thumbnail-arrow:hover {
    background: #fff;
    border-color: #bbb;
}
.thumbnail-arrow:active, .thumbnail-arrow:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ddd;
}

.thumbnail-arrow svg {
    width: 30px;
    height: 30px;
    color: #333;
}

.thumbnail-arrow svg path {
    fill: #333;
}

.thumbnail-arrow-prev {
    left: 0;
}

.thumbnail-arrow-next {
    right: 0;
}

/* Lightbox Styles */
.carousel-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: #fff;
    transform: rotate(90deg);
}

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

.lightbox-close svg path {
    fill: #333;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.3s ease;
}

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

.lightbox-arrow svg {
    width: 28px;
    height: 28px;
}

.lightbox-arrow svg path {
    fill: #333;
}

.lightbox-arrow-prev {
    left: 30px;
}

.lightbox-arrow-next {
    right: 30px;
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    z-index: 10001;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ppservis-main-carousel {
        height: 500px;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
    }

    .carousel-arrow svg {
        width: 20px;
        height: 20px;
    }

    .carousel-arrow-prev {
        left: 8px;
    }

    .carousel-arrow-next {
        right: 8px;
    }

    /* Thumbnail adjustments for mobile/tablet */
    .ppservis-thumbnail-gallery {
        padding: 0 10px;
    }

    .thumbnail-arrow {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    .thumbnail-arrow svg {
        width: 18px;
        height: 18px;
    }

    .thumbnail-arrow-prev {
        left: 5px;
    }

    .thumbnail-arrow-next {
        right: 5px;
    }

    .thumbnail-item {
        min-width: 70px;
        height: 70px;
    }

    .thumbnail-track {
        padding: 0 45px; /* More space for arrows */
        gap: 8px;
    }

    .lightbox-arrow {
        width: 48px;
        height: 48px;
    }

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

    .lightbox-arrow-prev {
        left: 15px;
    }

    .lightbox-arrow-next {
        right: 15px;
    }

    .lightbox-close {
        width: 40px;
        height: 40px;
        top: 15px;
        right: 15px;
    }

    .lightbox-close svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .ppservis-main-carousel {
        height: 400px;
    }

    .carousel-slide-heureka {
        padding: 20px;
    }

    /* Mobile: Show only 3 thumbnails at once */
    .ppservis-thumbnail-gallery {
        padding: 0 5px;
    }

    .thumbnail-arrow {
        width: 32px;
        height: 32px;
    }

    .thumbnail-arrow svg {
        width: 16px;
        height: 16px;
    }

    .thumbnail-arrow-prev {
        left: 2px;
    }

    .thumbnail-arrow-next {
        right: 2px;
    }

    .thumbnail-item {
        min-width: 65px;
        height: 65px;
        flex-shrink: 0;
    }

    .thumbnail-track {
        padding: 0 38px; /* Space for smaller arrows */
        gap: 6px;
    }

    /* Make container width show exactly 3 thumbnails */
    .thumbnail-track-container {
        max-width: calc(65px * 3 + 6px * 2 + 38px * 2); /* 3 items + 2 gaps + arrow space */
        margin: 0 auto;
    }
}
