﻿/* === Carousel Container === */
.carousel {
    max-width: 600px;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

/* === Carousel Main Image Area === */
.carousel-images {
    position: relative;
    overflow: hidden;
}

/* === Main Carousel Images === */
.carousel-image {
    display: none;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

    .carousel-image.lazy {
        opacity: 0;
        transition: opacity 0.4s ease-in-out;
        background-color: #f0f0f0;
    }

        .carousel-image.lazy.lazy-loaded {
            opacity: 1;
        }

    .carousel-image.active {
        display: block;
    }

/* === Thumbnails Container === */
.carousel-thumbnails {
    display: flex;
    justify-content: start;
    margin-top: 10px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px;
    scrollbar-width: auto;
    white-space: nowrap;
    scroll-behavior: smooth;
}

/* === Thumbnail Images === */
.thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, opacity 0.3s ease-in-out;
}

    .thumbnail.lazy {
        opacity: 0;
        background-color: #f0f0f0;
    }

        .thumbnail.lazy.lazy-loaded {
            opacity: 1;
        }

    .thumbnail.active {
        border-color: #007BFF;
        transform: scale(1.1);
    }

/* === Scroll Buttons (for thumbnails & popup) === */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    z-index: 1;
}

    .scroll-btn:hover {
        color: crimson;
    }

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

/* === Popup Overlay === */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    overflow: auto;
    z-index: 2;
    -webkit-overflow-scrolling: touch;
}

/* === Popup Image Wrapper (for zoom and drag) === */
.popup-image-wrapper {
    /*    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 100%;
    min-height: 100%;
    overflow: hidden;
    cursor: grab;
    position: relative;*/
    width: 90vw;
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background-color: #000; /* Or any placeholder bg */
}

    .popup-image-wrapper.grabbing {
        cursor: grabbing;
    }
    .popup-image-wrapper img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }


/* === Popup Image === */
.popup img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

    .popup img.zoomed {
        cursor: move;
        transition: none;
        user-select: none;
        pointer-events: all;
    }

    .popup img.loading {
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
    }



/* === Responsive Adjustment (landscape on mobile) === */
@media (orientation: landscape) and (max-width: 768px) {
    .popup img {
        max-width: 80vw;
        max-height: 70vh;
    }
}



/* === Close Button in Popup === */
.popup .close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    display: flex;
    font-size: 40px;
    cursor: pointer;
    filter: drop-shadow(2px 2px 0 black) drop-shadow(-2px -2px 0 black) drop-shadow(2px -2px 0 black) drop-shadow(-2px 2px 0 black);
}

    .popup .close:hover {
        color: crimson;
    }

/* === Popup Scroll Arrows === */
.popup .scroll-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    font-size: 40px;
}

    .popup .scroll-btn:hover {
        color: crimson;
    }
