/* ============================================================
   EcoAnalyzer — Sidebar
   ============================================================ */

#sidebar {
    position: fixed;
    top: 0; right: -320px;
    width: 300px; height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    z-index: 1050;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sidebar.show { right: 0; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-heading);
    letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 32px; height: 32px;
    background: var(--gradient-brand);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.875rem;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-subtle);
    padding: 8px 12px 4px;
    margin-top: 8px;
}

#sidebar .nav-link {
    color: var(--text-body);
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex; align-items: center; gap: 12px;
    font-weight: 500; font-size: 0.9rem;
    text-decoration: none;
}

#sidebar .nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

#sidebar .nav-link:hover {
    background: var(--bg-alt);
    color: var(--primary);
    transform: translateX(3px);
    text-decoration: none;
}

#sidebar .nav-link.active {
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] #sidebar .nav-link.active {
    background: var(--primary-subtle);
    color: var(--primary-light);
}

#sidebar hr { border-color: var(--border); margin: 12px 0; }

.sidebar-user-section {
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.875rem; font-weight: 700; flex-shrink: 0;
}

.sidebar-user-name { font-weight: 600; font-size: 0.9rem; color: var(--text-heading); }
.sidebar-user-role { font-size: 0.75rem; color: var(--text-muted); }

#sidebarClose {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition-fast); font-size: 1rem;
}
#sidebarClose:hover { background: var(--danger-subtle); color: var(--danger); border-color: var(--danger); }

body.sidebar-open { overflow: hidden; }
