/*
 * Watch route composition inspired by the reference player architecture:
 * player first, episode queue beside it, then source controls and metadata.
 * The existing IDs/classes remain intact so watch.js keeps ownership of
 * playback, fallback and episode navigation.
 */
.watch-route {
    --watch-gutter: clamp(1rem, 2.8vw, 3.5rem);
    --watch-panel: #101216;
    --watch-panel-soft: #0d0f13;
    --watch-line: rgba(255, 255, 255, .1);
    --watch-accent: #ff4f5d;
    overflow-x: hidden;
}

.watch-route .main-content {
    padding-top: calc(var(--navbar-height) + 1.4rem);
    padding-bottom: 3rem;
}

.watch-route > .main-content > .container {
    width: min(100%, 1900px);
    max-width: none;
    padding-inline: var(--watch-gutter);
}

.watch-route .watch-layout {
    gap: 1.25rem;
}

.watch-route .watch-main {
    min-width: 0;
}

@media (min-width: 1025px) {
    .watch-route .watch-main {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 25rem);
        gap: 1.25rem;
    }

    .watch-route .watch-player-column {
        grid-column: 1;
        min-width: 0;
    }

    .watch-route .watch-sidebar-column {
        grid-column: 2;
        min-width: 0;
    }

    .watch-route .watch-main.sidebar-right .watch-player-column {
        grid-column: 1 !important;
    }

    .watch-route .watch-main.sidebar-right .watch-sidebar-column {
        grid-column: 2 !important;
    }

    .watch-route .episode-sidebar {
        max-height: min(var(--player-area-height, calc(100vh - 8rem)), 48rem) !important;
        height: min(var(--player-area-height, calc(100vh - 8rem)), 48rem) !important;
        border-color: var(--watch-line);
        border-radius: .8rem;
        background: var(--watch-panel-soft);
    }
}

.watch-route .video-wrapper,
.watch-route #player-area {
    border-radius: .8rem;
}

.watch-route .video-wrapper {
    box-shadow: 0 20px 70px rgba(0, 0, 0, .3);
}

.watch-route .watch-quick-bar,
.watch-route .watch-nav-bar,
.watch-route #watch-navigation > div[style*="background"] {
    border-color: var(--watch-line);
    background: var(--watch-panel-soft);
}

.watch-route .watch-quick-bar {
    margin-top: .65rem;
    border-radius: .8rem;
}

.watch-route .watch-nav-bar {
    border-radius: .8rem;
}

.watch-route .episode-sidebar-header {
    background: transparent;
    border-color: var(--watch-line);
}

.watch-route .episode-sidebar-list {
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.watch-route .episode-sidebar-list[data-view="list"] .episode-sidebar-item,
.watch-route .episode-sidebar-list[data-view="grid"] .episode-sidebar-item {
    border-color: rgba(255, 255, 255, .09);
}

.watch-route .episode-sidebar-list[data-view="list"] .episode-sidebar-item.current,
.watch-route .episode-sidebar-list[data-view="grid"] .episode-sidebar-item.current {
    background: #f4f3ef;
    color: #101114;
}

.watch-route .watch-sidebar-section {
    border-color: var(--watch-line);
    background: var(--watch-panel-soft);
}

.watch-route .server-sections,
.watch-route #serverSections {
    min-width: 0;
}

.watch-route .server-section-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.watch-route .server-pill {
    min-height: 2.35rem;
    border-radius: .65rem;
    border-color: rgba(255, 255, 255, .1);
}

.watch-route .server-pill.active {
    background: var(--watch-accent);
    border-color: var(--watch-accent);
    box-shadow: 0 8px 24px rgba(255, 79, 93, .2);
}

.watch-route .anime-details-section {
    border-top: 1px solid var(--watch-line);
    padding-top: 1.5rem;
}

@media (max-width: 1024px) {
    .watch-route .watch-main {
        display: flex;
        flex-direction: column;
    }

    .watch-route .watch-player-column {
        order: 1;
    }

    .watch-route .watch-sidebar-column {
        order: 2;
    }

    .watch-route .episode-sidebar {
        max-height: 31rem;
    }
}

@media (max-width: 640px) {
    .watch-route .main-content {
        padding-top: calc(var(--navbar-height) + .75rem);
    }

    .watch-route > .main-content > .container {
        padding-inline: .7rem;
    }

    .watch-route .watch-quick-bar {
        overflow-x: auto;
        white-space: nowrap;
    }

    .watch-route .watch-nav-bar {
        gap: .55rem;
        flex-wrap: wrap;
    }

    .watch-route .watch-nav-right {
        width: 100%;
        justify-content: flex-start;
    }

    .watch-route .episode-sidebar {
        max-height: 25rem;
        border-radius: .7rem;
    }
}
