/* Mobile app shell (<= 900px): bottom nav, premium search panel, image skeletons */

:root {
    --bm-app-nav-bg: rgba(7, 12, 20, 0.94);
    --bm-app-nav-border: rgba(255, 255, 255, 0.1);
    --bm-app-nav-text: rgba(220, 232, 248, 0.82);
    --bm-app-nav-active: #00b4a0;
    --bm-app-card-border: rgba(48, 194, 205, 0.28);
    --bm-app-page-bg: #08101b;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: clip;
    overflow-y: auto !important;
    background-color: var(--bm-app-page-bg);
}

body {
    background-color: var(--bm-app-page-bg);
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto !important;
}

html.staff-profile-open,
body.modal-open,
body.search-modal-open,
body.app-search-open,
body.mobile-menu-open,
body.offcanvas-open,
body.bm-trailer-modal-open,
body.staff-profile-open {
    overflow-y: hidden !important;
}

@media (max-width: 900px) {
    body.has-mobile-bottom-nav {
        padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    }

    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        -webkit-overflow-scrolling: touch;
    }

    img,
    svg,
    video,
    canvas,
    iframe {
        max-width: 100%;
    }

    table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
    }

    .top-ad-area {
        padding: calc(env(safe-area-inset-top, 0px) + 6px) 0 4px;
        background: transparent;
        overflow: hidden;
    }

    .top-ad-area .ads-wrapper,
    .top-ad-area .bm-top-banner-row {
        overflow: hidden;
    }

    .top-ad-area .ad-1300x130 {
        width: 100%;
        min-height: 0;
        margin: 0 auto;
        border-radius: 10px;
    }

    .player-container,
    #d-player {
        position: relative;
        z-index: 99999;
    }

    body.bm-mobile-player-priority #seasonal-overlay {
        display: none !important;
    }

    .container,
    .container-max,
    .row,
    .site-footer__inner,
    .section-head-row,
    .home-section,
    .movie-grid,
    .hero-section,
    .hero-section__inner,
    .bm-most-viewed-shell,
    .bm-most-viewed-pane {
        min-width: 0;
        max-width: 100%;
    }

    .row > [class*="col-"] {
        min-width: 0;
    }

    .site-footer .sf-list a,
    .movie.movie-card .card-more-btn,
    .hero-section__btn,
    #topShell .mobile-offcanvas-menu__link,
    #topShell .search-panel__submit,
    #topShell .search-panel__filter,
    #topShell .search-panel__close {
        min-height: 44px;
    }

    body.has-mobile-bottom-nav #topShell .gen-menu-search-block {
        display: none !important;
    }
}

.bm-mobile-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 100050;
    display: none;
    align-items: center;
    justify-content: space-around;
    gap: 6px;
    min-height: 64px;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--bm-app-nav-border);
    background: var(--bm-app-nav-bg);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

@media (max-width: 900px) {
    body.has-mobile-bottom-nav .bm-mobile-nav {
        display: flex;
    }

    #back-to-top .top {
        right: 12px;
        width: 46px;
        height: 46px;
        line-height: 46px;
        font-size: 22px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    body.has-mobile-bottom-nav #back-to-top .top {
        bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    }
}

.bm-mobile-nav__item {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    outline: none;
    background: transparent;
    text-decoration: none;
    color: var(--bm-app-nav-text);
    min-width: 52px;
    min-height: 44px;
    border-radius: 14px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 8px;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    flex: 1 1 0;
}

.bm-mobile-nav__item:active {
    transform: scale(0.98);
}

.bm-mobile-nav__item svg {
    width: 20px;
    height: 20px;
    display: block;
}

.bm-mobile-nav__label {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 700;
}

.bm-mobile-nav__item.is-active {
    color: var(--bm-app-nav-active);
    background: rgba(0, 180, 160, 0.12);
}

