/* ==========================================================
   GLOBAL
   ========================================================== */

html,
body {
    margin: 0;
    padding: 0;
    /*background: #141414;*/
    background: transparent!important;
    color: #ffffff;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ==========================================================
   NETFLIX PAGE
   ========================================================== */

.netflix-container {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    /*background: #141414;*/
    background: transparent;
    color: #ffffff;
    padding: 0 0 60px;
    overflow-x: hidden;
}

.netflix-container h1 {
    font-size: clamp(2rem, 4vw, 4rem);
    font-weight: 800;
    margin: 0 0 30px;
    padding-inline: 4vw;
    letter-spacing: -0.04em;
}

.channel-section {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.playlist-row {
    position: relative;
    width: 100%;
    background: transparent;
}

.playlist-title {
    padding-inline: 4vw;
    margin: 0 0 12px;
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 700;
    color: #e5e5e5;
}

/* ==========================================================
   CHANNEL STRIP
   ========================================================== */

/* ==========================================================
   CHANNEL STRIP
   ========================================================== */

.channel-strip-container {
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: visible;
    margin-bottom: 10px;
    padding-bottom: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.channel-strip-container::-webkit-scrollbar {
    display: none;
}

.channel-strip {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 10px;

    width: max-content;
    min-width: 100%;

    padding: 12px 4vw;

    background: linear-gradient(
            135deg,
            rgba(255,255,255,.12),
            rgba(255,255,255,.04)
    );

    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);

    border: 1px solid rgba(255,255,255,.10);
    border-radius: 18px;
}

.channel-item {
    color: inherit;
    text-decoration: none;
    flex: 0 0 80px;
    width: 80px;
    min-width: 80px;
    max-width: 80px;

    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2px;

    cursor: pointer;
    transition: transform .2s ease, opacity .2s ease;
}

.channel-item:hover {
    transform: scale(1.05);
}

.channel-logo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    background: #222;
    border: 2px solid transparent;
    transition: border-color .2s ease, transform .2s ease;
}

.channel-item:hover .channel-logo {
    border-color: #e50914;
}

.channel-name {
    width: 100%;
    margin-top: 4px;
    text-align: center;
    color: #e5e5e5;
    font-size: .7rem;
    line-height: 1.1;
}
/* ==========================================================
   VIDEO ROWS
   ========================================================== */

.row-container {
    position: relative;
    width: 100%;
    max-width: 100vw;
    overflow: visible;
    background: transparent;
}

.video-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;

    width: 100%;
    max-width: 100vw;

    overflow-x: auto;
    overflow-y: hidden;

    scroll-behavior: smooth;
    scroll-snap-type: x proximity;

    scrollbar-width: none;
    -ms-overflow-style: none;

    padding: 0 60px 12px 60px;
    background: transparent;
}

.video-row::-webkit-scrollbar {
    display: none;
}

.video-preview {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    z-index: 20;

    pointer-events: none;


    opacity: 0;
    transition: opacity .3s ease;

}

/* ==========================================================
   VIDEO CARDS
   ========================================================== */

.video-card {
    position: relative;
    flex: 0 0 320px;
    width: 320px;

    aspect-ratio: 16 / 9;

    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    /*background: #222;*/
    background: transparent;
    scroll-snap-align: start;

    transition:
            transform .18s ease,
            box-shadow .18s ease,
            filter .18s ease;
}


.video-card * {
    pointer-events: none;
}


.video-card:hover {
    transform: scale(1.08);
    z-index: 100;
    box-shadow: 0 20px 40px rgba(0,0,0,.7);
    filter: brightness(1.08);
}

/* The popover supplies the enlarged preview. Scaling its anchor changes the
   scroll-snap position as the pointer moves between the card and the popover. */
.video-card:has(rtn-hover-preview):hover,
.video-row.shorts-row .video-card:has(rtn-hover-preview):hover {
    transform: none;
}

.video-card:hover .video-preview {
    opacity: 1;
}


.video-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity .2s ease;
}

.video-card:hover::after {
    opacity: 1;
}

.video-poster {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    
    z-index: 1;
    position: relative;

}

.video-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 14px 12px;

    background: linear-gradient(
            to top,
            rgba(0,0,0,.85),
            rgba(0,0,0,.35),
            transparent
    );

    pointer-events: none;
}

