.plyr--video {
    .plyr__control--overlaid {
        background: var(--bs-primary);

        &.plyr__control:hover {
            background: var(--bs-primary);
        }
    }

    .plyr__controls {

        .plyr__control {
            &:hover {
                background: var(--bs-primary);
            }
    
            &:focus-visible,
            &:hover,
            &[aria-expanded="true"] {
                background: var(--bs-primary);
            }
        }

        input[type="range"] {
            color: var(--bs-primary);
        }
    }

}

/* Sources menu styles */
.plyr__sources {
    position: absolute;
    bottom: 100%;
    right: .625rem;
    margin-bottom: .625rem;
    padding: .625rem;
    background: var(--bs-gray-900);
    border-radius: var(--bs-border-radius);
    width: 250px;
    display: none;
    color: var(--bs-white);
    font-size: .875rem;
   
    .plyr__sources__header {
        padding-bottom: 0.5em;
        border-bottom: .063rem solid var(--bs-border-color);
        margin-bottom: .625rem;
        h5 {
            margin: 0;
            color: var(--bs-white);
            font-size: .875rem;
        }
    }
    .plyr__sources__list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .plyr__sources__button {
        width: 100%;
        background: none;
        border: none;
        color: var(--bs-body-color);
        padding: .5rem;
        text-align: left;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: all 0.2s;
        &:hover {
            color: var(--bs-primary);
        }
        &.active {
            color: var(--bs-primary);
        }
        .source-quality {
            opacity: 0.7;
            margin-left: .313rem;
            font-size: .75rem;
        }
        .source-language {
            opacity: 0.7;
            font-size: .75rem;
            margin-left: auto;
            padding-left: .625rem;
        }
    }
    
    /* Sources button styles */
    .plyr__control--sources svg {
        width: 1.125rem;
        height: 1.125rem;
    }
}

.plyr__sources--active {
    display: block;
}

/* Next Episode Overlay - Base Styles */
.plyr__next-overlay {
    display: none;
    position: absolute;
    bottom: 10%; 
    right: 1.25em;
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;

    .next-episode-button-wrapper {
        display: none;
        align-items: center;
        gap: .5em;

        .btn {
            padding: .5em 1em;
            font-size: .75em;
            font-weight: 500;
        }

        .next-episode-button {
            position: relative;
            color: var(--bs-white);
            z-index: 1;

            > span {
                position: relative;
                z-index: 1;
            }

            &::after {
                content: "";
                display: inline-block;
                background: var(--bs-primary);
                height: 100%;
                width: var(--data-fill);
                position: absolute;
                top: 0;
                left: 0;
                z-index: 0;
                border-radius: .25em;
            }
        }
    }

    &.is-active {
        display: block;
        opacity: 1;
        pointer-events: all;
    }

    .next-episode-content {
        position: relative;
        background: var(--bs-gray-900);
        padding: 1.5em;
        border-radius: var(--bs-border-radius);
        width: 20em;
        z-index: 11;
    }

    .next-episode {
        cursor: pointer;
        
        &:hover {
            .play-icon {
                transform: translate(-50%, -50%) scale(1.1);
            }
        }
    }

    .next-episode__thumbnail {
        position: relative;
        margin-bottom: 1.5em;
        border-radius: var(--bs-border-radius-sm);
        overflow: hidden;
        width: 100%;
        height: 4/2.5;

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            border-radius: var(--bs-border-radius-sm);
        }

        .play-icon {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 3em;
            height: 3em;
            background: var(--bs-primary);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s ease;

            svg {
                width: 1.25em;
                height: 1.25em;
                fill: var(--bs-white);
            }
        }
    }

    .next-episode__info {

        .season-label {
            font-size: .75em;
            margin-bottom: .5em;
        }

        h6 {
            margin: 0 0 .625em;
        }

        .countdown {
            display: flex;
            align-items: center;
            gap: .25em;
            font-size: .875em;

            svg {
                width: 1em;
                height: 1em;
                fill: currentColor;
            }

            .timer {
                font-weight: 600;
            }
        }
    }

    .close-btn {
        position: absolute;
        top: 0.25em;
        right: 0.25em;
        background: var(--bs-body-bg);
        border: none;
        width: 1.3em;
        font-size: 1em;
        height: 1.3em;
        padding: 0;
        display: flex;
        align-items: center;
        border-radius: 50%;
        justify-content: center;
        cursor: pointer;
        transition: background 0.2s;
        z-index: 3;

        .close-icon {
            font-size: .75em;
        }

        &:hover {
            background: var(--bs-body-bg);
        }
    }
}

@include media-breakpoint-down(lg) {
    .plyr__next-overlay {
        bottom: 12%;

        .next-episode-content {
            width: 15em;
        }
    }
}

@include media-breakpoint-down(md) {
    .plyr__controls {
        .plyr__control {
            padding: 2px;
        }
    }

    .ls-fullscreen-ad video {
        object-fit: contain;
    }

    .plyr__next-overlay {
        bottom: 50px;

        .next-episode-content {
            display: none;
        }

        .next-episode-button-wrapper {
            display: flex;
        }
    }
}

@media (max-width: 991.98px) and (max-height: 500px) {
    .plyr__next-overlay {
        bottom: 50px;

        .next-episode-content {
            display: none;
        }

        .next-episode-button-wrapper {
            display: flex;
        }
    }
}

@media (max-width: 499.98px) {
    .plyr__next-overlay {
        bottom: 37px;

        .next-episode-button-wrapper {
            .btn {
                font-size: .625em;
            }
        }
    }
}