/* Best Property Plug — Properties V72 header stack recovery */

@media (max-width: 767px) {
    /* The Properties template owns this legacy header; remove it on mobile. */
    body.rpg-properties-exact-v2 .rpgp-shell > .rpgx-topbar,
    body.rpg-properties-exact-v2 .rpgp-shell > .rpgx-header,
    body.rpg-properties-exact-v2 .rpgp-shell > .rpgx-mobile-menu,
    body.rpg-properties-exact-v2 .rpgx-header-spacer-v221 {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }

    body.rpg-properties-v72-ready .rpgp2-filter-form,
    body.rpg-properties-v72-ready .rpgp2-results-section,
    body.rpg-properties-v72-ready .rpgp2-results-section > .rpgp2-container,
    body.rpg-properties-v72-ready .rpgp2-results-grid,
    body.rpg-properties-v72-ready .rpgp2-results-main {
        overflow: visible !important;
    }

    body.rpg-properties-v72-ready .rpgp2-toolbar {
        position: sticky !important;
        top: var(--rpg-properties-v72-sticky-top, 66px) !important;
        z-index: 1550 !important;
        width: 100% !important;
        margin-top: 0 !important;
        transform: none !important;
        background: rgba(255, 255, 255, .985) !important;
        border: 1px solid #dce9e2 !important;
        box-shadow: 0 8px 18px rgba(5, 65, 46, .13) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    body.rpg-properties-v72-ready .rpgp2-toolbar.is-stuck,
    body.rpg-properties-v72-ready .rpgp2-toolbar.rpgp66-is-stuck {
        top: var(--rpg-properties-v72-sticky-top, 66px) !important;
        margin: 0 !important;
        transform: none !important;
    }
}


/* ================================================================
   RPG_PROPERTIES_MOBILE_FILTER_HEADER_CLEARANCE_V722
   Keep sticky/floating property filters below global mobile header.
   ================================================================ */

@media (max-width: 767px) {

    #rpgp2-listing .bpp-properties-mobile-filter-clearance {
        top:
            calc(
                var(--bpp-properties-mobile-header-bottom, 74px)
                + 8px
            ) !important;

        z-index: 9000 !important;
    }

    /*
     * Prevent the floating toolbar from visually joining the header.
     * It stays above property cards but below the global header.
     */
    #rpgp2-listing .bpp-properties-mobile-filter-clearance {
        max-width:
            calc(100vw - 20px) !important;

        margin-left: auto !important;
        margin-right: auto !important;
    }
}



/* ================================================================
   RPG_PROPERTIES_MOBILE_STACK_V723

   Mobile Properties:
   1. Sticky filter stays below real global mobile header.
   2. Bottom navigation never hides final property content.
   3. Search gets clear active state.
   ================================================================ */

@media (max-width: 767px) {

    /*
     * JavaScript writes the measured header bottom here.
     * Strong final rule intentionally overrides older V72 values.
     */
    html body.rpg-properties-exact-v2
    #rpgp2-listing
    .bpp-properties-mobile-filter-v723 {
        position: sticky !important;

        top:
            calc(
                var(
                    --bpp-properties-v723-header-bottom,
                    86px
                )
                + 8px
            ) !important;

        z-index: 11020 !important;

        width:
            calc(100% - 16px) !important;

        max-width:
            calc(100vw - 16px) !important;

        margin-left: auto !important;
        margin-right: auto !important;
    }


    /*
     * Keep content scrollable above the floating bottom navigation.
     */
    html body.rpg-properties-exact-v2 {
        padding-bottom:
            calc(
                var(
                    --bpp-properties-v723-bottom-nav-height,
                    96px
                )
                + 22px
                + env(safe-area-inset-bottom)
            ) !important;
    }


    /*
     * Keep the floating bottom navigation above listings,
     * but below drawers/modals.
     */
    html body.rpg-properties-exact-v2
    .bpp-properties-bottom-nav-v723 {
        z-index: 12020 !important;
    }


    /*
     * Strong active state for Search on /properties.
     */
    html body.rpg-properties-exact-v2
    .bpp-properties-bottom-nav-v723
    > a.bpp-properties-search-active-v723 {
        background: #069653 !important;
        color: #ffffff !important;

        border-radius: 18px !important;

        box-shadow:
            0 8px 20px rgba(2, 110, 61, .16)
            !important;
    }

    html body.rpg-properties-exact-v2
    .bpp-properties-bottom-nav-v723
    > a.bpp-properties-search-active-v723
    > strong {
        background:
            rgba(255,255,255,.16) !important;

        color: #ffffff !important;
    }

    html body.rpg-properties-exact-v2
    .bpp-properties-bottom-nav-v723
    > a.bpp-properties-search-active-v723
    svg {
        color: #ffffff !important;
        stroke: currentColor !important;
    }


    /*
     * Do not let the filter attach visually to the header.
     */
    html body.rpg-properties-exact-v2
    #rpgp2-listing
    .bpp-properties-mobile-filter-v723 {
        border-radius: 18px !important;

        box-shadow:
            0 10px 28px rgba(2, 61, 43, .14)
            !important;
    }
}





/* ================================================================
   RPG_PROPERTIES_USE_GLOBAL_ADMIN_BAR_V7233

   IMPORTANT:
   Properties does NOT style or rebuild the admin toolbar.

   It only exposes the existing global #admin_bar used by Homepage.
   All colors, typography, logo, dropdowns and menu appearance come
   from the site's normal global admin-bar CSS.
   ================================================================ */

@media (max-width: 767px) {

    /*
     * Logged-in admin:
     * reveal the SAME global admin bar used by Homepage.
     *
     * Do not set background, typography, menu spacing, logo styling,
     * dropdown styling or any other visual design here.
     */
    html body.show-admin-bar.rpg-properties-exact-v2 #admin_bar {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /*
     * Keep the existing mobile stack relationship:
     *
     * Admin bar    0 -> 40
     * Global header 40 -> ~106
     * Filter       ~114
     *
     * The existing Properties/global sticky systems calculate the
     * actual heights.
     */
    html body.show-admin-bar.rpg-properties-exact-v2 .rpg-gmh1,
    html body.show-admin-bar.rpg-properties-exact-v2 .rpg-gmh2 {
        top: var(--rpg-prop-admin-h, 40px) !important;
    }

    /*
     * Guest/non-admin pages must never receive an admin offset.
     */
    html body.rpg-properties-exact-v2:not(.show-admin-bar) .rpg-gmh1,
    html body.rpg-properties-exact-v2:not(.show-admin-bar) .rpg-gmh2 {
        top: 0 !important;
    }
}

