/* ==========================================================================
   Desktop/tablet sidebar: fixed, full-height, left-hand nav rail.
   Each nav item is a compact tappable block (icon on top, label below).
   Applies above the mobile breakpoint (>900px).
   ========================================================================== */
@media (min-width: 901px){
    nav#sidebar{
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 240px !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 20px 14px !important;
        gap: 6px;
        background: #fff !important;
        box-shadow: 2px 0 16px rgba(0,0,0,0.06);
        overflow-y: auto;
        z-index: 1000;
    }
    nav#sidebar .sidebar-list{
        display: flex !important;
        flex-direction: column !important;
        gap: 6px;
        width: 100%;
    }
    nav#sidebar a.nav-item{
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        width: 100%;
        min-height: 48px;
        padding: 10px 14px !important;
        margin: 0 !important;
        border-radius: 12px !important;
        color: #333;
        font-size: 13px;
        font-weight: 600;
        text-align: left;
        line-height: 1.2;
        text-decoration: none;
        background: #fafafa;
        transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    }
    nav#sidebar a.nav-item .icon-field{
        display: inline-flex;
        font-size: 18px;
        line-height: 1;
        flex: 0 0 auto;
    }
    nav#sidebar a.nav-item:hover{
        background: #f2f0ff !important;
        color: #3c21f7 !important;
        transform: translateX(2px);
        box-shadow: 0 4px 10px rgba(60,33,247,0.12);
    }
    nav#sidebar a.nav-item.active{
        background: #3c21f7 !important;
        color: #fff !important;
        box-shadow: 0 4px 10px rgba(60,33,247,0.2);
    }
    nav#sidebar a.nav-item.active .icon-field{
        color: #fff !important;
    }

    /* Since the sidebar is now fixed and full-height, push page content
       to the right to make room for it. */
    main#view-panel{
        margin-left: 240px !important;
    }
}

/* ==========================================================================
   Mobile navigation: fixed bottom tab bar instead of the horizontal-
   scrolling top strip. Icons only + tiny label, matches common mobile
   app patterns (and feels native inside the Capacitor Android app).
   Desktop/tablet (>900px) keeps the existing fixed left sidebar
   untouched - only the mobile breakpoint changes.
   ========================================================================== */
@media (max-width: 900px){
    nav#sidebar{
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: 62px !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
        z-index: 1050;
        overflow: hidden;
    }
    nav#sidebar .sidebar-list{
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden;
        height: 100%;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    nav#sidebar .sidebar-list::-webkit-scrollbar{ display: none; }
    nav#sidebar a.nav-item{
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        min-width: 72px;
        height: 100%;
        padding: 6px 10px !important;
        margin: 0 !important;
        background: transparent !important;
        font-size: 10px !important;
        line-height: 1.2;
        text-align: center;
        white-space: nowrap;
        border-radius: 0 !important;
        border: none !important;
    }
    nav#sidebar a.nav-item .icon-field{
        display: block;
        font-size: 18px;
        margin-bottom: 2px;
    }
    nav#sidebar a.nav-item:hover,
    nav#sidebar a.nav-item.active{
        background: transparent !important;
        border: none !important;
        color: #3c21f7 !important;
    }
    nav#sidebar a.nav-item.active .icon-field{
        color: #3c21f7 !important;
    }
    /* Notification badge needs repositioning to sit on the icon
       instead of inline after the "Notifications" text, since there's
       no room for it in a narrow bottom-tab item. */
    nav#sidebar #notif-badge{
        position: absolute;
        top: 2px;
        right: 14px;
        font-size: 9px;
        padding: 2px 5px;
    }
    nav#sidebar a.nav-item{ position: relative; }
    /* Push page content up so the bottom tab bar never covers the
       last row of a table or a form's submit button. */
    main#view-panel{
        margin-left: 0 !important;
        width: 100% !important;
        margin-top: 1em !important;
        padding: 0.5em !important;
        padding-bottom: 78px !important;
    }
    /* The floating member chat launcher (bottom-right) would overlap
       the new bottom tab bar - lift it just above the bar. */
    #chat-launcher{
        bottom: 74px !important;
    }
}