/* YTPlayer Core Styles v1.0.4 */

/* Player Wrapper */
.ytplayer-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    aspect-ratio: 16 / 9;
}

/* Plyr Container */
.ytplayer-wrapper .plyr {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: 1;
    position: relative;
}

.ytplayer-wrapper .plyr__video-wrapper {
    background: #000;
    z-index: 0;
    position: relative;
    width: 100%;
    height: 100%;
}

/* Overlays Container (Now kept inside Plyr at all times) */
.ytplayer-overlays-container,
.plyr .ytplayer-overlays-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Overlay Images */
.ytplayer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.ytplayer-frame-layer { z-index: 4; }
.ytplayer-branding-layer { z-index: 5; }

/* Interaction Blocker */
.ytplayer-interaction-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    z-index: 10;
    background: transparent;
    cursor: pointer;
    pointer-events: all;
}

/* Watermark/Marquee */
.ytplayer-watermark {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    z-index: 15;
    pointer-events: none;
    background: linear-gradient(to right, rgba(7, 7, 7, 0.9), rgba(0, 0, 0, 0.5));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
    backdrop-filter: blur(4px);
    overflow: hidden;
}

.ytplayer-marquee {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
}

.ytplayer-marquee-content {
    display: inline-block;
    animation: ytplayer-marquee 30s linear infinite;
}

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

.ytplayer-marquee-text {
    display: inline-block;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 0 40px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* Dynamic Text Base */
.ytplayer-dynamic-text {
    position: absolute;
    z-index: 25;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    max-width: 250px;
    text-align: center;
    line-height: 1.4;
    font-family: 'Poppins', sans-serif;
}

/* New Position Variants for Animation Sequence */
.ytplayer-dynamic-text-top-left {
    top: 20px; left: 20px; right: auto; bottom: auto;
}
.ytplayer-dynamic-text-top-right {
    top: 20px; left: auto; right: 20px; bottom: auto;
}
.ytplayer-dynamic-text-bottom-right {
    top: auto; left: auto; right: 20px; bottom: 85px; 
}
.ytplayer-dynamic-text-bottom-left {
    top: auto; left: 20px; right: auto; bottom: 85px; 
}
.ytplayer-dynamic-text-center {
    top: 50%; left: 50%; right: auto; bottom: auto;
}

/* User Logo */
.ytplayer-logo {
    position: absolute;
    top: 25px;
    right: 30px;
    z-index: 15;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    background: #fff;
    overflow: hidden;
}

.ytplayer-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Plyr Controls */
.ytplayer-wrapper .plyr__control--overlaid {
    z-index: 20 !important;
    background: rgba(242, 102, 0, 0.9) !important;
    box-shadow: 0 0 20px rgba(242, 102, 0, 0.5);
}

.ytplayer-wrapper .plyr__controls {
    z-index: 100 !important;
}

/* Quality Popup */
.ytplayer-quality-popup {
    position: absolute;
    bottom: 70px;
    right: 20px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 5px 0;
    display: none;
    z-index: 2147483647;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 120px;
}

.ytplayer-quality-popup.show {
    display: block !important;
}

.ytplayer-quality-option {
    padding: 10px 20px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Poppins', sans-serif;
}

.ytplayer-quality-option:hover {
    background: rgba(117, 79, 254, 0.2);
    color: #fff;
}

.ytplayer-quality-option.active {
    color: #754ffe;
    font-weight: 600;
    background: rgba(117, 79, 254, 0.1);
}

/* Custom Quality Button */
.ytplayer-custom-quality-btn {
    background: transparent !important;
    border: 0 !important;
    color: #fff !important;
    padding: 5px !important;
    margin-right: 5px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    opacity: 0.8 !important;
    transition: opacity 0.2s !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.ytplayer-custom-quality-btn:hover {
    opacity: 1 !important;
}

/* Video Container */
.ytplayer-video-container {
    width: 100%;
    height: 100%;
}

.ytplayer-video-container iframe {
    width: 100%;
    height: 100%;
}

/* Fullscreen - Plyr specific */
.plyr--fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
}

.plyr--fullscreen-active .ytplayer-watermark {
    bottom: 40px !important;
}

.plyr--fullscreen-active .ytplayer-logo {
    top: 30px !important;
    right: 40px !important;
}

.plyr--fullscreen-active .ytplayer-interaction-blocker {
    height: calc(100% - 40px) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .ytplayer-logo {
        width: 60px;
        height: 60px;
        top: 20px;
        right: 20px;
    }
    
    .ytplayer-dynamic-text {
        max-width: 160px;
        font-size: 10px;
    }

    .ytplayer-dynamic-text-top-left { top: 15px; left: 15px; }
    .ytplayer-dynamic-text-top-right { top: 15px; right: 15px; }
    .ytplayer-dynamic-text-bottom-right { bottom: 65px; right: 15px; }
    .ytplayer-dynamic-text-bottom-left { bottom: 65px; left: 15px; }
    
    .ytplayer-watermark {
        bottom: 45px;
    }
}

@media (max-width: 576px) {
    .ytplayer-marquee-text {
        font-size: 11px;
        padding: 0 20px;
    }
    
    .ytplayer-logo {
        width: 45px;
        height: 45px;
        top: 15px;
        right: 15px;
    }
    
    .ytplayer-watermark {
        bottom: 40px;
        padding: 6px 0;
    }
    
    .ytplayer-dynamic-text {
        max-width: 150px;
        font-size: 9px;
        padding: 6px 12px;
    }
}