/* reelium-product-videos.css - Enhanced with popup functionality */

/* Main container */
.reelium-product-videos {
    position: relative;
    margin: 16px 0;
    width: 100%;
}

.reelium-product-videos::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60px;
    /* background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,1)); */
    pointer-events: none;
    z-index: 5;
}

/* Card stack container */
.reelium-product-card-stack {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Container for stacked cards */
.reelium-stack-container {
    position: relative;
    width: 164px;
    height: 312px;
    perspective: 1000px;
    transition: width 0.5s ease-out;
}

/* Individual video card - ALWAYS absolute positioned */
.reelium-video-card {
    position: absolute !important;
    width: 164px;
    height: 294px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.5s ease-out;
    z-index: 1;
    left: 0;
    top: 0;
}

/* Video thumbnail - maintains positioning context */
.reelium-video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent !important;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.reelium-video-thumbnail img {
    width: 100%;
    height: 100%;
    border-radius:8px;
    object-fit: cover;
    display: block;
}

/* Play button styling */
.reelium-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
    z-index: 15;
    cursor: pointer;
    pointer-events: none; /* Clicks pass through to video card */
}

.reelium-video-card:hover .reelium-play-button {
    opacity: 1;
}

.reelium-play-button.hidden {
    display: none !important;
}

.reelium-play-button.hidden {
    opacity: 0 !important;
}

.reelium-play-button svg {
    width: 24px;
    height: 24px;
    fill: white;
    pointer-events: none;
}

/* Desktop stacked position - default state */
.reelium-video-card:nth-child(1) {
    transform: translateX(0) scale(1);
    z-index: 5;
}

.reelium-video-card:nth-child(2) {
    transform: translateX(10px) translateY(5px) scale(0.95);
    z-index: 4;
}

.reelium-video-card:nth-child(3) {
    transform: translateX(20px) translateY(10px) scale(0.9);
    z-index: 3;
}

.reelium-video-card:nth-child(n+4) {
    transform: translateX(30px) translateY(15px) scale(0.85);
    opacity: 0.6;
    z-index: 2;
}

/* Active video (playing state) */
.reelium-video-card.playing,
.reelium-video-card.autoplay {
    z-index: 50 !important;
}

.reelium-video-card.playing .reelium-video-thumbnail,
.reelium-video-card.autoplay .reelium-video-thumbnail {
    opacity: 0;
}

/* Video element styling */
.reelium-video-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

/* Navigation buttons - ALWAYS positioned relative to main container */
.reelium-nav-buttons {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    width: 100%;
    transform: translateY(-50%);
    display: none;
    justify-content: space-between;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reelium-nav-buttons.visible {
    display: flex;
    opacity: 1;
}

.reelium-nav-prev,
.reelium-nav-next {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
    padding: 0;
    pointer-events: auto;
}

.reelium-nav-prev {
    margin-left: 10px;
}

.reelium-nav-next {
    margin-right: 10px;
}

.reelium-nav-prev:hover,
.reelium-nav-next:hover {
    background-color: #32f17f;
}

.reelium-nav-prev:hover svg path,
.reelium-nav-next:hover svg path {
    stroke: black !important;
}

.reelium-nav-prev.disabled,
.reelium-nav-next.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* CTA button */
.reelium-cta-button {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: auto;
    z-index: 10;
    font-size: 12px;
    white-space: nowrap;
    max-width: 90%;
}

.reelium-video-card:hover .reelium-cta-button {
    opacity: 1;
}

.reelium-cta-button.square {
    border-radius: 0;
}

.reelium-cta-button.rounded {
    border-radius: 4px;
}

.reelium-cta-button.pill {
    border-radius: 50px;
}

/* Single video case */
.reelium-single-video .reelium-stack-container {
    width: 164px;
    max-width: 100%;
}

/* ===========================
   POPUP FUNCTIONALITY
   =========================== */

/* Floating popup trigger */
.reelium-popup-trigger {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
    cursor: pointer !important;
}

.reelium-popup-trigger.has-videos {
    animation: reelium-pulse 2s infinite !important;
}

/* Fixed: Make pulse animation circular */
@keyframes reelium-pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(50, 241, 127, 0.7) !important;
        border-radius: 100% !important;
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(50, 241, 127, 0.4) !important;
        border-radius: 100% !important;
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(50, 241, 127, 0.2) !important;
        border-radius: 100% !important;
    }
}

