:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: hsla(222, 18%, 7%, 0.85);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: linear-gradient(90deg, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0.02) 100%);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.03);
    --brand-gradient: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    --sidebar-transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --sidebar-accent-glow: 0 0 20px rgba(168, 85, 247, 0.25);
    --glass-blur: blur(16px);
}

/* 0. Hide Legacy Elements on MOBILE ONLY */
@media (max-width: 1023px) {
    #navbar, .navbar, header.navbar, .top-nav, .logo, .nav-header {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        position: fixed !important;
        top: -100px !important;
    }
}

/* 0.1 Desktop Navbar Positioning */
@media (min-width: 1024px) {
    .navbar {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: none !important;
        z-index: 1000;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .navbar .logo { display: none !important; }

    .navbar.scrolled {
        background: hsla(222, 18%, 7%, 0.4) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        height: 60px;
        border-bottom: 1px solid var(--sidebar-border) !important;
    }
}

/* 1. Main Sidebar Layout */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 1000000;
    transition: var(--sidebar-transition);
    overflow: hidden;
    will-change: transform, width;
}

/* Mesh Gradient Subtle Overlay */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(168, 85, 247, 0.05) 0%, transparent 40%),
                radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.05) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    overflow: hidden !important;
}

.sidebar.collapsed .sidebar-scroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* 2. Header Section & BRANDING */
.sidebar-header {
    padding: 1.25rem 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    transition: var(--sidebar-transition);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.sidebar.collapsed .sidebar-header {
    padding: 1.25rem 0 0.75rem;
    align-items: center;
}

.sidebar.collapsed .sidebar-header-top {
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar.collapsed .sidebar-header-text,
.sidebar.collapsed .sidebar-brand-box span {
    display: none !important;
}

.sidebar-brand-box {
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.3s ease;
}

.sidebar-brand-box:hover {
    transform: scale(1.02);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    transition: var(--sidebar-transition);
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.3));
}

.sidebar.collapsed .sidebar-logo {
    width: 44px;
    height: 44px;
    margin: 0 auto;
}

.sidebar-header-text {
    font-weight: 800;
    font-size: 1.35rem;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    white-space: nowrap;
    text-transform: lowercase;
}

/* 3. Auth Buttons */
.sidebar-auth-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}.sidebar.collapsed .sidebar-auth-header {
    display: none !important;
}

.sidebar-auth-btn {
    display: block;
    width: 100%;
    padding: 9px 16px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-auth-btn.login {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-auth-btn.login:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-auth-btn.signup {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.sidebar-auth-btn.signup:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

/* 4. User Avatar */
.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--brand-gradient);
    color: white;
    font-weight: 800;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: var(--sidebar-transition);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.sidebar.collapsed .user-avatar {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
}.sidebar.collapsed .user-details {
    display: none !important;
}

/* 5. Sidebar Toggle Button */
.sidebar-toggle-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--sidebar-transition);
}

.sidebar-toggle-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(168, 85, 247, 0.4);
    transform: scale(1.05);
}

/* 6. Scroll Section */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.65rem;
    margin-right: 2px;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0);
    border-radius: 20px;
    transition: background 0.3s;
}
.sidebar-scroll:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.nav-section-label {
    padding: 0.9rem 0.5rem 0.3rem;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.3);
    transition: var(--sidebar-transition);
}

.sidebar.collapsed .nav-section-label {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.studio-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 7. Nav Items */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: 10px;
    transition: var(--sidebar-transition);
    margin-bottom: 1px;
    position: relative;
    overflow: hidden;
}

.sidebar-item i, .sidebar-item svg {
    width: 16px;
    font-size: 1rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.4s;
    flex-shrink: 0;
}

.sidebar-item:hover {
    background: var(--sidebar-hover-bg);
    color: white;
    transform: translateX(4px);
}

.sidebar-item:hover i, .sidebar-item:hover svg {
    color: #a855f7;
    filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.5));
}

.sidebar-item.active {
    background: var(--sidebar-active-bg);
    color: white;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: #a855f7;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
}

.sidebar-item.active i, .sidebar-item.active svg {
    color: #a855f7;
}.sidebar.collapsed .sidebar-label {
    display: none;
}

