
.mainPortalNav{
    height: 0px;
    width: 350px;
    margin-top: -38px;
    z-index: 6;
    display: flex;
    position: fixed; top: 88px; left: 0;
    transform: translateX(25px);
    background: linear-gradient(to bottom, #103667, #174c92e4, #1954a19d);
    border-radius: 0px 0px 10px 10px;
    transition: height 0.3s ease, width 0.25s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.25s ease;
    animation: expandOnLoad 0.3s ease 0.5s forwards;
}

.mainPortalNav.expanded{
    height: calc(100vh - 123px);
    transition: height 0.2s ease; /* Smooth transition for resize */
}

@keyframes expandOnLoad {
    from {
        height: 0px;
    }
    to {
        height: calc(100vh - 123px);
    }
}

#linerV{
    width: 1px;
    height: calc(100% - 25px);
    background-color: white;
    margin-top: 15px;
}


.tabBar{
    width: 60px;
    height: 100%;
    color: white;
    padding-left: 10px;
    padding-right: 0px;
    padding-top: 10px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.activeTabNav{
    background-color: #050832;
    /* add filter to any image in the div to make it reddish */
    filter: hue-rotate(330deg);
    box-shadow: 0 0 10px #050832;
    filter: blur(0.5px);
    border-radius: 5px;

}

.tabItem{
    width: 25px;
    max-width: 25px;
    min-width: 25px;
    height: 25px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    cursor: pointer;
    margin-bottom: 20px;
    overflow-x: hidden;
    justify-content: center;
}

.responseTabs{
    flex-grow: 1;
    height: 100%;
    color: #ffffff;
    padding: 7px 0;
    overflow-y: auto;
    padding-left: 15px;
    transition: opacity 0.2s ease;
    /* Hide scrollbar entirely (Firefox) — matches macOS/GTK overlay behavior */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Hide scrollbar entirely (Chromium/WebKit) so it doesn't reserve layout width.
   Content still scrolls via wheel/trackpad/touch. */
.responseTabs::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* Ensure the Unicode-glyph tabItems (download ⇓, report ☷, gear) pick the same
   font in every browser, so they don't fall back to a striped legacy font in
   Chromium that looks like a mini scrollbar. */
.tabItem {
    font-family: "Segoe UI Symbol", "Apple Symbols", "DejaVu Sans",
                 "Noto Sans Symbols", "Noto Sans Symbols 2", system-ui, sans-serif;
    overflow: hidden;
}

/* collapse toggle button — sits at bottom of mainPortalNav */
.navCollapseBtn {
    position: absolute;
    bottom: 12px;
    left: 10px;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 20px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.navCollapseBtn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* collapsed state */
.mainPortalNav.collapsed {
    width: 45px;
    transform: translateX(0);
    border-radius: 0 0 10px 0;
}

.mainPortalNav.collapsed #linerV,
.mainPortalNav.collapsed .responseTabs {
    display: none;
}

.removeLayerBtn {
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    margin-left: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.removeLayerBtn:hover {
    color: #ff6b6b;
}

/* ===== Mobile responsive (<= 768px): layers panel becomes a left drawer ===== */
@media (max-width: 768px) {
    .mainPortalNav {
        width: 86vw !important;
        max-width: 340px;
        top: 91px !important;         /* 3px gap below top nav */
        left: 0 !important;            /* flush to left edge */
        bottom: 63px !important;       /* 3px gap above footer */
        height: auto !important;
        margin-top: 0 !important;
        transform: scale(1);
        transform-origin: 32px 35px;   /* near the handle button center */
        opacity: 1;
        border-radius: 0 5px 5px 0 !important;
        animation: none !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
        z-index: 3000;
        flex-direction: column;
    }

    /* Opaque fade around the bottom-right corner (kills map bleed-through) */
    .mainPortalNav::after {
        content: '';
        position: absolute;
        right: 0;
        bottom: 0;
        width: 280px;
        height: 220px;
        background: radial-gradient(ellipse at 100% 100%, #1954a1 0%, #1954a1 35%, rgba(25, 84, 161, 0) 75%);
        border-bottom-right-radius: 5px;
        pointer-events: none;
        z-index: -1;
    }

    /* Collapsed: shrink into the handle button (no slide) */
    .mainPortalNav.collapsed {
        width: 86vw !important;
        max-width: 340px;
        transform: scale(0);
        opacity: 0;
        pointer-events: none;
        border-radius: 0 !important;
    }
    .mainPortalNav.collapsed #linerV,
    .mainPortalNav.collapsed .responseTabs { display: none; }

    /* expanded override (JS already sets height via animation on desktop) */
    .mainPortalNav.expanded { height: auto !important; }

    /* horizontal tab bar at top of drawer */
    .tabBar {
        flex-direction: row;
        width: 100%;
        height: 56px;
        padding: 10px 14px;
        gap: 14px;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tabBar::-webkit-scrollbar { display: none; }
    .tabBar hr { display: none !important; }
    .tabItem {
        margin-bottom: 0;
        width: 28px;
        height: 28px;
        min-width: 28px;
        flex-shrink: 0;
    }

    #linerV { display: none; }

    .responseTabs {
        flex: 1;
        min-height: 0;
        padding: 12px 16px 16px;
        overflow-y: auto;
    }

    /* repurpose existing collapse button as a close-X at top-right */
    .navCollapseBtn {
        top: 8px;
        right: 10px;
        bottom: auto;
        left: auto;
        font-size: 0;
        line-height: 1;
        width: 32px;
        height: 32px;
    }
    .navCollapseBtn::before {
        content: '\00D7';
        font-size: 24px;
        line-height: 1;
    }

    /* floating handle on the map's left edge — visible when drawer is collapsed */
    .mobileLayersHandle {
        display: flex !important;
        position: fixed;
        top: 104px;
        left: 10px;
        z-index: 2999;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.95);
        color: #174c92;
        border-radius: 50%;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
        font-size: 22px;
        cursor: pointer;
        user-select: none;
        opacity: 1;
        pointer-events: auto;
        /* default (drawer collapsed): fade in after drawer finishes shrinking */
        transition: opacity 0.2s ease 0.2s;
    }
    .mobileLayersHandle:active { transform: scale(0.94); }

    /* Hide handle while drawer is open; fade out quickly before drawer grows */
    .mainPortalNav:not(.collapsed) ~ .mobileLayersHandle,
    body:has(.mainPortalNav:not(.collapsed)) .mobileLayersHandle {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.12s ease 0s;
    }
}

/* Handle is desktop-hidden by default; mobile block flips it on */
.mobileLayersHandle { display: none; }

/* Dark theme tweaks for mobile drawer */
@media (max-width: 768px) {
    .darkTheme .mobileLayersHandle {
        background: rgba(22, 33, 62, 0.95);
        color: #a0c4ff;
    }
    .darkTheme .mainPortalNav::after {
        background: radial-gradient(ellipse at 100% 100%, #12294a 0%, #12294a 35%, rgba(18, 41, 74, 0) 75%);
    }
}