/* Circular video preview */
.reelium-popup-circle {
    width: 78px !important;
    height: 78px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    transition: transform 0.3s ease !important;
    position: relative !important;
    cursor: pointer !important;
}

.reelium-popup-circle:hover {
    transform: scale(1.1) !important;
}

.reelium-popup-circle video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

/* Popup container - Fixed: Chat window dimensions */
.reelium-popup-container {
    position: relative !important;
    width: 268px !important;
    height: 472px !important;
    background: #000 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
    user-select: none !important; /* Prevent text selection during scrolling */
}

.reelium-popup-content {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    transition: transform 0.3s ease-out !important;
}

/* Popup header */
.reelium-popup-header {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    right: 15px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    z-index: 20 !important;
}

.reelium-popup-counter {
    color: white !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    background: rgba(0,0,0,0.6) !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    backdrop-filter: blur(10px) !important;
}

.reelium-popup-close:hover {
    background: rgba(255,255,255,0.2) !important;
}

.reelium-popup-close svg {
    width: 16px !important;
    height: 16px !important;
}

/* Popup content */
.reelium-popup-content {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
}

/* Video container */
.reelium-popup-video-container {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    border-radius: 16px !important;
}

.reelium-popup-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 16px !important;
}

/* Popup play button */
.reelium-popup-play-button {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 60px !important;
    height: 60px !important;
    background-color: rgba(0,0,0,0.5) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 15 !important;
    transition: opacity 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.reelium-popup-play-button.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.reelium-popup-play-button svg {
    width: 28px !important;
    height: 28px !important;
}

.reelium-popup-navigation {
    position: absolute !important;
    right: 15px !important;
    bottom: 10% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    pointer-events: none !important;
    z-index: 25 !important;
}

.reelium-popup-prev,
.reelium-popup-next {
    width: 24px !important;
    height: 44px !important;
    border: none !important;
    background: rgba(0,0,0,0.6) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    padding:24px!important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    backdrop-filter: blur(10px) !important;
}

.reelium-popup-prev:hover,
.reelium-popup-next:hover {
    background: rgba(255,255,255,0.2) !important;
    transform: scale(1.1) !important;
}

.reelium-popup-prev:disabled,
.reelium-popup-next:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    transform: scale(1) !important;
}

/* Smooth transitions for all interactive elements */
.reelium-popup-play-button,
.reelium-popup-close {
    transition: all 0.3s ease !important;
}

.reelium-popup-close:hover {
    transform: scale(1.1) !important;
}

/* Enhanced CTA button animations */
.reelium-popup-cta-button {
    transition: all 0.3s ease !important;
}

.reelium-popup-cta-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

.reelium-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: -78px !important;
    background: rgba(0, 0, 0, 0.0) !important;
    z-index: 10000 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
    padding: 20px !important;
}

/* Clean SVG styling */
.reelium-popup-prev svg,
.reelium-popup-next svg,
.reelium-popup-close svg,
.reelium-popup-play-button svg {
    display: block !important;
    flex-shrink: 0 !important;
}

.reelium-popup-header,
.reelium-popup-navigation {
    transition: opacity 0.3s ease 0.2s !important;
}

