/*
 * Mobile navigation — top-dropdown redesign.
 * Overrides on top of app.css. Loaded after app.css.
 */

/* ── Header bell — visible on all viewports ──────────────────────────── */
.headerBell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    color: #475569;
    font-size: 17px;
    flex-shrink: 0;
    transition: background-color .15s ease, color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.headerBell:hover {
    background: rgba(15, 23, 42, 0.05);
    color: #0f172a;
}

.headerBellBadge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #0295b9;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 999px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}


@media (max-width: 991.98px) {

    /* Eliminate the 300 ms tap delay on the hamburger and all nav links */
    .mobileNavBtn,
    nav.opened > ul > li > a,
    nav.opened > ul > li > span,
    nav.opened > ul > li.hasSubmenu {
        touch-action: manipulation;
    }

    /* ── 2-bar icon ──────────────────────────────────────────────────── */
    .mobileNavBtn .hamburgerIcon {
        width: 22px;
        height: 13px; /* top bar at 0, bottom bar at 11px (2px height each) */
    }

    /* Third bar gone */
    .mobileNavBtn .hamburgerIcon > span:nth-child(3) {
        display: none;
    }

    .mobileNavBtn .hamburgerIcon > span:nth-child(1) { top: 0; }
    .mobileNavBtn .hamburgerIcon > span:nth-child(2) { top: 11px; }

    /* Opened state: bars stay as-is; button gets a soft teal tint instead
       of morphing into an X — reinforces the "toggle" affordance. */
    .mobileNavBtn.opened {
        opacity: 1;
        pointer-events: auto;
        background-color: rgba(2, 149, 185, 0.09);
    }

    .mobileNavBtn.opened .hamburgerIcon > span:nth-child(1) {
        top: 0;
        transform: none;
    }
    .mobileNavBtn.opened .hamburgerIcon > span:nth-child(2) {
        top: 11px;
        opacity: 1;
        transform: none;
    }


    /* ── Dropdown panel ──────────────────────────────────────────────── */
    /* Replaces the side-panel slide-in from app.css.
       Top offset is set dynamically by nav-mobile.js; the CSS value here
       is a safe fallback in case JS hasn't run yet. */
    nav.opened {
        left: 8px !important;
        right: 8px !important;
        top: 72px;
        width: auto !important;
        height: auto !important;
        max-height: calc(100dvh - 90px - 16px);
        min-width: 0;
        padding: 0 !important;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14),
                    0 2px 8px  rgba(15, 23, 42, 0.05);
        overflow-y: auto;
        overflow-x: hidden;
        animation: navDropOpen .22s cubic-bezier(.4, 0, .2, 1) !important;
    }

    @keyframes navDropOpen {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }


    /* ── Items list ──────────────────────────────────────────────────── */
    nav.opened > ul {
        padding: 6px 0 8px;
    }

    nav.opened > ul > li {
        border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    }
    nav.opened > ul > li:last-child {
        border-bottom: 0;
    }

    nav.opened > ul > li > a,
    nav.opened > ul > li > span {
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 500;
        color: #0f172a;
        letter-spacing: -0.01em;
    }

    nav.opened > ul > li > a:active,
    nav.opened > ul > li > span:active {
        background: rgba(2, 149, 185, 0.06);
        color: #0295b9;
    }

    /* Account CTA: reset to match regular nav links on mobile */
    nav.opened > ul > li > a.button.animatedBtn {
        margin: 0;
        padding: 14px 20px;
        background: transparent;
        color: #0f172a;
        border-radius: 0;
        text-align: left;
        justify-content: flex-start;
        font-weight: 500;
        font-size: 15px;
        box-shadow: none;
    }

    nav.opened > ul > li > a.button.animatedBtn:active {
        background: rgba(2, 149, 185, 0.06);
        color: #0295b9;
    }

    nav.opened > ul > li.hasSubmenu.opened > a.button.animatedBtn {
        background: transparent;
        color: #0f172a;
    }

    nav.opened > ul > li:has(> a.button.animatedBtn) {
        border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    }


    /* ── Chevron indicator ───────────────────────────────────────────── */
    nav.opened > ul > li.hasSubmenu::after {
        width: 9px;
        height: 9px;
        right: 20px;
        top: 21px;
        border-right-width: 2px;
        border-bottom-width: 2px;
        border-color: #0295b9;
        opacity: 0.7;
        transition: transform .22s cubic-bezier(.4,0,.2,1),
                    border-color .15s ease,
                    top .22s ease,
                    opacity .15s ease;
    }

    nav.opened > ul > li.hasSubmenu.opened::after {
        border-color: #0295b9;
        opacity: 1;
        top: 25px;
    }

    nav.opened > ul > li.hasSubmenu:has(> a.button.animatedBtn) {
        position: relative;
    }

    nav.opened > ul > li.hasSubmenu.opened:not(:has(> a.button.animatedBtn)) {
        background: rgba(2, 149, 185, 0.04);
    }

    nav.opened > ul > li.hasSubmenu.opened > ul.opened {
        border-top: 1px solid rgba(2, 149, 185, 0.12);
        margin-top: 2px;
    }

    /* Submenu items */
    nav.opened > ul > li.hasSubmenu > ul > li > a {
        padding: 12px 20px 12px 40px;
        font-size: 13.5px;
        font-weight: 400;
        color: #475569;
    }


    /* ── Dim backdrop (injected by nav-mobile.js) ────────────────────── */
    /* header has backdrop-filter which traps nav.opened inside its stacking
       context (effective root z-index:3). Backdrop must be below that (2)
       so nav items are not covered and remain clickable. */
    .navDropBackdrop {
        position: fixed;
        inset: 0;
        z-index: 2;
        background: rgba(15, 23, 42, 0.3);
        animation: backdropIn .2s ease;
    }

    @keyframes backdropIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}
