/* ========================================
   VerticalNavMenu — experimental opt-in sidebar variant
   ----------------------------------------
   Class prefix: .vnav-*  (kept isolated from navbar.css so the horizontal
   variant stays untouched and both can coexist during testing).
   ======================================== */

/* --- Body-level shift so main content clears the fixed sidebar --------- */
/* Set by wwwroot/js/vertical-navmenu.js on mount; removed on dispose. */
body.vnav-active {
    padding-left: 260px;
    transition: padding-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.vnav-active.vnav-active-collapsed {
    padding-left: 72px;
}

@media (max-width: 767.98px) {
    body.vnav-active,
    body.vnav-active.vnav-active-collapsed {
        padding-left: 0;
        padding-top: 64px; /* room for the mobile top-bar */
    }
}

/* --- Root wrapper (holds sidebar + mobile bits) ------------------------ */
.vnav-root {
    position: relative;
}

/* --- Sidebar surface --------------------------------------------------- */
.vnav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    background: rgba(15, 22, 33, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    /* overflow: visible so footer popovers (notifications, sponsor progress) can
       render past the sidebar's right edge. backdrop-filter above makes this
       element the containing block for their `position: fixed`, so `overflow`
       here also controls their clipping. Inner scrolling stays scoped to
       `.vnav-nav` which owns its own overflow-y/-x below. */
    overflow: visible;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vnav-collapsed .vnav-sidebar {
    width: 72px;
}

/* --- Header (logo + toggle) ------------------------------------------- */
.vnav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.vnav-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    overflow: hidden;
}

.vnav-brand img {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed: stack logo above the toggle so both stay visible in the 72px column. */
.vnav-collapsed .vnav-header {
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem 0.25rem 0.4rem;
    justify-content: center;
}

.vnav-collapsed .vnav-brand img {
    width: 40px;
    height: 30px;
}

.vnav-toggle,
.vnav-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.vnav-toggle:hover,
.vnav-mobile-close:hover {
    background: rgba(13, 202, 240, 0.15);
    border-color: rgba(13, 202, 240, 0.5);
    color: #fff;
}

/* --- Nav list scrollable region --------------------------------------- */
.vnav-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.vnav-nav::-webkit-scrollbar {
    width: 6px;
}

.vnav-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.vnav-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 202, 240, 0.4);
}

/* --- Top-level nav items (direct link + section toggle) --------------- */
.vnav-link,
.vnav-section-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.6rem;
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    text-align: left;
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease, color 0.2s ease, padding 0.2s ease;
}

.vnav-link:hover,
.vnav-section-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.vnav-link.active {
    color: #0dcaf0;
    background: rgba(13, 202, 240, 0.1);
}

.vnav-link.active::before,
.vnav-section-toggle[aria-expanded="true"]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: #0dcaf0;
    border-radius: 0 2px 2px 0;
}

/* --- Sub-nav (expandable section body) -------------------------------- */
.vnav-subnav {
    padding: 0.2rem 0 0.3rem 0.4rem;
    margin-left: 0.6rem;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.vnav-sublink {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 0.4rem;
    transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.vnav-sublink:hover {
    background: rgba(13, 202, 240, 0.1);
    color: #fff;
    padding-left: 0.85rem;
}

.vnav-sublink.active {
    color: #0dcaf0;
    background: rgba(13, 202, 240, 0.12);
}

.vnav-subnav-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.6rem 0.15rem;
    margin-top: 0.15rem;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- Icons + labels (fixed icon column so labels align) --------------- */
.vnav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
    opacity: 0.85;
}

.vnav-link:hover .vnav-icon,
.vnav-section-toggle:hover .vnav-icon,
.vnav-sublink:hover .vnav-icon {
    opacity: 1;
}

.vnav-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity 0.15s ease;
}

/* --- SVG icons (weapons / knives / gloves / agents) -------------------- */
.vnav-svg-icon .skins-menu-item {
    height: 16px;
    max-width: 22px;
    width: auto;
}

