/* Video Carousel Frontend Styles - Horizontal Scrolling Shorts Feed */

.video-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 40px 80px;
    background: #000;
}

.video-carousel-container {
    position: relative;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.video-carousel-container::-webkit-scrollbar {
    display: none;
}

.video-carousel-slide {
    flex: 0 0 auto;
    width: 280px; /* Fixed width for each short */
    background: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-carousel-slide:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    z-index: 10;
}

/* Responsive visibility classes */
@media (min-width: 1025px) {
    .video-carousel-slide.hide-desktop {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .video-carousel-slide.hide-tablet {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .video-carousel-slide.hide-mobile {
        display: none !important;
    }
}

/* Video container - Optimized for vertical Shorts (9:16 aspect ratio) */
.video-carousel-video {
    position: relative;
    width: 280px;
    height: 498px; /* 9:16 ratio (280 * 16/9 = 497.78) */
    background: #000;
    overflow: hidden;
    border-radius: 16px;
}

.video-carousel-video video,
.video-carousel-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover; /* Changed to cover for better Shorts display */
    border-radius: 16px;
}

/* Ensure video controls are always visible and functional */
.video-carousel-video video {
    pointer-events: auto !important;
}

/* Force native controls to display */
.video-carousel-video video::-webkit-media-controls-enclosure {
    display: flex !important;
    opacity: 1 !important;
}

.video-carousel-video video::-webkit-media-controls-panel {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.video-carousel-video video::-webkit-media-controls-play-button {
    display: block !important;
    pointer-events: auto !important;
}

/* Ensure controls are clickable and above everything */
.video-carousel-video video::-webkit-media-controls {
    z-index: 2147483647 !important;
    pointer-events: auto !important;
}

/* Firefox controls */
.video-carousel-video video::-moz-media-controls {
    display: block !important;
}

/* Maintain aspect ratio */
@supports (aspect-ratio: 9 / 16) {
    .video-carousel-video {
        aspect-ratio: 9 / 16;
        height: auto;
    }
}

/* Content section - Styled for Shorts */
.video-carousel-content {
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: #fff;
    z-index: 10;
}

.video-carousel-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.video-carousel-description {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.video-carousel-button {
    display: inline-block;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: #fff;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.video-carousel-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.video-carousel-button:active {
    transform: translateY(0);
}

/* Navigation arrows - For horizontal scrolling */
.video-carousel-prev,
.video-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 56px;
    height: 56px;
    font-size: 28px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.video-carousel-prev:hover,
.video-carousel-next:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.video-carousel-prev:active,
.video-carousel-next:active {
    transform: translateY(-50%) scale(0.95);
}

.video-carousel-prev {
    left: 15px;
}

.video-carousel-next {
    right: 15px;
}

/* Hide arrows if not enough videos */
.video-carousel-wrapper[data-slides="1"] .video-carousel-prev,
.video-carousel-wrapper[data-slides="1"] .video-carousel-next,
.video-carousel-wrapper[data-slides="2"] .video-carousel-prev,
.video-carousel-wrapper[data-slides="2"] .video-carousel-next,
.video-carousel-wrapper[data-slides="3"] .video-carousel-prev,
.video-carousel-wrapper[data-slides="3"] .video-carousel-next {
    display: none;
}

/* Navigation dots - Hidden for horizontal scroll */
.video-carousel-dots {
    display: none; /* Not needed for horizontal scroll view */
}

/* Tablet styles - Show 3 shorts */
@media (max-width: 1024px) {
    .video-carousel-wrapper {
        padding: 30px 60px;
    }
    
    .video-carousel-slide {
        width: 240px;
    }
    
    .video-carousel-video {
        width: 240px;
        height: 426px;
    }
    
    .video-carousel-container {
        gap: 12px;
    }
    
    .video-carousel-title {
        font-size: 16px;
    }
    
    .video-carousel-description {
        font-size: 13px;
    }
    
    .video-carousel-content {
        padding: 14px;
    }
    
    .video-carousel-prev,
    .video-carousel-next {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
    
    .video-carousel-prev {
        left: 10px;
    }
    
    .video-carousel-next {
        right: 10px;
    }
}

/* Mobile styles - Show 1-2 shorts, scroll horizontally */
@media (max-width: 767px) {
    .video-carousel-wrapper {
        padding: 20px 50px 20px 20px;
        background: #000;
    }
    
    .video-carousel-container {
        gap: 12px;
        padding: 5px 0;
    }
    
    .video-carousel-slide {
        width: calc(100vw - 100px); /* Almost full width minus padding */
        max-width: 340px;
    }
    
    .video-carousel-video {
        width: 100%;
        height: auto;
        aspect-ratio: 9 / 16;
    }
    
    .video-carousel-title {
        font-size: 15px;
        margin-bottom: 6px;
    }
    
    .video-carousel-description {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .video-carousel-content {
        padding: 12px;
    }
    
    .video-carousel-button {
        padding: 8px 18px;
        font-size: 12px;
    }
    
    .video-carousel-prev,
    .video-carousel-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
        background: rgba(255, 255, 255, 0.2);
    }
    
    .video-carousel-prev {
        left: 8px;
    }
    
    .video-carousel-next {
        right: 8px;
    }
}

/* Large screens - Show 5 shorts */
@media (min-width: 1440px) {
    .video-carousel-wrapper {
        padding: 50px 100px;
    }
    
    .video-carousel-slide {
        width: 300px;
    }
    
    .video-carousel-video {
        width: 300px;
        height: 533px;
    }
    
    .video-carousel-container {
        gap: 20px;
    }
}

/* Loading state */
.video-carousel-loading {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-carousel-loading::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.video-carousel-prev:focus,
.video-carousel-next:focus,
.video-carousel-dot:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Scroll indicators (fade effect at edges) */
.video-carousel-wrapper::before,
.video-carousel-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-carousel-wrapper::before {
    left: 0;
    background: linear-gradient(to right, #000, transparent);
}

.video-carousel-wrapper::after {
    right: 0;
    background: linear-gradient(to left, #000, transparent);
}

/* Smooth appearance animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-carousel-slide {
    animation: fadeInUp 0.5s ease-out backwards;
}

.video-carousel-slide:nth-child(1) { animation-delay: 0.1s; }
.video-carousel-slide:nth-child(2) { animation-delay: 0.2s; }
.video-carousel-slide:nth-child(3) { animation-delay: 0.3s; }
.video-carousel-slide:nth-child(4) { animation-delay: 0.4s; }
.video-carousel-slide:nth-child(5) { animation-delay: 0.5s; }

/* Print styles */
@media print {
    .video-carousel-prev,
    .video-carousel-next {
        display: none;
    }
    
    .video-carousel-wrapper {
        padding: 0;
        background: #fff;
    }
    
    .video-carousel-wrapper::before,
    .video-carousel-wrapper::after {
        display: none;
    }
    
    .video-carousel-container {
        display: block;
    }
    
    .video-carousel-slide {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 20px;
        width: 100%;
    }
}

/* Custom play button overlay - Styled for Shorts */
.video-carousel-video .custom-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.video-carousel-video .custom-play-button:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-carousel-video .custom-play-button::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 14px 0 14px 24px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 4px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Hide custom play button when video has started */
.video-carousel-video.has-played .custom-play-button {
    display: none;
}

/* Empty state */
.video-carousel-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
}

.video-carousel-empty::before {
    content: '🎬';
    display: block;
    font-size: 60px;
    margin-bottom: 20px;
}
