/* =========================================================
   QPROCURE MOBILE DRAWER FIX V39
   Final patch for the current QProcure HTML structure
   - Works with .topbar, #qpMobilePrimaryNav, .sidebar,
     #mobileMenuOverlay and .qp-mobile-bottom-nav
   - Drawer stays between the fixed top navigation and bottom nav
   - Drawer scrolls internally without hiding fixed navigation
   ========================================================= */

@media (max-width:700px){
  :root{
    --qp-mobile-topbar-h:64px;
    --qp-mobile-primary-h:54px;
    --qp-mobile-bottom-h:68px;
  }

  /* Keep the real current fixed bars above everything. */
  .topbar{
    z-index:3200 !important;
  }

  #qpMobilePrimaryNav,
  .qp-mobile-primary-nav{
    z-index:3190 !important;
  }

  .qp-mobile-bottom-nav{
    z-index:3300 !important;
  }

  /* Real current sidebar: open only in the space between top and bottom navs. */
  .app > .sidebar,
  .sidebar{
    position:fixed !important;
    top:calc(env(safe-area-inset-top) + var(--qp-mobile-topbar-h) + var(--qp-mobile-primary-h)) !important;
    bottom:calc(var(--qp-mobile-bottom-h) + env(safe-area-inset-bottom)) !important;
    height:auto !important;
    max-height:none !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    z-index:3180 !important;
    box-sizing:border-box !important;
  }

  /* The drawer's internal navigation may be taller than the available space. */
  .sidebar #nav{
    overflow:visible !important;
    min-height:max-content !important;
  }

  .sidebar .user-menu-scroll{
    overflow:visible !important;
    max-height:none !important;
  }

  /* Hide desktop promotional block inside the mobile drawer to keep navigation clean. */
  .sidebar .grow-card{
    display:none !important;
  }

  /* Real current overlay must cover content only, not the fixed top/bottom bars. */
  #mobileMenuOverlay,
  .mobile-menu-overlay{
    position:fixed !important;
    top:calc(env(safe-area-inset-top) + var(--qp-mobile-topbar-h) + var(--qp-mobile-primary-h)) !important;
    bottom:calc(var(--qp-mobile-bottom-h) + env(safe-area-inset-bottom)) !important;
    left:0 !important;
    right:0 !important;
    height:auto !important;
    z-index:3170 !important;
  }

  /* Keep the chat button above the fixed bottom nav and outside the drawer. */
  .floating-chat-button{
    z-index:3310 !important;
    bottom:calc(var(--qp-mobile-bottom-h) + env(safe-area-inset-bottom) + 12px) !important;
  }
}