/* 8. Economy / Wallet */
.sidebar-economy {
    margin: 0.5rem 0.25rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--sidebar-border);
    border-radius: 14px;
    transition: var(--sidebar-transition);
    text-decoration: none;
    display: block;
}

.sidebar-economy:hover {
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.05);
    transform: translateY(-2px);
}

.sidebar.collapsed .sidebar-economy {
    padding: 0.85rem 0;
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .wallet-details {
    display: none;
}

.wallet-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(168, 85, 247, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a855f7;
    transition: transform 0.3s ease;
}

.sidebar-economy:hover .wallet-badge {
    transform: scale(1.1) rotate(5deg);
}

.wallet-balance {
    font-size: 1rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

/* 9. Mobile Sidebar */
@media (max-width: 1024px) {
    .sidebar {
        left: 0 !important;
        transform: translateX(-100%);
        width: 290px !important;
        background: hsla(222, 18%, 7%, 0.95);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar-header-text { display: none !important; }
    .sidebar-brand-box { width: 100%; justify-content: center; }
    .sidebar-header { padding: 1rem 1rem 0.65rem; }
    .sidebar-toggle-icon { position: absolute; right: 1.5rem; top: 1.25rem; }
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 14999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* 10. Mobile Sidebar Trigger */
.mobile-sidebar-trigger {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 15001;
    width: 48px;
    height: 48px;
    background: rgba(15, 17, 21, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.mobile-sidebar-trigger span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-sidebar-trigger:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
    transform: scale(1.05);
}

.mobile-sidebar-trigger:active {
    transform: scale(0.92);
}

.mobile-sidebar-trigger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); width: 24px; }
.mobile-sidebar-trigger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-sidebar-trigger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 24px; }

@media (max-width: 1024px) {
    .mobile-sidebar-trigger { display: flex; }
}

/* Global Tooltip Enhancement */
.sidebar-tooltip-global {
    position: fixed;
    z-index: 2000000;
    background: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(12px);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(-50%) translateX(-12px);
}

.sidebar-tooltip-global.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.sidebar-mode-switcher {
    display: flex;
    margin: 0 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}
.mode-pill {
    flex: 1;
    padding: 7px 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mode-pill.active {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}
.mode-pill:hover:not(.active) {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
}
.sidebar.collapsed .sidebar-mode-switcher {
    display: none;
}

.sidebar-trending {
    margin: 0 0 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.12);
    border-radius: 14px;
}
.trending-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #a855f7;
    margin-bottom: 0.6rem;
}
.trending-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.trending-item:hover { opacity: 0.8; transform: translateX(3px); }
.trending-thumb {
    width: 32px;
    height: 22px;
    border-radius: 5px;
    background: linear-gradient(135deg, #1e1b2e, #2d1f3d);
    flex-shrink: 0;
    object-fit: cover;
    display: block;
}
.trending-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.trending-name {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trending-price {
    font-size: 0.65rem;
    color: #a855f7;
    font-weight: 700;
}
.trending-arrow {
    font-size: 0.65rem;
    color: #22c55e;
    font-weight: 800;
    flex-shrink: 0;
}
.sidebar.collapsed .sidebar-trending,
.sidebar.collapsed .sidebar-trending + * { display: none; }

.wallet-tier-progress {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.wallet-tier-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}
.wallet-tier-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.wallet-tier-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}
.sidebar.collapsed .wallet-tier-progress {
    display: none;
}

.sidebar-upgrade-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 6px;
}
.sidebar-upgrade-pill:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(99, 102, 241, 0.14));
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}
.upgrade-pill-icon { font-size: 1rem; flex-shrink: 0; }
.upgrade-pill-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.upgrade-pill-title { font-size: 0.8rem; font-weight: 800; color: white; }
.upgrade-pill-sub {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upgrade-pill-arrow { font-size: 1.1rem; color: #a855f7; font-weight: 800; flex-shrink: 0; }
.sidebar.collapsed .sidebar-upgrade-pill { display: none; }

.sidebar-footer {
    padding: 0.65rem 0.75rem;
    gap: 0.35rem;
}
