/* Modern Instagram Reel Carousel */
.serenity-reel-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 30px 0;
}

/* White Shadow Gradients */
.reel-gradient-left,
.reel-gradient-right {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50px;
    z-index: 10;
    pointer-events: none;
}

.reel-gradient-left {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 30%, rgba(255,255,255,0) 100%);
}

.reel-gradient-right {
    right: 0;
    background: linear-gradient(270deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 30%, rgba(255,255,255,0) 100%);
}

.reel-track {
    display: flex;
    gap: 16px;
    animation: autoScroll 30s linear infinite;
}

.serenity-reel-carousel:hover .reel-track {
    animation-play-state: paused;
}

.reel-item {
    position: relative;
    min-width: 220px;
    height: 380px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: #000;
}

.reel-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.reel-media-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.reel-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background: #000;
    transition: opacity 0.3s ease;
}

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

.reel-item.playing .reel-thumbnail {
    opacity: 0;
    pointer-events: none;
}

.reel-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    background: #000;
    cursor: pointer;
}

.reel-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    background: rgba(0, 0, 0, 0.15);
    opacity: 1;
    transition: all 0.4s ease;
    pointer-events: none;
}

.reel-item:hover .reel-play-overlay {
    background: rgba(0, 0, 0, 0.25);
}

.instagram-play-icon {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reel-item:hover .instagram-play-icon {
    transform: scale(1.15);
}

.reel-item.playing .reel-play-overlay {
    opacity: 0;
}

.reel-sound-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: all 0.3s ease;
}

.reel-item.playing .reel-sound-toggle {
    opacity: 1;
}

.reel-sound-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.reel-sound-toggle svg {
    width: 18px;
    height: 18px;
}

.reel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 16px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    z-index: 4;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

/* temp-show kept for JS compatibility but content is always visible now */
.reel-item.playing .reel-content.temp-show {
    opacity: 1;
    transform: translateY(0);
}

.reel-info {
    color: white;
}

.reel-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.reel-views {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
}

.reel-views svg {
    width: 14px;
    height: 14px;
    opacity: 0.8;
}

/* Side shadows — DISABLED by default at all breakpoints.
   Only shown when the matching show-shadows-* class is present (set by Elementor control). */

/* Base: pseudo-elements always exist but are invisible */
.serenity-reel-carousel::before,
.serenity-reel-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    z-index: 10;
    pointer-events: none;
    display: none; /* OFF by default — turned on per breakpoint below */
}

.serenity-reel-carousel::before {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, transparent 100%);
}

.serenity-reel-carousel::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 1) 0%, transparent 100%);
}

/* Desktop (≥1025px): show only if show-shadows-desktop class present */
@media (min-width: 1025px) {
    .serenity-reel-carousel.show-shadows-desktop::before,
    .serenity-reel-carousel.show-shadows-desktop::after {
        display: block;
    }
}

/* Tablet (769px–1024px): show only if show-shadows-tablet class present */
@media (min-width: 769px) and (max-width: 1024px) {
    .serenity-reel-carousel.show-shadows-tablet::before,
    .serenity-reel-carousel.show-shadows-tablet::after {
        display: block;
    }
}

/* Mobile (≤768px): show only if show-shadows-mobile class present */
@media (max-width: 768px) {
    .serenity-reel-carousel.show-shadows-mobile::before,
    .serenity-reel-carousel.show-shadows-mobile::after {
        display: block;
    }
}

@keyframes autoScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.reel-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 6;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.audio-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 15;
    pointer-events: none;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .serenity-reel-carousel.mobile-single-item {
        padding: 20px 0;
        overflow: hidden;
    }

    /* Each item takes ~75vw so only ONE is visible at a time with a peek of the next */
    .mobile-single-item .reel-track {
        display: flex;
        align-items: center;
        gap: 12px;
        animation: autoScroll 20s linear infinite;
    }

    .mobile-single-item .reel-item {
        min-width: 75vw !important;
        max-width: 75vw !important;
        margin: 0;
        flex-shrink: 0;
        display: block !important;
    }

    .instagram-play-icon {
        width: 56px;
        height: 56px;
    }

    /* Mobile: Show play button more prominently */
    .reel-play-overlay {
        pointer-events: auto;
        cursor: pointer;
    }

    .reel-item.playing .reel-play-overlay {
        opacity: 0;
        pointer-events: none;
    }

    /* Mobile: Make sound button always visible */
    .reel-sound-toggle {
        opacity: 0.8;
        pointer-events: auto;
    }

    .reel-item.playing .reel-sound-toggle {
        opacity: 1;
    }
}

/* ─────────────────────────────────────────────────────────────
   EXTERNAL EMBED STYLES (YouTube Shorts / Instagram Reels)
   Self-hosted styles above are untouched.
───────────────────────────────────────────────────────────── */

/* The thumbnail click-layer for external items */
.reel-embed-thumb {
    cursor: pointer;
    z-index: 3;
}

/* Hide thumbnail once iframe is active */
.reel-item--external.playing .reel-embed-thumb {
    opacity: 0;
    pointer-events: none;
}

/* The iframe itself */
.reel-embed-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 2;
    background: #000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Show iframe when item is playing */
.reel-item--external.playing .reel-embed-iframe {
    opacity: 1;
    pointer-events: auto;
}

/* Platform badge – top-left corner */
.reel-platform-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    z-index: 4;
    pointer-events: none;
}

.reel-platform-badge--youtube {
    background: #FF0000;
}

.reel-platform-badge--instagram {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}

/* Hide the play overlay once iframe is active */
.reel-item--external.playing .reel-embed-play-overlay {
    opacity: 0;
}

/* Loading state for external items */
.reel-item--external.loading .reel-embed-thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 6;
}
