/* --- 2. GLOBAL LAYOUT & MAIN NAVIGATION (HOVER EXPAND EDITION) --- */
.app-container {
    display: flex; /* Back to flex to hold the sidebar space */
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* 1. THE MINI SIDEBAR */
.main-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(148, 163, 184, 0.1);
    width: 70px; /* Collapsed Width */
    height: 100vh;
    background: #050505;
    border-right: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    padding: 20px 12px; /* Less padding to fit icons */
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden; /* Hide text when collapsed */
    white-space: nowrap; /* Prevent text wrapping */
    position: relative;
    flex-shrink: 0;
}

/* EXPAND ON HOVER */
.main-sidebar:hover {
    width: 260px; /* Expanded Width */
    background: rgba(5, 8, 12, 0.98); /* Slight darken on expand */
    box-shadow: 10px 0 50px rgba(0,0,0,0.5);
    border-right: 1px solid var(--neon-cyan);
}

/* Brand Logo */
.sidebar-brand {
    height: 40px;
    display: flex; align-items: center; gap: 15px;
    font-size: 1.2rem; font-weight: 900; letter-spacing: 0.1em; color: white;
    margin-bottom: 40px; padding-left: 8px; /* Align with icons */
}
.sidebar-brand span { color: var(--neon-cyan); }

/* Navigation Links */
.nav-links { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.nav-btn {
    background: transparent; border: none; color: var(--text-secondary);
    height: 45px;
    width: 100%;
    display: flex; align-items: center;
    padding: 0 12px; /* Padding for icon centering */
    cursor: pointer; border-radius: 8px; transition: 0.2s;
    font-size: 0.9rem; font-weight: 600; letter-spacing: 0.05em;
    overflow: hidden;
}

/* Icons */
.nav-icon {
    min-width: 24px; /* Fixed width for icon */
    font-size: 1.2rem;
    text-align: center;
    margin-right: 20px; /* Space between icon and text */
    display: flex; justify-content: center;
}

.nav-text {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

/* Show text on hover */
.main-sidebar:hover .nav-text {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
}

.nav-btn:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-btn.active {
    background: rgba(0, 243, 255, 0.1);
    color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
}

/* User Section at bottom */
.user-section {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    opacity: 0.5;
    transition: 0.3s;
}
.main-sidebar:hover .user-section { opacity: 1; }
.user-tag { font-size: 0.75rem; margin-bottom: 10px; display: block; padding-left: 5px; }

.mobile-nav-toggle,
.mobile-nav-close,
.mobile-nav-backdrop {
    display: none;
}

/* 2. MAIN CONTENT AREA (Pushed by sidebar) */
.page-content {
    flex: 1;
    height: 100vh;
    min-width: 0;
    overflow-y: auto;
    /* Beautiful top-right light leak effect */
    background: 
        radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.15), transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(168, 85, 247, 0.05), transparent 50%);
    padding-top: 80px; 
}

@media (max-width: 900px) {
    .app-container {
        display: block;
        height: 100vh;
        overflow: hidden;
    }

    .mobile-nav-toggle {
        align-items: center;
        background: rgba(5, 8, 12, 0.94);
        border: 1px solid rgba(0, 243, 255, 0.28);
        border-radius: 10px;
        color: var(--neon-cyan);
        cursor: pointer;
        display: flex;
        font-size: 1.35rem;
        height: 48px;
        justify-content: center;
        left: 14px;
        position: fixed;
        top: 14px;
        width: 48px;
        z-index: 1300;
    }

    .mobile-nav-backdrop.open {
        background: rgba(0, 0, 0, 0.72);
        backdrop-filter: blur(8px);
        display: block;
        inset: 0;
        position: fixed;
        z-index: 1190;
    }

    .main-sidebar {
        background: rgba(5, 8, 12, 0.98);
        border-right: 1px solid var(--neon-cyan);
        box-shadow: 12px 0 50px rgba(0, 0, 0, 0.55);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        left: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 22px 16px max(16px, env(safe-area-inset-bottom));
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        width: 260px;
        z-index: 1200;
    }

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

    .main-sidebar:hover {
        width: 260px;
    }

    .main-sidebar .nav-text,
    .main-sidebar:hover .nav-text {
        opacity: 1;
        transform: none;
    }

    .main-sidebar .nav-links {
        min-height: 0;
    }

    .sidebar-brand {
        margin-bottom: 26px;
        padding-right: 42px;
    }

    .mobile-nav-close {
        align-items: center;
        background: rgba(255, 0, 85, 0.08);
        border: 1px solid rgba(255, 0, 85, 0.28);
        border-radius: 8px;
        color: var(--neon-pink);
        cursor: pointer;
        display: flex;
        height: 44px;
        justify-content: center;
        position: absolute;
        right: 16px;
        top: 22px;
        width: 44px;
    }

    .main-sidebar .user-section {
        background: rgba(5, 8, 12, 0.98);
        bottom: 0;
        box-shadow: 0 -14px 24px rgba(5, 8, 12, 0.96);
        flex-shrink: 0;
        margin-top: 16px;
        opacity: 1;
        padding: 14px 0 max(4px, env(safe-area-inset-bottom));
        position: sticky;
        z-index: 2;
    }

    .main-sidebar .logout-btn {
        background: rgba(255, 0, 60, 0.08);
        border: 1px solid rgba(255, 0, 60, 0.34);
        min-height: 48px;
    }

    .main-sidebar .logout-btn:hover,
    .main-sidebar .logout-btn:focus-visible {
        background: rgba(255, 0, 60, 0.16);
        border-color: var(--neon-pink);
        outline: none;
    }

    .page-content {
        height: 100vh;
        padding: 72px 0 0;
        width: 100vw;
    }
}