/* Close button */
.reelium-popup-close {
    width: 12px !important;
    height: 12px !important;
    border: none !important;
    background: rgba(0,0,0,0.6) !important;
    border-radius: 100px !important;
    cursor: pointer !important;
    display: flex !important;
    padding:20px!important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.reelium-popup-close:hover {
    background: rgba(255,255,255,0.2) !important;
}

/* CTA button in popup */
.reelium-popup-cta {
    position: absolute !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 20 !important;
}

.reelium-popup-cta-button {
    color: white !important;
    text-decoration: none !important;
    padding: 10px 20px !important;
    font-weight: 500 !important;
    transition: opacity 0.3s ease !important;
    display: inline-block !important;
    min-height:36px !important;
    min-width: 100px !important;
    font-size: 14px !important;
    backdrop-filter: blur(10px) !important;
}

.reelium-popup-cta-button.square {
    border-radius: 4px !important;
}

.reelium-popup-cta-button.rounded {
    border-radius: 8px !important;
}

.reelium-popup-cta-button.pill {
    border-radius: 50px !important;
}

/* Logo inside popup - floating over video */
.reelium-popup-interior-logo {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: auto;
}

.reelium-stack-branding{
    position: absolute;
    bottom: 24px;
    left: 48px;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: auto;
}

.reelium-stack-branding img{
    width: 78px;
    height: auto;
    display: block;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.reelium-popup-interior-logo img  {
    width: 98px;
    height: auto;
    display: block;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.reelium-popup-interior-logo a:hover img, .reelium-stack-branding a:hover img {
    opacity: 1;
}

/* Mobile styles */
@media (max-width: 768px) {
    /* Mobile gradient fade */
    .reelium-product-videos::after {
        width: 30px;
    }
    
    .reelium-popup-overlay {
        padding: 10px !important;
    }
    
    .reelium-popup-container {
        width: 240px !important;
        height: 430px !important;
    }
    
    /* Mobile container - smaller size */
    .reelium-stack-container {
        width: 152px;
        height: 286px !important;
        cursor: pointer;
    }
    
    /* Mobile cards - smaller size, ALWAYS absolute */
    .reelium-video-card {
        width: 152px !important;
        height: 270px !important;
    }
    
    /* Mobile stacking - more compact */
    .reelium-video-card:nth-child(1) {
        transform: translateX(0) scale(1);
        z-index: 5;
    }
    
    .reelium-video-card:nth-child(2) {
        transform: translateX(8px) translateY(4px) scale(0.96);
        z-index: 4;
    }
    
    .reelium-video-card:nth-child(3) {
        transform: translateX(16px) translateY(8px) scale(0.92);
        z-index: 3;
    }
    
    .reelium-video-card:nth-child(n+4) {
        transform: translateX(24px) translateY(12px) scale(0.88);
        opacity: 0.7;
        z-index: 2;
    }
    
    /* Mobile expanded state - native scroll enabled */
    .reelium-stack-container.mobile-expanded {
        width: 100% !important;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y pan-x; /* Allow both vertical page scroll and horizontal container scroll */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    /* Hide scrollbar but keep functionality */
    .reelium-stack-container.mobile-expanded::-webkit-scrollbar {
        display: none;
    }
    
    .reelium-stack-container.mobile-expanded {
        scrollbar-width: none;
    }
    
    /* Mobile expanded cards - horizontal using transforms */
    .reelium-stack-container.mobile-expanded .reelium-video-card:nth-child(1) {
        transform: translateX(0) scale(1);
        z-index: 5;
        opacity: 1;
    }
    
    .reelium-stack-container.mobile-expanded .reelium-video-card:nth-child(2) {
        transform: translateX(164px) scale(1);
        z-index: 4;
        opacity: 1;
    }
    
    .reelium-stack-container.mobile-expanded .reelium-video-card:nth-child(3) {
        transform: translateX(328px) scale(1);
        z-index: 3;
        opacity: 1;
    }
    
    .reelium-stack-container.mobile-expanded .reelium-video-card:nth-child(4) {
        transform: translateX(492px) scale(1);
        z-index: 2;
        opacity: 1;
    }
    
    .reelium-stack-container.mobile-expanded .reelium-video-card:nth-child(5) {
        transform: translateX(656px) scale(1);
        z-index: 2;
        opacity: 1;
    }
    
    .reelium-stack-container.mobile-expanded .reelium-video-card:nth-child(6) {
        transform: translateX(820px) scale(1);
        z-index: 2;
        opacity: 1;
    }
    
    /* HIDE NAVIGATION BUTTONS ON MOBILE */
    .reelium-nav-buttons {
        display: none !important;
    }
    
    /* Mobile popup adjustments */
    .reelium-popup-container {
        border-radius: 0;
    }
    
    .reelium-popup-circle {
        width: 78px !important;
        height: 78px !important;
    }
}