/**
 * YouTube Video Slider - Frontend Styles
 *
 * News/Media website style with dark overlay, play button, and responsive design
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.yvs-slider {
    --yvs-primary: #ff0000;
    --yvs-bg-dark: #0f0f0f;
    --yvs-bg-overlay: rgba(0, 0, 0, 0.6);
    --yvs-text-light: #ffffff;
    --yvs-text-muted: #aaaaaa;
    --yvs-border-radius: 8px;
    --yvs-transition: 0.3s ease;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 1400px;
    padding: 20px;
}

.yvs-slider *,
.yvs-slider *::before,
.yvs-slider *::after {
    box-sizing: inherit;
}

.yvs-no-videos {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* ==========================================================================
   Split Layout (Main Video + Sidebar)
   ========================================================================== */

.yvs-slider-split {
    display: flex;
    gap: 20px;
    background: var(--yvs-bg-dark);
    border-radius: var(--yvs-border-radius);
    overflow: hidden;
    padding: 15px;
}

/* Main Video Area */
.yvs-main-video {
    flex: 0 0 65%;
    max-width: 65%;
}

.yvs-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: var(--yvs-border-radius);
    overflow: hidden;
    cursor: pointer;
}

.yvs-main-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--yvs-transition);
}

.yvs-video-wrapper:hover .yvs-main-thumbnail {
    transform: scale(1.02);
}

/* Play Overlay */
.yvs-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--yvs-bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity var(--yvs-transition), background var(--yvs-transition);
}

.yvs-video-wrapper:hover .yvs-play-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.yvs-play-icon {
    width: 68px;
    height: 48px;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
    transition: transform var(--yvs-transition);
}

.yvs-video-wrapper:hover .yvs-play-icon {
    transform: scale(1.1);
}

/* Video Info Overlay */
.yvs-video-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 20px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
}

.yvs-video-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--yvs-text-light);
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Video List Sidebar */
.yvs-video-list {
    flex: 0 0 35%;
    max-width: 35%;
    min-width: 0;
}

.yvs-list-swiper {
    height: 100%;
    max-height: 480px;
}

.yvs-list-swiper .swiper-wrapper {
    flex-direction: column;
}

.yvs-list-swiper .swiper-slide {
    height: auto !important;
}

/* Video Item */
.yvs-video-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--yvs-transition);
}

.yvs-video-item:hover,
.yvs-video-item.yvs-active {
    background: rgba(255, 255, 255, 0.1);
}

.yvs-video-item.yvs-active {
    border-left: 3px solid var(--yvs-primary);
}

.yvs-item-thumbnail {
    position: relative;
    flex: 0 0 140px;
    width: 140px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: #1a1a1a;
}

.yvs-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--yvs-transition);
}

.yvs-video-item:hover .yvs-item-thumbnail img {
    transform: scale(1.05);
}

.yvs-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--yvs-transition);
}

.yvs-video-item:hover .yvs-item-overlay {
    opacity: 1;
}

.yvs-item-play {
    width: 40px;
    height: 28px;
}

/* Duration Badge */
.yvs-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Item Info */
.yvs-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.yvs-item-title {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--yvs-text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navigation Buttons */
.yvs-slider-split .swiper-button-next,
.yvs-slider-split .swiper-button-prev {
    display: none;
}

/* ==========================================================================
   Carousel Layout
   ========================================================================== */

.yvs-slider-carousel {
    background: var(--yvs-bg-dark);
    border-radius: var(--yvs-border-radius);
    padding: 20px;
}

.yvs-carousel-swiper {
    padding-bottom: 50px;
}

.yvs-carousel-item {
    cursor: pointer;
}

.yvs-carousel-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1a;
}

.yvs-carousel-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--yvs-transition);
}

.yvs-carousel-item:hover .yvs-carousel-thumbnail img {
    transform: scale(1.05);
}

.yvs-carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--yvs-bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--yvs-transition);
}

.yvs-carousel-item:hover .yvs-carousel-overlay {
    opacity: 1;
}

