/* 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);
}

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

    #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;
    }
}

.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;
}

.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(100vh - 44px));
    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: 36px;
    height: 36px;
    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%;
    height: 40px;
    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 {
    height: 42px;
    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: 34px;
    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: hidden;
    touch-action: none;
}

.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; }

@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;
    }
}
