/* ============================================
   SIDEBAR — floating, vertically centered
   ============================================ */

.sidebar {
    position: fixed;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 240px;
    height: auto;
    max-height: calc(100vh - 3rem);
    background: #111111;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.875rem;
    z-index: 1000;
    overflow-y: auto;
    scrollbar-width: none;
    gap: 0;
}

.sidebar::-webkit-scrollbar { display: none; }

/* ---- Profile ---- */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0.25rem;
    margin-bottom: 0.875rem;
    flex-shrink: 0;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--card-bg);
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-profile-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.sidebar-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    font-family: 'Space Grotesk', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-handle {
    font-size: 0.67rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Social Icons ---- */
.sidebar-socials {
    display: flex;
    gap: 6px;
    padding: 0 0.25rem;
    margin-bottom: 0.875rem;
}

.sidebar-social {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.sidebar-social i {
    width: 14px;
    height: 14px;
}

.sidebar-social:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

/* ---- Divider ---- */
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0.25rem 0.625rem;
    flex-shrink: 0;
}

/* ---- Nav ---- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 0.5rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.855rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    width: 100%;
}

.sidebar-item i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-item.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.09);
}

/* ---- Theme Toggle ---- */
.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.855rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    width: 100%;
    text-align: left;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.sidebar-theme-toggle:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-theme-toggle i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Icon + label switching */
.icon-light,
.label-light { display: none; }

body.light-mode .icon-dark,
body.light-mode .label-dark { display: none; }

body.light-mode .icon-light,
body.light-mode .label-light { display: inline-flex; }

/* Hamburger — hidden on desktop */
.sidebar-hamburger { display: none; }

/* Mobile overlay — hidden on desktop */
.sidebar-mobile-overlay { display: none; }

/* ============================================
   MOBILE: sidebar → top bar
   ============================================ */
@media (max-width: 639px) {
    .sidebar {
        left: 0;
        top: 0;
        right: 0;
        width: 100%;
        height: var(--mobile-bar-h);
        transform: none;
        border-radius: 0;
        flex-direction: row;
        padding: 0 1rem;
        align-items: center;
        justify-content: space-between;
        border: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
        overflow: visible;
        gap: 0;
    }

    .sidebar-profile {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 0;
    }

    .sidebar-avatar { width: 28px; height: 28px; }
    .sidebar-handle { display: none; }
    .sidebar-socials { display: none; }
    .sidebar-nav { display: none; }
    .sidebar-divider { display: none; }
    .sidebar-theme-toggle { display: none; }

    .sidebar-hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        flex-shrink: 0;
    }

    .sidebar-hamburger span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--text-muted);
        border-radius: 2px;
        transition: transform 0.28s ease, opacity 0.28s ease;
    }

    .sidebar-hamburger:hover span { background: var(--text-main); }
    .sidebar-hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .sidebar-hamburger.active span:nth-child(2) { opacity: 0; }
    .sidebar-hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* Mobile overlay */
    .sidebar-mobile-overlay {
        display: block;
        position: fixed;
        top: var(--mobile-bar-h);
        left: 0;
        right: 0;
        z-index: 999;
        background: rgba(10, 10, 10, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        padding: 0.6rem 1rem 0.75rem;
        opacity: 0;
        transform: translateY(-6px);
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .sidebar-mobile-overlay.open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .sidebar-mobile-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .sidebar-mobile-link {
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.9rem;
        font-weight: 500;
        padding: 9px 12px;
        border-radius: 8px;
        transition: color 0.2s, background 0.2s;
    }

    .sidebar-mobile-link i {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .sidebar-mobile-link:hover {
        color: var(--text-main);
        background: rgba(255, 255, 255, 0.06);
    }
}
