/* --- Main Carousel Container --- */
.dyn-carousel-container {
    width: 100%;
    max-width: 400px;
    user-select: none;
    -webkit-user-select: none;
}

/* --- Main Display Area (5:8 aspect ratio) --- */
.dyn-carousel-main-display {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 8;
    border-radius: 16px;
    overflow: hidden;
    background-color: #1a1a1a;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* --- Slides Wrapper --- */
.dyn-carousel-slides-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* --- Individual Slide --- */
.dyn-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.dyn-carousel-slide.slide-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.dyn-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dyn-carousel-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

/* --- Video Play Overlay Icon --- */
.dyn-carousel-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    cursor: pointer;
    transition: background 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
}

.dyn-carousel-video-overlay:hover {
    background: rgba(0, 0, 0, 0.25);
}

.dyn-carousel-video-overlay.overlay-hidden .carousel-play-icon {
    opacity: 0;
    transform: scale(0.8);
}

.dyn-carousel-video-overlay.overlay-hidden {
    background: transparent;
}

.carousel-play-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.dyn-carousel-video-overlay:hover .carousel-play-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.carousel-play-icon svg {
    width: 24px;
    height: 24px;
    margin-left: 3px;
    fill: #1a1a1a;
}

/* --- Navigation Arrows --- */
.dyn-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
    opacity: 0;
}

.dyn-carousel-main-display:hover .dyn-carousel-arrow {
    opacity: 1;
}

.dyn-carousel-arrow:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.08);
}

.dyn-carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.dyn-carousel-arrow svg {
    width: 18px;
    height: 18px;
    fill: #1a1a1a;
}

.arrow-left {
    left: 12px;
}

.arrow-right {
    right: 12px;
}

/* --- Slide Counter Badge --- */
.dyn-carousel-counter {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 5;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* --- Dot Indicators --- */
.dyn-carousel-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    gap: 6px;
}

.dyn-carousel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.dyn-carousel-dot.dot-active {
    background: #fff;
    width: 20px;
    border-radius: 10px;
}

/* --- Thumbnails Strip --- */
.dyn-carousel-thumbnails {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding: 4px 2px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.dyn-carousel-thumbnails::-webkit-scrollbar {
    display: none;
}

.dyn-carousel-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    background: #e0e0e0;
}

.dyn-carousel-thumb:hover {
    border-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.dyn-carousel-thumb.thumb-active {
    border-color: #1a1a1a;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.dyn-carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Video Thumbnail Badge --- */
.carousel-thumb-video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-thumb-video-badge svg {
    width: 10px;
    height: 10px;
    margin-left: 1.5px;
    fill: #1a1a1a;
}

/* --- Touch / Swipe Feedback --- */
.dyn-carousel-slides-wrapper.swiping {
    cursor: grabbing;
}

/* --- Empty State --- */
.dyn-carousel-empty {
    width: 100%;
    aspect-ratio: 5 / 8;
    border-radius: 16px;
    background-color: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

@media (max-width: 768px) {
    .dyn-carousel-container {
        max-width: 340px;
    }

    .dyn-carousel-arrow {
        width: 34px;
        height: 34px;
        opacity: 1;
    }

    .dyn-carousel-arrow svg {
        width: 15px;
        height: 15px;
    }

    .arrow-left {
        left: 8px;
    }

    .arrow-right {
        right: 8px;
    }

    .dyn-carousel-thumb {
        width: 52px;
        height: 52px;
        border-radius: 8px;
    }

    .carousel-play-icon {
        width: 50px;
        height: 50px;
    }

    .carousel-play-icon svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .dyn-carousel-container {
        max-width: 100%;
    }

    .dyn-carousel-main-display {
        border-radius: 12px;
    }

    .dyn-carousel-arrow {
        width: 32px;
        height: 32px;
    }

    .dyn-carousel-thumb {
        width: 48px;
        height: 48px;
        border-radius: 7px;
    }

    .dyn-carousel-thumbnails {
        gap: 6px;
        margin-top: 8px;
    }
}

/* --- Loading placeholder --- */
.dyn-carousel-slide-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dynSpin 0.7s linear infinite;
}

@keyframes dynSpin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}