/* Custom Vanilla JS Carousel Styles */
.vanilla-carousel {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem auto;
    position: relative;
    user-select: none;
}

/* Main Stage */
.carousel-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    /* Responsive Aspect Ratio */
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.carousel-stage img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensures image is fully visible without distortion */
    transition: opacity 0.3s ease-in-out;
}

/* Navigation Arrows */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 10;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* Thumbnail Strip */
.carousel-thumbnails {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    margin: 0;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #666 #eee;
    width: 100%;
}

/* Fix for CKEditor adding <p> tags */
.carousel-thumbnails>* {
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
    display: block;
}

.carousel-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.carousel-thumbnails::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 3px;
}

.carousel-thumb {
    width: 20%;
    /* Show approx 5 thumbs on desktop */
    min-width: 100px;
    aspect-ratio: 16/9;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Thumbs crop to fill */
}

.carousel-thumb:hover {
    opacity: 1;
}

/* Active State */
.carousel-thumb.active {
    opacity: 1;
    border-color: #0d6efd;
    /* Primary Highlight Color */
}

/* Responsive Adjusments */
@media (max-width: 768px) {
    .carousel-thumb {
        width: 30%;
        /* Fewer thumbs on tablet */
    }
}

@media (max-width: 480px) {
    .carousel-thumb {
        width: 40%;
        /* Fewer thumbs on mobile */
    }
}