/* Phone-only React shell and bottom navigation. */

@media (max-width: 767.98px) {
    :root {
        /* Share the bar height with page spacing, including the phone's home indicator. */
        --app-mobile-bottom-padding: max(10px, env(safe-area-inset-bottom, 0px));
        --app-mobile-bottom-height: calc(46px + var(--app-mobile-bottom-padding));
    }

    /* Hide Django's navbar before the lazy SPA route and React navigation mount. */
    body.spa-shell-body > .app-navbar,
    body.home-page-body > .app-navbar,
    body.search-page-body > .app-navbar,
    body.user-collection-page-body > .app-navbar,
    body.title-detail-page-body > .app-navbar,
    body.title-update-page-body > .app-navbar,
    body.discussions-page-body > .app-navbar,
    body.discussion-space-page-body > .app-navbar,
    body.discussion-management-page-body > .app-navbar,
    body.notifications-page-body > .app-navbar,
    body.login-page-body > .app-navbar,
    body.auth-page-body > .app-navbar,
    body.verify-email-body > .app-navbar {
        display: none;
    }

    body.home-page-body.home-mobile-navigation-fallback > .app-navbar {
        display: block;
    }

    .react-mobile-layout {
        display: block;
    }

    /* Reserve the React top-bar height so its mount does not shift page content. */
    #home-layout-root,
    #title-detail-mobile-nav-root,
    #title-reviews-mobile-nav-root {
        min-height: var(--app-mobile-header-height);
    }

    /* Reserve space only for an active bar; cached pages stay mounted inside hidden containers. */
    .site-main:has(.app-bottom-nav:not([hidden], [hidden] *)) {
        padding-bottom: calc(var(--app-mobile-bottom-height) + 16px);
    }

    .app-bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1040;
        min-height: var(--app-mobile-bottom-height);
        padding: 0 10px var(--app-mobile-bottom-padding);
        display: flex;
        align-items: center;
        justify-content: space-around;
        direction: rtl;
        background: #100b08;
        border-top: 1px solid rgba(242, 90, 0, 0.48);
    }

    .app-bottom-nav-item {
        min-width: 58px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: rgba(255, 255, 255, 0.72);
        text-decoration: none;
        transition: color 160ms ease;
    }

    .app-bottom-nav-item:hover,
    .app-bottom-nav-item:focus {
        color: #ffffff;
    }

    .app-bottom-nav-item.is-active {
        color: #f25a00;
    }

    .app-bottom-nav-icon {
        width: 26px;
        height: 24px;
        display: inline-grid;
        place-items: center;
    }

    .app-bottom-nav-icon svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: stroke-width 160ms ease;
    }

    .app-bottom-nav-item.is-active .app-bottom-nav-icon svg {
        stroke-width: 2.2;
    }

    .app-bottom-nav-create {
        min-width: 44px;
        padding: 0;
        border: 0;
        background: transparent;
        cursor: pointer;
    }

    .app-bottom-nav-plus {
        width: 38px;
        height: 38px;
        display: inline-grid;
        place-items: center;
        border-radius: 999px;
        background: #f25a00;
        color: #ffffff;
        font-size: 24px;
        font-weight: 900;
        line-height: 26px;
    }
}
