/* ==========================================================================
   GLS Off-canvas Mobile Navigation
   Auto-hidden slide-in side menu, toggled by a hamburger button.
   Only takes effect at <=991px; desktop nav is completely untouched.
   ========================================================================== */

.gls-nav-toggle {
    display: none;
    position: relative;
    width: 42px;
    height: 38px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 2; /* must stay BELOW the panel/overlay (1198–1200) so the open
                   panel fully covers it instead of showing through on top */
    flex-shrink: 0;
}
.gls-nav-toggle span {
    display: block;
    position: absolute;
    left: 6px;
    right: 6px;
    height: 3px;
    border-radius: 3px;
    background: #f3e3c2;
    box-shadow: 0 1px 3px rgba(0,0,0,.4);
    transition: transform .25s ease, opacity .2s ease;
}
.gls-nav-toggle span:nth-child(1) { top: 9px; }
.gls-nav-toggle span:nth-child(2) { top: 18px; }
.gls-nav-toggle span:nth-child(3) { top: 27px; }
.gls-nav-toggle.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.gls-nav-toggle.active span:nth-child(2) { opacity: 0; }
.gls-nav-toggle.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.gls-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 3, 4, .72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1198;
    opacity: 0;
    transition: opacity .3s ease;
}
.gls-nav-overlay.active {
    display: block;
    opacity: 1;
}

.gls-nav-close {
    display: none;
}

/* The header logo is now permanently visible (fixed nav bar), so the
   decorative centered hero logo used to duplicate it is no longer needed
   on any page — removes the "two logos" side-by-side look. */
.mobile-logo-wrapper {
    display: none !important;
}

/* Safety net: the template's own legacy off-canvas menu system is disabled
   in js/main.js, but if a cached copy of the old main.js ever runs, these
   rules keep its duplicate hamburger + broken empty panel from showing. */
.js-ftco-nav-toggle,
#ftco-offcanvas {
    display: none !important;
}

/* Slimmer, more compact mobile nav bar (was oversized: ~135px tall) */
@media screen and (max-width: 992px) {
    .ftco-nav .top-menu {
        padding: 10px 0 !important;
    }
    .ftco-nav #ftco-logo a img {
        height: 52px !important;
    }
    .ftco-nav.gls-nav-scrolled #ftco-logo a img {
        height: 42px !important;
    }
}

@media screen and (max-width: 991px) {

    .gls-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* The nav list itself becomes the sliding side panel, hidden by default.
       Sized with top/bottom (not a fixed "height") so it always matches the
       REAL visible viewport, not the address-bar-inflated one — see the
       dvh note below. That's what was clipping the Portal Access button. */
    .menu-1 ul.gls-desktop-nav {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: auto !important;
        bottom: 0 !important;
        height: 100vh !important;   /* fallback for browsers with no dvh support */
        height: 100dvh !important;  /* real visible height, shrinks when the address bar is showing */
        width: 82% !important;
        max-width: 320px !important;
        margin: 0 !important;
        transform: translateX(100%) !important;
        transition: transform .22s cubic-bezier(.4, 0, .2, 1) !important;
        z-index: 1200 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-shadow: -12px 0 45px rgba(0, 0, 0, .35) !important;
        padding: 80px 25px calc(30px + env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 0 !important;
    }

    .menu-1 ul.gls-desktop-nav.active {
        transform: translateX(0) !important;
    }

    .gls-nav-close-item {
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .gls-nav-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 18px;
        right: 18px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, .25);
        background: rgba(255, 255, 255, .08);
        color: #ffffff;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }

    body.gls-nav-open {
        overflow: hidden;
    }

    /* Removes the ~300ms "is this a double-tap?" delay some mobile browsers
       add before honouring a tap, which is what can make the very last
       item in a list (Contact, right above the pinned Portal button) feel
       like it needs a second tap to register. */
    .menu-1 ul.gls-desktop-nav a,
    .gls-nav-toggle,
    .gls-nav-close {
        touch-action: manipulation;
    }
}

/* Admin dashboard sidebar gets the same auto-hide treatment on mobile.
   Breakpoint matches dashboard-style.css's phone rule (<=767px) exactly —
   768–991px (tablet) keeps the always-visible icon-only rail instead, so
   there's no dead zone where neither treatment applies. */
.gls-mobile-topbar {
    display: none;
}
@media screen and (max-width: 767px) {
    .gls-mobile-topbar {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 18px;
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
        background: #10141b;
        position: sticky;
        top: 0;
        z-index: 1150;
    }
    .gls-mobile-topbar .gls-nav-toggle span { background: #ffffff; }
    .gls-mobile-topbar-logo {
        height: 30px;
        width: auto;
    }

    /* Full, labelled slide-in panel — NOT the tablet's 80px icon rail — so
       every menu label, the operator name and the logout link are all
       readable and easy to tap on a phone. */
    .gls-app-wrapper .gls-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 82% !important;
        max-width: 300px !important;
        height: 100vh !important;   /* fallback for browsers with no dvh support */
        height: 100dvh !important;  /* matches the real visible viewport */
        transform: translateX(-100%) !important;
        transition: transform .3s cubic-bezier(.4, 0, .2, 1) !important;
        z-index: 1200 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-shadow: 12px 0 45px rgba(0, 0, 0, .35) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }
    .gls-app-wrapper .gls-sidebar.active {
        transform: translateX(0) !important;
    }
    .gls-app-wrapper .gls-sidebar .gls-nav-close {
        display: flex !important;
        position: absolute;
        top: 14px;
        right: 14px;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, .25);
        background: rgba(255, 255, 255, .08);
        color: #ffffff;
        font-size: 20px;
        cursor: pointer;
    }

    /* Sidebar labels/branding must stay visible here — the tablet rule
       that hides them (dashboard-style.css, 768–991px) doesn't reach this
       breakpoint, but state it explicitly so it can never regress. */
    .gls-app-wrapper .gls-sidebar-brand h3 { display: block !important; }
    .gls-app-wrapper .gls-sidebar-user { display: block !important; }
    .gls-app-wrapper .gls-sidebar-menu span { display: inline !important; }

    .gls-sidebar-menu a,
    .gls-mobile-topbar .gls-nav-toggle,
    .gls-app-wrapper .gls-sidebar .gls-nav-close {
        touch-action: manipulation;
    }

    body.gls-nav-open { overflow: hidden; }
}
