/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Navigation - Hidden on mobile */
.sidebar-nav {
    display: none;
}

/* ========================================
   TABLET & DESKTOP STYLES
   ======================================== */
@media (min-width: 768px) {
    .sidebar-nav {
        display: block;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 3.078em;
        background: #1a1a1a;
        border-right: 1px solid #263440;
        z-index: 1000;
        transition: width 0.25s ease-in-out;
        font-size: 20px; /* Base font size for em scaling */
    }

    .sidebar-nav-container {
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 0.26em 0.35em 1rem;
        gap: 0.26em;
    }

    /* Logo at top */
    .sidebar-logo {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 0.52em;
        padding: 0.26em;
    }

    .sidebar-logo-text {
        font-size: 0.7em;
        font-weight: 700;
        color: #00FF90;
        letter-spacing: 0.05em;
        text-align: center;
    }

    /* Expand/Collapse Button */
    .sidebar-expand-btn {
        background: #263440;
        border: 1px solid #354959;
        border-radius: 0.26em;
        padding: 0.26em;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 0 0.13em rgba(0, 255, 144, 0.1);
        width: 100%;
        position: relative;
    }

    .sidebar-expand-btn:hover {
        background: #2a2a2a;
        border-color: #00FF90;
        box-shadow: 0 0 0.52em rgba(0, 255, 144, 0.3);
        transform: translateY(-0.07em);
    }

    .sidebar-expand-btn svg {
        color: #929AAA;
        transition: color 0.3s ease;
    }

    .sidebar-expand-btn:hover svg {
        color: #00FF90;
    }

    /* Icon switching */
    .hamburger-icon {
        opacity: 1;
        transform: rotate(0deg);
        transition: all 0.3s ease;
    }

    .close-icon {
        opacity: 0;
        transform: rotate(90deg);
        transition: all 0.3s ease;
        position: absolute;
    }

    .sidebar-nav.expanded .hamburger-icon {
        opacity: 0;
        transform: rotate(-90deg);
    }

    .sidebar-nav.expanded .close-icon {
        opacity: 1;
        transform: rotate(0deg);
    }

    /* Remove border and background when sidebar is expanded */
    .sidebar-nav.expanded .sidebar-expand-btn {
        background: transparent;
        border: none;
        box-shadow: none;
        justify-content: flex-end;
        padding-right: 0.52em;
    }

    .sidebar-nav.expanded .sidebar-expand-btn:hover {
        background: transparent;
        border: none;
        box-shadow: none;
        transform: none;
    }


    /* Navigation items */
    .sidebar-nav-items {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 0.26em;
    }

    .sidebar-nav-item {
        background: #263440;
        border: 1px solid #354959;
        border-radius: 0.2em;
        padding: 0.2em;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 0 0.1em rgba(0, 255, 144, 0.1);
        position: relative;
        overflow: visible;
        width: 100%;
        aspect-ratio: 1;
    }

    .sidebar-nav-item:hover {
        background: #2a2a2a;
        border-color: #00FF90;
        box-shadow: 0 0 0.52em rgba(0, 255, 144, 0.3);
        transform: translateY(-0.07em);
    }

    .sidebar-nav-icon {
        width: 1.2em;
        height: 1.2em;
        color: #929AAA;
        transition: color 0.3s ease;
    }

    .sidebar-nav-item:hover .sidebar-nav-icon {
        color: #00FF90;
    }

    /* Label slide-out effect */
    .sidebar-nav-label {
        position: absolute;
        left: 100%;
        margin-left: 0.52em;
        background: linear-gradient(135deg, #263440 0%, #1a1a1a 100%);
        color: #ffffff;
        padding: 0.52em 1.04em;
        border-radius: 0.26em;
        white-space: nowrap;
        font-size: 0.83em;
        font-weight: 600;
        opacity: 0;
        transform: translateX(-0.52em);
        transition: all 0.3s ease;
        pointer-events: none;
        border: 1px solid #354959;
        box-shadow: 0 0.26em 1.04em rgba(0, 0, 0, 0.3);
        z-index: 1000;
    }

    .sidebar-nav-label::before {
        content: '';
        position: absolute;
        left: -0.3em;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0.26em 0.3em 0.26em 0;
        border-color: transparent #263440 transparent transparent;
    }

    .sidebar-nav-item:hover .sidebar-nav-label {
        opacity: 1;
        transform: translateX(0);
        border-color: #00FF90;
        background: linear-gradient(135deg, #1a2a1a 0%, #0a150a 100%);
        box-shadow: 0 0.26em 1.04em rgba(0, 255, 144, 0.2);
    }

    .sidebar-nav-item:hover .sidebar-nav-label::before {
        border-color: transparent #00FF90 transparent transparent;
    }


    /* Bottom section */
    .sidebar-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.52em;
    }

    .sidebar-number {
        font-size: 0.83em;
        color: #929AAA;
        font-weight: bold;
    }

    .sidebar-notification {
        background: #263440;
        border: 1px solid #354959;
        border-radius: 0.52em;
        padding: 0.52em;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .sidebar-notification:hover {
        background: #2a2a2a;
        border-color: #00FF90;
        box-shadow: 0 0 0.26em rgba(0, 255, 144, 0.3);
    }

    .sidebar-bell-icon {
        font-size: 0.83em;
        color: #929AAA;
        transition: color 0.3s ease;
    }

    .sidebar-notification:hover .sidebar-bell-icon {
        color: #00FF90;
    }

    /* Extended Menu Styles */
    .sidebar-extended-menu {
        display: none;
        flex-direction: column;
        gap: 0.26em;
        opacity: 0;
        transform: translateX(-20px);
        transition: all 0.2s ease-in-out;
    }

    /* Tier Progress Card in Sidebar */
    .sidebar-extended-menu .tier-progress-card {
        margin-bottom: 0.52em;
        padding: 0.52em 0.78em;
    }

    .sidebar-extended-menu .tier-progress-card::after {
        display: none;
    }

    .sidebar-extended-menu .tier-icon img {
        width: 3em;
        height: auto;
    }

    .sidebar-extended-menu .tier-title {
        font-size: 0.65em;
        margin: 0 0 0.2em 0;
    }

    .sidebar-extended-menu .tier-action {
        font-size: 0.55em;
        margin: 0 0 0.3em 0;
    }

    .sidebar-extended-menu .progress-bar {
        height: 0.3em;
        margin: 0 0 0.3em auto;
        max-width: 65%;
    }

    .sidebar-extended-menu .progress-text {
        font-size: 0.5em;
    }

    .sidebar-extended-menu.active {
        display: flex;
        opacity: 1;
        transform: translateX(0);
    }

    .sidebar-menu-item {
        background: #263440;
        border: 1px solid #354959;
        border-radius: 0.26em;
        padding: 0.26em;
        display: flex;
        align-items: center;
        gap: 0.52em;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 0 0.13em rgba(0, 255, 144, 0.1);
        height: 2em;
        min-height: 2em;
    }

    .sidebar-menu-item:hover {
        background: #2a2a2a;
        border-color: #00FF90;
        box-shadow: 0 0 0.52em rgba(0, 255, 144, 0.3);
        transform: translateY(-0.07em);
    }

    /* Remove hover animation for menu headers with submenus */
    .sidebar-menu-item:has(+ .sidebar-submenu) {
        cursor: default;
    }

    .sidebar-menu-item:has(+ .sidebar-submenu):hover {
        background: #263440;
        border-color: #354959;
        box-shadow: 0 0 0.13em rgba(0, 255, 144, 0.1);
        transform: none;
    }

    .sidebar-menu-item:has(+ .sidebar-submenu):hover .sidebar-menu-text {
        color: #ffffff;
    }

    .sidebar-menu-item:has(+ .sidebar-submenu):hover .sidebar-menu-icon {
        color: #929AAA;
    }

    .sidebar-menu-icon {
        width: 1.04em;
        height: 1.04em;
        flex-shrink: 0;
    }

    .sidebar-menu-icon img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .sidebar-menu-text {
        color: #ffffff;
        font-size: 0.7em;
        font-weight: 500;
        flex: 1;
    }

    .sidebar-menu-item:hover .sidebar-menu-text {
        color: #00FF90;
    }

    /* Submenu Styles */
    .sidebar-submenu {
        display: flex;
        flex-direction: column;
        gap: 0.13em;
        margin-left: 0.52em;
        padding-left: 0.52em;
        position: relative;
    }


    .sidebar-submenu-item {
        background: #1a1a1a;
        border-radius: 0.13em;
        padding: 0.26em;
        display: flex;
        align-items: center;
        cursor: pointer;
        transition: all 0.3s ease;
        height: 1.8em;
        min-height: 1.8em;
    }

    .sidebar-submenu-item:hover {
        transform: translateY(-0.07em);
    }

    .sidebar-submenu-text {
        color: #FFFFFF;
        font-size: 0.65em;
        font-weight: 400;
        flex: 1;
        position: relative;
        padding-left: 1em;
    }

    .sidebar-submenu-text::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 0.4em solid #FFFFFF;
        border-top: 0.2em solid transparent;
        border-bottom: 0.2em solid transparent;
    }

    .sidebar-submenu-item:hover .sidebar-submenu-text {
        color: #00FF90;
    }

    .sidebar-submenu-item:hover .sidebar-submenu-text::before {
        border-left-color: #00FF90;
    }


    /* Expanded sidebar state */
    .sidebar-nav.expanded {
        width: 15.39em;
    }

    /* Prevent body scroll when sidebar is expanded */
    .sidebar-nav.expanded ~ * {
        overflow: hidden;
    }

    body.sidebar-expanded {
        overflow: hidden;
        height: 100vh;
    }

    .sidebar-nav.expanded .sidebar-extended-menu {
        display: flex;
    }

    /* Add scrollable overflow when sidebar is expanded */
    .sidebar-nav.expanded .sidebar-nav-container {
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Scrollbar styling for expanded sidebar */
    .sidebar-nav.expanded .sidebar-nav-container::-webkit-scrollbar {
        width: 0.3em;
    }

    .sidebar-nav.expanded .sidebar-nav-container::-webkit-scrollbar-track {
        background: #1a1a1a;
    }

    .sidebar-nav.expanded .sidebar-nav-container::-webkit-scrollbar-thumb {
        background: #354959;
        border-radius: 0.15em;
    }

    .sidebar-nav.expanded .sidebar-nav-container::-webkit-scrollbar-thumb:hover {
        background: #00FF90;
    }
}

/* ========================================
   LARGE DESKTOP STYLES (1920px+)
   ======================================== */
@media (min-width: 1920px) {
    .sidebar-nav {
        width: 3.078vw;
        font-size: 1vw; /* Override em base to use vw instead */
    }

    .sidebar-nav.expanded {
        width: 15.39vw;
    }

    .sidebar-nav-container {
        padding: 0.26vw;
        gap: 0.26vw;
    }

    .sidebar-logo {
        margin-bottom: 0.52vw;
        padding: 0.26vw;
    }

    .sidebar-logo-text {
        font-size: 0.7vw;
        letter-spacing: 0.05vw;
    }

    .sidebar-expand-btn {
        border-radius: 0.26vw;
        padding: 0.26vw;
        box-shadow: 0 0 0.13vw rgba(0, 255, 144, 0.1);
    }

    .sidebar-expand-btn:hover {
        box-shadow: 0 0 0.52vw rgba(0, 255, 144, 0.3);
        transform: translateY(-0.07vw);
    }

    .sidebar-nav-items {
        gap: 0.26vw;
    }

    .sidebar-nav-item {
        border-radius: 0.2vw;
        padding: 0.2vw;
        width: 100%;
        aspect-ratio: 1;
        gap: 0.4vw;
    }

    .sidebar-nav-item:hover {
        box-shadow: 0 0 0.52vw rgba(0, 255, 144, 0.3);
        transform: translateY(-0.07vw);
    }

    .sidebar-nav-icon {
        width: 1.04vw;
        height: 1.04vw;
    }

    .sidebar-nav-label {
        font-size: 0.7vw;
    }

    .sidebar-extended-menu {
        gap: 0.26vw;
    }

    .sidebar-menu-item {
        border-radius: 0.26vw;
        padding: 0.52vw 0.78vw;
        gap: 0.52vw;
        height: 2vw;
        min-height: 2vw;
        box-shadow: 0 0 0.13vw rgba(0, 255, 144, 0.1);
    }

    .sidebar-menu-item:hover {
        background: #2a2a2a;
        border-color: #00FF90;
        box-shadow: 0 0 0.52vw rgba(0, 255, 144, 0.3);
        transform: translateY(-0.07vw);
    }

    .sidebar-menu-item:has(+ .sidebar-submenu) {
        cursor: default;
    }

    .sidebar-menu-item:has(+ .sidebar-submenu):hover {
        background: #263440;
        border-color: #354959;
        box-shadow: 0 0 0.13vw rgba(0, 255, 144, 0.1);
        transform: none;
    }

    .sidebar-menu-item:has(+ .sidebar-submenu):hover .sidebar-menu-text {
        color: #ffffff;
    }

    .sidebar-menu-item:has(+ .sidebar-submenu):hover .sidebar-menu-icon {
        color: #929AAA;
    }

    .sidebar-menu-icon {
        width: 1.04vw;
        height: 1.04vw;
    }

    .sidebar-menu-text {
        font-size: 0.65vw;
    }

    .sidebar-submenu {
        gap: 0.26vw;
    }

    .sidebar-submenu-item {
        background: #1a1a1a;
        border-radius: 0.13vw;
        padding: 0.26vw;
        display: flex;
        align-items: center;
        cursor: pointer;
        transition: all 0.3s ease;
        height: 1.8vw;
        min-height: 1.8vw;
    }

    .sidebar-submenu-item:hover {
        transform: translateY(-0.07vw);
    }

    .sidebar-submenu-text {
        color: #FFFFFF;
        font-size: 0.65vw;
        font-weight: 400;
        flex: 1;
        position: relative;
        padding-left: 1vw;
    }

    .sidebar-submenu-text::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 0.4vw solid #FFFFFF;
        border-top: 0.2vw solid transparent;
        border-bottom: 0.2vw solid transparent;
    }

    .sidebar-submenu-item:hover .sidebar-submenu-text {
        color: #00FF90;
    }

    .sidebar-submenu-item:hover .sidebar-submenu-text::before {
        border-left-color: #00FF90;
    }

    .sidebar-nav.expanded .sidebar-expand-btn {
        padding-right: 0.52vw;
    }

    .sidebar-nav.expanded .sidebar-nav-container::-webkit-scrollbar {
        width: 0.3vw;
    }

    .sidebar-nav.expanded .sidebar-nav-container::-webkit-scrollbar-thumb {
        border-radius: 0.15vw;
    }

    /* Tier Progress Card in Sidebar - Large Screens */
    .sidebar-extended-menu .tier-progress-card {
        margin-bottom: 0.52vw;
        padding: 0.52vw 0.78vw;
    }

    .sidebar-extended-menu .tier-icon img {
        width: 3vw;
    }

    .sidebar-extended-menu .tier-title {
        font-size: 0.65vw;
        margin: 0 0 0.2vw 0;
    }

    .sidebar-extended-menu .tier-action {
        font-size: 0.55vw;
        margin: 0 0 0.3vw 0;
    }

    .sidebar-extended-menu .progress-bar {
        height: 0.3vw;
        margin: 0 0 0.3vw auto;
    }

    .sidebar-extended-menu .progress-text {
        font-size: 0.5vw;
    }
}
