/**
 * Native pull-to-refresh for pool and video chat browse.
 * Requires html.ulgb-native-pull-refresh-video-chat (see ulgb_native_pull_refresh_config.php).
 *
 * Video rooms (video_chat.php): browse in #vc-empty inside #vc-room-modal (groups-style main panel).
 * Pool: browse in #vc-mobile-browse-host sidebar on narrow layouts.
 *
 * Active only when NOT in an active session:
 *   - body.vc-body--vc-room-open  (pool / video in-room)
 *   - body.channels-modal-open      (channels live viewer)
 *
 * Revert: set $ulgbNativePullRefreshVideoChatEnabled = false in config.
 */
@media screen and (max-width: 1024px) {
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat:has(
        body.video-chat-page:not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open)
    ) {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: auto;
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-groups-home-iframe):not(.ulgb-no-native-pull-refresh) {
        overflow: visible !important;
        min-height: 100%;
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat:has(.navbar-bottom)
        body.video-chat-page:not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) {
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px));
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat:has(.navbar)
        body.video-chat-page:not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-groups-home-iframe):not(.ulgb-no-native-pull-refresh) {
        padding-top: var(--ulgb-mobile-content-top, 72px);
    }

    /* --- Pool browse (sidebar host) --- */
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .homepage-wrapper {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        inset: auto !important;
        overflow: visible !important;
        min-height: calc(
            100dvh - var(--ulgb-mobile-content-top, 72px) - 85px - env(safe-area-inset-bottom, 0px)
        ) !important;
        height: auto !important;
        max-height: none !important;
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .homepage-main-content,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .homepage-main-container,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-desktop-app,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-layout,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-sidebar,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-sidebar-body,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-mobile-browse-host,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .pool-center-box {
        overflow: visible !important;
        overscroll-behavior: auto !important;
        touch-action: auto !important;
        max-height: none !important;
        height: auto !important;
        min-height: 0 !important;
        flex: none !important;
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) #vc-mobile-browse-host .vc-browse-inner,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) #vc-browse-categories-view,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) #vc-browse-rooms-view,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-browse-room-list,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.pool-page.video-chat-page:not(.vc-body--vc-room-open):not(.channels-modal-open) .vc-browse-category-grid {
        overflow: visible !important;
        overscroll-behavior: auto !important;
        touch-action: auto !important;
        max-height: none !important;
        height: auto !important;
        min-height: 0 !important;
        flex: none !important;
    }

    /* --- Video rooms browse (#vc-empty in main panel, groups-style) --- */
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .homepage-wrapper,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .homepage-main-content,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .homepage-main-container,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .vc-desktop-app,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .vc-layout,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal .vc-desktop-float-panel,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal .vc-desktop-float-columns,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal .vc-desktop-float-left,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal .vc-stage,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal .vc-video-shell,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal .vc-video-wrap,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-empty,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-empty .vc-browse-inner,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .vc-rooms-center-box,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .vc-mobile-browse-header {
        position: relative !important;
        inset: auto !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        overflow: visible !important;
        overscroll-behavior: auto !important;
        touch-action: auto !important;
        flex: none !important;
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
        flex-basis: auto !important;
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-room-modal.vc-room-modal:not(.vc-room-modal--open) {
        display: flex !important;
        flex-direction: column !important;
        z-index: 1 !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
        height: auto !important;
    }

    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-browse-categories-view,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) #vc-browse-rooms-view,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .vc-browse-room-list,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat
        body.video-chat-page:not(.pool-page):not(.groups-page):not(.channels-page):not(.vc-body--vc-room-open):not(.channels-modal-open):not(.ulgb-no-native-pull-refresh) .vc-browse-category-grid {
        overflow: visible !important;
        overscroll-behavior: auto !important;
        touch-action: auto !important;
        flex: none !important;
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
    }

    /* Full-screen overlays keep their own scroll while open. */
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat .groups-detail-modal-scroll-wrap,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat .channels-live-modal-overlay,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat .channels-setup-overlay,
    html.ulgb-native-pull-refresh-active.ulgb-native-pull-refresh-video-chat .vc-room-modal.vc-room-modal--open {
        overscroll-behavior: contain !important;
    }
}