.bm-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 100100;
    background: rgba(2, 6, 12, 0.78);
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 16px 10px calc(16px + env(safe-area-inset-bottom, 0px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.bm-search-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.bm-search-overlay__panel {
    width: min(440px, calc(100vw - 20px));
    min-height: min(660px, calc(100dvh - 44px));
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
    border: 1px solid var(--bm-app-card-border);
    background: radial-gradient(120% 120% at 50% 0%, rgba(17, 41, 70, 0.75) 0%, rgba(5, 14, 28, 0.95) 46%, rgba(3, 9, 19, 0.96) 100%);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bm-search-overlay__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
    padding: 12px 12px 10px;
    border-bottom: 1px solid var(--bm-app-card-border);
}

.bm-search-overlay__title {
    color: #e8f4ff;
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    text-align: center;
}

.bm-search-overlay__close {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(48, 194, 205, 0.35);
    background: rgba(255, 255, 255, 0.06);
    color: #dbe7f5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bm-search-overlay__controls {
    padding: 10px 12px;
    display: grid;
    gap: 8px;
}

.bm-search-overlay__field {
    width: 100%;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(48, 194, 205, 0.3);
    background: rgba(8, 16, 30, 0.86);
    color: #e9f3ff;
    padding: 0 12px;
    font-size: 14px;
}

.bm-search-overlay__submit {
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #0bc5bb 0%, #18d3c2 52%, #0b9eaf 100%);
    color: #032029;
    font-size: 14px;
    font-weight: 800;
}

.bm-search-overlay__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bm-search-overlay__tabs {
    display: flex;
    gap: 8px;
}

.bm-search-tab {
    border: 1px solid rgba(48, 194, 205, 0.36);
    background: rgba(255, 255, 255, 0.04);
    color: #cddff3;
    border-radius: 999px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
}

.bm-search-tab.is-active {
    color: #00343f;
    background: linear-gradient(135deg, #17e0cf 0%, #7ee7de 100%);
    border-color: transparent;
}

.bm-search-overlay__body {
    padding: 4px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    flex: 1 1 auto;
}

.bm-search-overlay__hint {
    color: rgba(220, 233, 248, 0.72);
    font-size: 12px;
    margin: 8px 2px 10px;
}

.bm-search-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.bm-search-list__item {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border: 1px solid rgba(48, 194, 205, 0.23);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 7px;
    text-decoration: none;
}

.bm-search-list__thumb {
    width: 56px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    background: #121b28;
}

.bm-search-list__title {
    color: #f0f7ff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.bm-search-list__meta {
    color: rgba(206, 221, 241, 0.8);
    font-size: 12px;
    margin-top: 4px;
}

body.app-search-open {
    overflow-x: hidden;
    overflow-y: hidden !important;
    overscroll-behavior: auto;
}

.app-skeleton-poster,
.app-skeleton-line {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(255, 255, 255, 0.14) 50%,
        rgba(255, 255, 255, 0.06) 100%
    );
    background-size: 220% 100%;
    animation: bmSkeletonPulse 1.3s linear infinite;
}

.app-skeleton-poster {
    border-radius: 14px;
    width: 100%;
    aspect-ratio: 2 / 3;
}

.app-skeleton-line {
    border-radius: 999px;
    height: 11px;
}

.app-skeleton-line.is-wide { width: 82%; }
.app-skeleton-line.is-mid { width: 58%; }
.app-skeleton-line.is-short { width: 34%; }

.app-img-skeleton {
    position: relative;
    overflow: hidden;
    background: #101726 !important;
}

.app-img-skeleton::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.16) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 220% 100%;
    animation: bmSkeletonPulse 1.1s linear infinite;
    z-index: 1;
}

.app-img-skeleton > img {
    opacity: 0;
    transition: opacity 0.24s ease;
}

.app-img-ready::before { display: none; }
.app-img-ready > img { opacity: 1; }

@media (max-width: 900px) {
    #topShell .mobile-offcanvas-menu {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    #topShell .mobile-offcanvas-menu__head {
        min-height: calc(58px + env(safe-area-inset-top, 0px));
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
    }

    #topShell .mobile-offcanvas-menu__body {
        height: calc(100dvh - 58px - env(safe-area-inset-top, 0px));
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    #topShell .header-search-overlay {
        align-items: flex-start !important;
        justify-content: center !important;
        padding:
            max(10px, env(safe-area-inset-top, 0px))
            10px
            calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #topShell .search-panel {
        width: min(100%, 560px) !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 !important;
        border-radius: 18px !important;
        overflow: hidden !important;
    }

    #topShell .search-panel__top-row,
    #topShell .search-panel__advanced {
        grid-template-columns: 1fr !important;
    }

    #topShell .search-panel__results {
        min-width: 0;
        overflow-x: hidden;
    }

    .section-head-row {
        display: grid !important;
        gap: 12px !important;
    }

    .section-head-row > * {
        min-width: 0;
    }

    .hero-section__title,
    .hero-section__description,
    .movie.movie-card .card-title a,
    .movie.movie-card .card-more-btn,
    .site-footer .sf-list a,
    .site-footer .sf-bottom-text {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 575px) {
    .bm-mobile-nav {
        gap: 4px;
        padding-inline: 8px;
    }

    .bm-mobile-nav__item {
        min-width: 0;
        padding-inline: 4px;
    }

    .bm-mobile-nav__label {
        font-size: 10px;
    }

    #topShell .search-panel__head,
    #topShell .search-panel__filters,
    #topShell .search-panel__advanced,
    #topShell .search-panel__top-row {
        min-width: 0;
    }

    .site-footer .sf-card {
        padding: 16px !important;
    }

    .site-footer .sf-bottom-text {
        width: 100%;
        text-align: center;
        white-space: normal;
    }
}

@keyframes bmSkeletonPulse {
    0% { background-position: 220% 0; }
    100% { background-position: -220% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .bm-mobile-nav__item,
    .bm-search-overlay,
    .app-img-skeleton > img {
        transition: none !important;
    }

    .app-skeleton-poster,
    .app-skeleton-line,
    .app-img-skeleton::before {
        animation: none !important;
    }
}

/* 2026-03 Mobile / Tablet navigation hardening */
.bm-mobile-nav__item:focus-visible,
.bm-search-overlay__close:focus-visible,
.bm-search-overlay__panel :where(button, a, input, select):focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(4, 12, 20, 0.96), 0 0 0 5px rgba(58, 242, 214, 0.42);
}

@media (max-width: 900px) {
    .bm-mobile-nav__item,
    .bm-search-overlay__close {
        min-height: 44px;
    }

    .bm-search-overlay__panel {
        width: min(500px, calc(100vw - 24px));
    }
}

@media (min-width: 768px) and (max-width: 1100px) {
    .bm-search-overlay {
        padding: 24px;
    }

    .bm-search-overlay__panel {
        width: min(560px, calc(100vw - 56px));
        max-height: calc(100dvh - 56px);
        border-radius: 22px;
    }
}
