/**
 * YouTube Video Slider Styles
 * Version: 1.0.0
 */

/* ============================================
   MAIN CONTAINER
   ============================================ */
.youtube-slider-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.youtube-slider-container {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    background: #000;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ============================================
   SLIDES
   ============================================ */
.youtube-slider-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
}

.slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* Background Style (when video is background) */
.slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transition: transform 5s ease;
    z-index: 1;
}

.slide.active .slide-bg {
    transform: scale(1.05);
}

/* Background Video Player - covers entire slide like an image */
.slide-video-background {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none; /* Can't interact with background videos */
}

.slide-video-background iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Make video cover the slide properly - maintain 16:9 aspect ratio */
@media (min-aspect-ratio: 16/9) {
    .slide-video-background iframe {
        height: 56.25vw; /* 9/16 * 100 */
    }
}

@media (max-aspect-ratio: 16/9) {
    .slide-video-background iframe {
        width: 177.78vh; /* 16/9 * 100 */
    }
}

/* Keep the fallback visible until the active YouTube stream is playing. */
.slide-video-background + .slide-bg {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.slide.yvs-player-playing .slide-video-background + .slide-bg {
    opacity: 0;
}

/* Unmute Button for Background Videos */
.video-unmute-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 0;
}

.video-unmute-btn:hover {
    background: rgba(255, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.video-unmute-btn.unmuted {
    background: rgba(255, 0, 0, 0.9);
    border-color: #fff;
}

.video-unmute-btn.unmuted .mute-icon {
    display: none;
}

.video-unmute-btn.unmuted .unmute-icon {
    display: block !important;
}

/* Hide unmute button on slides without background video */
.slide:not(:has(.slide-video-background)) .video-unmute-btn {
    display: none;
}

/* Video Player Positions */
.slide-video-player {
    position: absolute;
    top: 50%!important;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.slide-video-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Video Position: Left/Right Split Screen */
.youtube-slider-wrapper[data-video-position="left"] .slide-video-player,
.youtube-slider-wrapper[data-video-position="right"] .slide-video-player {
    width: 50%;
    height: 100%;
}

.youtube-slider-wrapper[data-video-position="left"] .slide-video-player {
    left: 0;
}

.youtube-slider-wrapper[data-video-position="right"] .slide-video-player {
    right: 0;
}

.youtube-slider-wrapper[data-video-position="left"] .slide-content {
    right: 0;
    left: auto;
    width: 50%;
}

.youtube-slider-wrapper[data-video-position="right"] .slide-content {
    left: 0;
    width: 50%;
}

/* Video Position: Center */
.youtube-slider-wrapper[data-video-position="center"] .slide-video-player {
    width: 80%;
    max-width: 900px;
    left: 50%;
    transform: translateX(-50%);
    top: 50px;
    height: auto;
    aspect-ratio: 16/9;
    z-index: 2;
}

.youtube-slider-wrapper[data-video-position="center"] .slide-content {
    bottom: 0;
    top: auto;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    padding-top: 100px !important;
    padding-bottom: 40px !important;
}

/* Overlay */
.slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
    z-index: 2;
    pointer-events: none;
}

/* No overlay on video when positioned */
.youtube-slider-wrapper[data-video-position="center"] .slide::before,
.youtube-slider-wrapper[data-video-position="left"] .slide::before,
.youtube-slider-wrapper[data-video-position="right"] .slide::before {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 40%, transparent 60%);
}

/* ============================================
   SLIDE CONTENT
   ============================================ */
.slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 60px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    max-width: 700px;
    color: #fff;
}

/* Channel Badge */
.slide-channel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 0, 0, 0.9);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease forwards 0.2s;
}

.slide-channel svg {
    width: 16px;
    height: 16px;
}

/* Title */
.slide-title {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 20px 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 0.6s ease forwards 0.3s;
}

.slide-title a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.slide-title a:hover {
    opacity: 0.8;
}

/* Description */
.slide-description {
    font-size: 18px;
    line-height: 1.6;
    margin: 0 0 24px 0;
    opacity: 0.95;
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease forwards 0.4s;
}

/* Button */
.slide-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: #ff0000;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(255, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease forwards 0.5s;
}

.slide-button svg {
    width: 20px;
    height: 20px;
}

.slide-button:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(255, 0, 0, 0.6);
}

/* ============================================
   THUMBNAIL NAVIGATION
   ============================================ */
.thumbnail-navigation {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10;
    padding: 0 20px;
}

.thumbnail-nav-container {
    display: flex;
    gap: 12px;
    overflow: hidden;
    scroll-behavior: smooth;
    flex: 1;
}

.thumbnail-item {
    position: relative;
    flex: 0 0 calc((100% - 36px) / 4);
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.thumbnail-item:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.5);
}

.thumbnail-item.active {
    border-color: #ff0000;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.5);
}

.thumb-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.thumbnail-item:hover .thumb-image {
    transform: scale(1.1);
}

.thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #fff;
}

.thumb-number {
    font-weight: 700;
    opacity: 0.7;
}

.thumb-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