.video-name {
    display: -webkit-box;
    overflow: hidden;
    color: #fff;

    font-size: .9rem;
    font-weight: 700;
    line-height: 1.3;

    text-shadow: 0 2px 6px rgba(0,0,0,.9);

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ==========================================================
   LOADING
   ========================================================== */

.loading-container {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,.2);
    border-top-color: #e50914;
    border-radius: 50%;
    animation: netflix-spin .8s linear infinite;
}

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

/* ==========================================================
   SCROLL BUTTONS (FIXED)
   ========================================================== */

.scroll-button {
    position: absolute;
    top: 0;
    bottom: 0;

    width: 60px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: white;
    font-size: 2rem;

    border: none;
    cursor: pointer;

    z-index: 200;

    /* Netflix-style fade */
    background: linear-gradient(
            to right,
            rgba(20,20,20,0.9),
            rgba(20,20,20,0)
    );

    transition: opacity 0.2s ease;
}

/* LEFT */
.scroll-button.scroll-left {
    left: 0;
}

/* RIGHT */
.scroll-button.scroll-right {
    right: 0;

    background: linear-gradient(
            to left,
            rgba(20,20,20,0.9),
            rgba(20,20,20,0)
    );
}

.scroll-button:hover {
    opacity: 1;
}

/* ==========================================================
   SHORT CARDS (VERTICAL / SHORTS)
   ========================================================== */

.short-card {
    border: 3px solid red;
    flex: 0 0 220px;
    width: 220px;

    aspect-ratio: 9 / 16;

    border-radius: 12px;
    overflow: hidden;

    /*background: #222;*/
    background: transparent;

    transition: transform .18s ease, box-shadow .18s ease;
}

.short-card:hover {
    transform: scale(1.06);
    z-index: 20;
    box-shadow: 0 20px 40px rgba(0,0,0,.7);
}



/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (min-width: 1800px) {
    .video-card {
        flex-basis: calc(16.666% - 10px);
    }
}

@media (max-width: 1400px) {
    .video-card {
        flex-basis: calc(25% - 10px);
    }
}

@media (max-width: 1024px) {
    .video-card {
        flex-basis: calc(33.333% - 10px);
    }
}

@media (max-width: 768px) {
    .playlist-title,
    .netflix-container h1 {
        padding-inline: 16px;
    }

    .video-row {
        padding: 0 48px 12px 48px;
    }

    .video-card {
        flex-basis: calc(50% - 10px);
    }

    .scroll-button {
        width: 40px;
        font-size: 1.4rem;
    }

    .channel-strip {
        gap: 12px;
        padding: 0 16px 20px;
    }

    .channel-item {
        flex-basis: 90px;
        width: 90px;
        min-width: 90px;
        max-width: 90px;
    }

    .channel-logo {
        width: 70px;
        height: 70px;
    }

    .channel-name {
        font-size: .75rem;
    }

    .short-card {
        flex: 0 0 160px;
    }
}

@media (max-width: 480px) {
    .playlist-title {
        font-size: 1rem;
    }

    .video-row {
        padding: 0 40px 12px 40px;
    }

    .netflix-container {
        padding-top: 16px;
    }

    .scroll-button {
        width: 34px;
        font-size: 1.1rem;
    }

    .channel-strip {
        gap: 10px;
        padding: 0 12px 16px;
    }

    .channel-item {
        flex-basis: 80px;
        width: 80px;
        min-width: 80px;
        max-width: 80px;
    }

    .channel-logo {
        width: 60px;
        height: 60px;
    }

    .channel-name {
        font-size: .7rem;
    }

    .short-card {
        flex: 0 0 140px;
    }
}

@media (max-width: 360px) {
    .video-card {
        flex: 0 0 92%;
    }

    .short-card {
        flex: 0 0 120px;
    }
}

/* ==========================================================
   CHANNEL HEADER
   ========================================================== */

.channel-hero {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
}

.channel-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: end;
    padding: 40px;

    background: linear-gradient(
            to top,
            rgba(20,20,20,.95),
            rgba(20,20,20,.2)
    );
}

.channel-hero-overlay h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 4rem);
    font-weight: 800;
}

.channel-header {
    display: flex;
    align-items: center;
    gap: 24px;

    margin: 20px 4vw 30px;
    padding: 24px 30px;
    /*background: rgba(255, 0, 0, 0.5) !important;*/


    background:
            linear-gradient(
                    135deg,
                    rgba(255,255,255,.22),
                    rgba(255,255,255,.08)
            );

    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);

    border: 1px solid rgba(255,255,255,0.25);

    border-radius: 20px;

    box-shadow:
            0 8px 32px rgba(0,0,0,.35),
            inset 0 1px 0 rgba(255,255,255,.25);
}