.yvs-carousel-play {
    width: 50px;
    height: 35px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.yvs-carousel-info {
    padding: 12px 5px;
}

.yvs-carousel-title {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--yvs-text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Carousel Navigation */
.yvs-carousel-next,
.yvs-carousel-prev {
    color: #fff !important;
    background: rgba(0, 0, 0, 0.7);
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    transition: background var(--yvs-transition);
}

.yvs-carousel-next:hover,
.yvs-carousel-prev:hover {
    background: rgba(0, 0, 0, 0.9);
}

.yvs-carousel-next::after,
.yvs-carousel-prev::after {
    font-size: 18px !important;
    font-weight: bold;
}

/* Carousel Pagination */
.yvs-carousel-pagination {
    bottom: 10px !important;
}

.yvs-carousel-pagination .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.5;
    width: 10px;
    height: 10px;
}

.yvs-carousel-pagination .swiper-pagination-bullet-active {
    opacity: 1;
    background: var(--yvs-primary);
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.yvs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.yvs-modal-overlay.yvs-modal-active {
    opacity: 1;
    visibility: visible;
}

.yvs-modal-container {
    position: relative;
    width: 85%;
    max-width: 800px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.yvs-modal-overlay.yvs-modal-active .yvs-modal-container {
    transform: scale(1);
}

.yvs-modal-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
}

.yvs-modal-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.yvs-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 10;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.yvs-modal-close:hover {
    background: #ff0000;
    color: #fff;
    transform: scale(1.05);
}

.yvs-modal-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.yvs-modal-title {
    padding: 15px 20px;
    background: #1a1a1a;
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
    .yvs-slider-split {
        flex-direction: column;
    }
    
    .yvs-main-video,
    .yvs-video-list {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .yvs-list-swiper {
        max-height: 300px;
    }
    
    .yvs-list-swiper .swiper-wrapper {
        flex-direction: row;
    }
    
    .yvs-video-item {
        flex-direction: column;
        width: 200px;
    }
    
    .yvs-item-thumbnail {
        flex: none;
        width: 100%;
        height: 110px;
    }
    
    .yvs-item-title {
        -webkit-line-clamp: 2;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .yvs-slider {
        padding: 10px;
    }
    
    .yvs-slider-split,
    .yvs-slider-carousel {
        padding: 10px;
    }
    
    .yvs-video-title {
        font-size: 16px;
    }
    
    .yvs-play-icon {
        width: 50px;
        height: 35px;
    }
    
    .yvs-video-info {
        padding: 40px 15px 15px;
    }
    
    .yvs-video-item {
        width: 160px;
        padding: 8px;
    }
    
    .yvs-item-thumbnail {
        height: 90px;
    }
    
    .yvs-item-title {
        font-size: 12px;
    }
    
    .yvs-carousel-title {
        font-size: 13px;
    }
    
    .yvs-carousel-next,
    .yvs-carousel-prev {
        width: 35px !important;
        height: 35px !important;
    }
    
    .yvs-carousel-next::after,
    .yvs-carousel-prev::after {
        font-size: 14px !important;
    }
    
    /* Modal Mobile */
    .yvs-modal-container {
        width: 95%;
    }
    
    .yvs-modal-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 50%;
        z-index: 10;
    }
    
    .yvs-modal-title {
        font-size: 14px;
        padding: 12px 15px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .yvs-video-item {
        width: 140px;
    }
    
    .yvs-item-thumbnail {
        height: 78px;
    }
    
    .yvs-item-title {
        font-size: 11px;
    }
}

/* ==========================================================================
   Scrollbar Styles
   ========================================================================== */

.yvs-list-swiper::-webkit-scrollbar {
    width: 6px;
}

.yvs-list-swiper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.yvs-list-swiper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.yvs-list-swiper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.yvs-loading {
    position: relative;
}

.yvs-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: #fff;
    border-radius: 50%;
    animation: yvs-spin 0.8s linear infinite;
}

@keyframes yvs-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.yvs-video-wrapper:focus,
.yvs-video-item:focus,
.yvs-carousel-item:focus {
    outline: 2px solid var(--yvs-primary);
    outline-offset: 2px;
}

/* Skip focus outline for mouse users */
.yvs-video-wrapper:focus:not(:focus-visible),
.yvs-video-item:focus:not(:focus-visible),
.yvs-carousel-item:focus:not(:focus-visible) {
    outline: none;
}

/* Screen reader only text */
.yvs-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