/* Thumbnail Arrows */
.thumb-arrow {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.thumb-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.thumb-arrow:active {
    transform: scale(0.95);
}

/* ============================================
   TEXT NAVIGATION
   ============================================ */
.text-navigation {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    z-index: 10;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

.nav-number {
    font-weight: 700;
    opacity: 0.7;
}

/* ============================================
   DOTS NAVIGATION
   ============================================ */
.dots-navigation {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.dot-item {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.dot-item:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.dot-item.active {
    background: #ff0000;
    border-color: #fff;
    transform: scale(1.3);
}

/* ============================================
   MOBILE SLIDE TITLE (for mobile-only display)
   ============================================ */
.mobile-slide-title {
    display: none;
    padding: 20px;
    background: #fff;
    border-radius: 0 0 24px 24px;
    margin-top: -24px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.mobile-slide-title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade Animation */
.youtube-slider-wrapper[data-animation="fade"] .slide {
    transition: opacity 0.8s ease;
}

/* Slide Animation */
.youtube-slider-wrapper[data-animation="slide"] .slide {
    transition: transform 0.8s ease, opacity 0.8s ease;
}

.youtube-slider-wrapper[data-animation="slide"] .slide:not(.active) {
    transform: translateX(100%);
}

.youtube-slider-wrapper[data-animation="slide"] .slide.active {
    transform: translateX(0);
}

/* Zoom Animation */
.youtube-slider-wrapper[data-animation="zoom"] .slide {
    transition: transform 0.8s ease, opacity 0.8s ease;
}

.youtube-slider-wrapper[data-animation="zoom"] .slide:not(.active) {
    transform: scale(0.8);
}

.youtube-slider-wrapper[data-animation="zoom"] .slide.active {
    transform: scale(1);
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */
@media (max-width: 1024px) {
    .thumbnail-item {
        flex: 0 0 calc((100% - 24px) / 3);
    }
    
    .slide-content {
        padding: 50px;
    }
    
    .slide-title {
        font-size: 48px;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .youtube-slider-container {
        height: 500px;
        border-radius: 16px;
    }
    
    /* Force video to full width on mobile for all positions */
    .youtube-slider-wrapper[data-video-position="left"] .slide-video-player,
    .youtube-slider-wrapper[data-video-position="right"] .slide-video-player {
        width: 100% !important;
        height: 60% !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        transform: none !important;
        margin-top: 0 !important;
    }
    
    .youtube-slider-wrapper[data-video-position="center"] .slide-video-player {
        width: 90% !important;
        max-width: 100% !important;
        height: auto !important;
        left: 50% !important;
        right: auto !important;
        top: 30px !important;
        transform: translateX(-50%) !important;
        margin-top: 0 !important;
    }
    
    .youtube-slider-wrapper[data-video-position="left"] .slide-content,
    .youtube-slider-wrapper[data-video-position="right"] .slide-content {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%) !important;
        padding-top: 60px !important;
    }
    
    .youtube-slider-wrapper[data-video-position="center"] .slide-content {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%) !important;
        padding-top: 60px !important;
    }
    
    .slide-content {
        padding: 30px;
        max-width: 100%;
    }
    
    .slide-title {
        font-size: 32px;
        margin-bottom: 16px;
    }
    
    .slide-description {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .slide-button {
        padding: 14px 28px;
        font-size: 15px;
    }
    
    /* Unmute button on mobile */
    .video-unmute-btn {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    /* Thumbnail Navigation on Mobile */
    .thumbnail-navigation {
        width: 95%;
        bottom: 20px;
        padding: 0 10px;
    }
    
    .thumbnail-nav-container {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 8px;
    }
    
    .thumbnail-nav-container::-webkit-scrollbar {
        display: none;
    }
    
    .thumbnail-item {
        flex: 0 0 120px;
        height: 70px;
    }
    
    .thumb-arrow {
        width: 35px;
        height: 35px;
    }
    
    /* Text Navigation on Mobile */
    .text-navigation {
        flex-direction: column;
        max-width: 90%;
        gap: 8px;
    }
    
    .nav-item {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Hide thumbnails/text nav if mobile style is "hide" */
    .youtube-slider-wrapper[data-mobile-nav="hide"] .thumbnail-navigation,
    .youtube-slider-wrapper[data-mobile-nav="hide"] .text-navigation,
    .youtube-slider-wrapper[data-mobile-nav="hide"] .dots-navigation {
        display: none;
    }
    
    /* Show title below if mobile style is "title" */
    .youtube-slider-wrapper[data-mobile-nav="title"] .thumbnail-navigation,
    .youtube-slider-wrapper[data-mobile-nav="title"] .text-navigation {
        display: none;
    }
    
    .youtube-slider-wrapper[data-mobile-nav="title"] .mobile-slide-title {
        display: block;
    }
}

@media (max-width: 480px) {
    .youtube-slider-container {
        height: 450px;
    }
    
    .slide-title {
        font-size: 28px;
    }
    
    .slide-description {
        font-size: 14px;
    }
    
    .thumbnail-item {
        flex: 0 0 100px;
        height: 60px;
    }
}

/* ============================================
   ERROR MESSAGES
   ============================================ */
.yvs-error {
    padding: 20px;
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 8px;
    color: #c33;
    font-weight: 600;
    text-align: center;
}

/* ============================================
   LOADING STATE
   ============================================ */
.youtube-slider-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.youtube-slider-container.loading::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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