.channel-header-logo {
    width: 110px;
    height: 110px;

    border-radius: 16px;

    object-fit: cover;

    border: 1px solid rgba(255,255,255,.15);

    box-shadow:
            0 8px 24px rgba(0,0,0,.25);
}

.video-card {
    position: relative;
}

.watch-later-icon i {
    color: white;
    font-size: 18px;
}

.watch-later-icon.selected {
    background: white;
}

.watch-later-icon.selected i {
    color: #111;
}

.watch-later-icon {

    pointer-events:auto !important;

    position: absolute;
    top: 8px;
    right: 8px;

    width: 36px;
    height: 36px;

    border: none;
    border-radius: 50%;

    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: crosshair;
    z-index: 20;
}

.watch-later-icon i {
    color: white;
    font-size: 18px;
}

.watch-later-icon:hover {
    background: rgba(0,0,0,0.75);
}
/* Crawlable video URLs retain the existing interactive preview behavior. */
.video-card .video-page-link {
    display: block;
    height: 100%;
    pointer-events: auto;
    color: inherit;
    text-decoration: none;
}

/* Shared Home and channel preview controls and Shorts dimensions. */
    .preview-details-button {
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 40;
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        padding: 0;
        border: 1px solid rgba(255,255,255,.75);
        border-radius: 50%;
        background: rgba(20,20,20,.85);
        color: white;
        cursor: pointer;
        pointer-events: auto !important;
    }

    .preview-details-button:hover,
    .preview-details-button:focus-visible {
        background: #CB2537;
        outline: 2px solid white;
        outline-offset: 2px;
    }

    .video-card:has(rtn-hover-preview) .video-overlay {
        padding-right: 54px;
    }

    /* ==========================================================
   SHORT CARDS (VERTICAL / SHORTS)
   ========================================================== */

    .video-row.shorts-row {
        gap: 14px;
        align-items: flex-start;
    }

    .video-row.shorts-row .video-card {
        flex: 0 0 180px;
        width: 180px;
        aspect-ratio: 9 / 16;

        border-radius: 14px;
        overflow: hidden;
    }

    .video-row.shorts-row .video-card:hover {
        transform: scale(1.06);
        z-index: 100;
    }

    .video-row.shorts-row .video-poster {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    @media (max-width: 768px) {
    .video-row.shorts-row .video-card {
        flex: 0 0 150px;
        width: 150px;
    }
    }

    @media (max-width: 480px) {
    .video-row.shorts-row .video-card {
        flex: 0 0 130px;
        width: 130px;
    }
    }

    @media (max-width: 360px) {
    .video-row.shorts-row .video-card {
        flex: 0 0 115px;
        width: 115px;
    }
    }

/* Touch controls must not overlap on the shorter landscape cards. */
@media (hover: none), (pointer: coarse), (max-width: 768px),
       (max-width: 1024px) and (max-height: 480px) {
    .video-card .watch-later-icon,
    .video-card .preview-details-button {
        width: 44px;
        height: 44px;
        right: 8px;
    }
    .video-card .preview-details-button { bottom: 8px; }
    .scroll-button { width: 44px; min-width: 44px; }
}

@media (max-width: 768px) {
    .video-row {
        padding-inline: 52px;
        scroll-padding-inline: 52px;
    }
    .channel-header { gap: 12px; margin: 12px 16px 24px; padding: 16px; }
    .channel-header-logo { width: 72px; height: 72px; flex: 0 0 72px; }
    .channel-header-info { min-width: 0; }
    .channel-header-info h1 {
        font-size: clamp(1.2rem, 5vw, 1.75rem);
        padding: 0;
        margin: 0;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 480px) {
    .video-row:not(.shorts-row) .video-card {
        flex: 0 0 min(280px, calc(100vw - 64px));
        width: min(280px, calc(100vw - 64px));
    }
}

rtn-discovery-loader {
    flex: 0 0 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    color: #ddd;
    text-align: center;
    white-space: normal;
}
.discovery-load-button {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #777;
    border-radius: 6px;
    background: #202020;
    color: #fff;
    cursor: pointer;
}
.discovery-load-button:disabled { cursor: wait; opacity: .65; }
/* Keep the user's position when new discovery cards are inserted before the loader. */
.video-row:has(rtn-discovery-loader) {
    overflow-anchor: none;
    scroll-snap-type: none;
}