/* --- Section caret ---------------------------------------------------- */
.vnav-section-caret {
    margin-left: auto;
    opacity: 0.6;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.vnav-section-toggle[aria-expanded="true"] .vnav-section-caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* --- NAUJAS badge slot inside a sublink ------------------------------- */
.vnav-badge {
    margin-left: auto;
    flex-shrink: 0;
}

/* --- Footer (profile / login) ----------------------------------------- */
.vnav-footer {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.vnav-footer-user {
    justify-content: space-between;
}

.vnav-footer-profile .nav-profile-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vnav-login-btn .vnav-label {
    white-space: nowrap;
}

/* --- Collapsed-mode adjustments --------------------------------------- */
.vnav-collapsed .vnav-label,
.vnav-collapsed .vnav-section-caret,
.vnav-collapsed .vnav-badge,
.vnav-collapsed .vnav-subnav,
.vnav-collapsed .vnav-subnav-header,
.vnav-collapsed .vnav-footer-actions {
    /* Bootstrap's collapse.show still applies to vnav-subnav; !important keeps it hidden here. */
    display: none !important;
}

.vnav-collapsed .vnav-link,
.vnav-collapsed .vnav-section-toggle,
.vnav-collapsed .vnav-sublink {
    justify-content: center;
    padding: 0.6rem 0.4rem;
}

.vnav-collapsed .vnav-icon {
    margin: 0;
}

.vnav-collapsed .vnav-footer {
    padding: 0.5rem;
}

.vnav-collapsed .vnav-footer-user {
    justify-content: center;
}

/* --- Mobile top-bar --------------------------------------------------- */
.vnav-mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1025;
    background: rgba(15, 22, 33, 0.9);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 64px;
}

.vnav-mobile-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.vnav-mobile-hamburger:hover,
.vnav-mobile-hamburger:focus {
    background: rgba(13, 202, 240, 0.15);
    border-color: rgba(13, 202, 240, 0.5);
    color: #fff;
    outline: none;
}

.vnav-brand-mobile img {
    max-height: 44px;
    width: auto;
}

/* --- Mobile off-canvas behavior --------------------------------------- */
@media (max-width: 767.98px) {
    .vnav-sidebar {
        width: 280px;
        transform: translateX(-100%);
    }

    .vnav-open .vnav-sidebar {
        transform: translateX(0);
    }

    /* Ignore desktop-collapsed state on mobile (drawer is full-width regardless) */
    .vnav-collapsed .vnav-sidebar {
        width: 280px;
    }

    .vnav-collapsed .vnav-label,
    .vnav-collapsed .vnav-section-caret,
    .vnav-collapsed .vnav-badge,
    .vnav-collapsed .vnav-subnav,
    .vnav-collapsed .vnav-subnav-header,
    .vnav-collapsed .vnav-footer-actions {
        display: initial !important;
    }

    .vnav-collapsed .vnav-link,
    .vnav-collapsed .vnav-section-toggle,
    .vnav-collapsed .vnav-sublink {
        justify-content: flex-start;
        padding: 0.55rem 0.6rem;
    }
}

.vnav-mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1029;
    animation: vnav-backdrop-fade 0.2s ease-out;
}

@keyframes vnav-backdrop-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Reposition floating panels from the sidebar footer ----------------
   NotificationsBell (.notif-panel-wrap) and the sponsor progress popover
   (.sponsor-badge-popover) default to `position: absolute; right: 0;
   top: 100%` — anchored to the button, opening down-and-right-aligned.
   That fits the horizontal top navbar but not the vertical sidebar
   footer, where (a) the button sits at the bottom-left of the viewport
   so the panel opens below the visible area, and (b) `.vnav-sidebar`
   has `overflow: hidden`, which clips the absolutely-positioned panel.
   Portal them out to the viewport with `position: fixed`, anchored to
   the bottom of the viewport and offset to the right of the sidebar.
   Desktop-only — on mobile the panels use their own inset:0 full-screen
   modal path and the bell/badge don't live in `.vnav-footer` anyway.
   Keep the `260px` / `72px` offsets in sync with the widths declared on
   `.vnav-sidebar` and `.vnav-collapsed .vnav-sidebar` above. */
@media (min-width: 768px) {
    .vnav-footer .notif-panel-wrap,
    .vnav-footer .sponsor-badge-popover {
        position: fixed;
        top: auto;
        right: auto;
        bottom: 1rem;
        left: calc(260px + 0.5rem);
    }

    .vnav-collapsed .vnav-footer .notif-panel-wrap,
    .vnav-collapsed .vnav-footer .sponsor-badge-popover {
        left: calc(72px + 0.5rem);
    }
}
