.sidebar {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, #0d1019 100%);
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    border-right: 1px solid var(--glass-border);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.hidden {
    transform: translateX(-100%);
    pointer-events: none;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    position: relative;
}

.hamburger-btn { flex-shrink: 0; }
.logo { margin-right: auto; }

.sidebar-actions {
    display: flex;
    gap: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 30px;
    height: 30px;
    color: var(--accent);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(59,130,246,0.3);
}

.search-box {
    padding: 12px 16px;
    position: relative;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px 10px 38px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.15s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: rgba(59,130,246,0.3);
    background: var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    -webkit-overflow-scrolling: touch;
}

.chats-list::-webkit-scrollbar {
    width: 4px;
}

.chats-list::-webkit-scrollbar-track {
    background: transparent;
}

.chats-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.chat-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 6px 16px;
    flex-shrink: 0;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.12s ease;
    position: relative;
    margin-bottom: 1px;
}

.chat-item:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

.chat-item.active {
    background: linear-gradient(90deg, var(--bg-tertiary), transparent);
    box-shadow: 0 2px 8px rgba(59,130,246,0.1);
}

.chat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.chat-avatar {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar .avatar-initial {
    width: 48px;
    height: 48px;
    font-size: 16px;
    border-radius: 50%;
}

.status {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

.status.online { 
    background: var(--online);
    animation: pulse 2s infinite;
}

.status.offline { background: var(--offline); }

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% { 
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.chat-name {
    font-weight: 600;
    font-size: 14px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pin-icon {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 4px;
    color: var(--accent);
    opacity: 0.7;
    flex-shrink: 0;
}

.pin-icon svg {
    width: 12px;
    height: 12px;
    display: block;
}

.chat-item.muted .chat-preview::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: middle;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='15' y1='9' x2='21' y2='15'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='15' y1='9' x2='21' y2='15'/%3E%3C/svg%3E") no-repeat center;
    opacity: 0.5;
}

.preview-type-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 3px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.empty-chats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 60px 20px;
    text-align: center;
    opacity: 0.5;
    user-select: none;
}

.empty-chats-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.4;
}

.empty-chats-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-chats-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.unread-badge {
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    margin-left: 8px;
}

.chat-item.archived {
    opacity: 0.7;
}

.archive-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.archive-toggle-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.archive-toggle-btn svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 25;
    transition: background 0.15s;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
    background: var(--accent);
}

.sidebar.dragging {
    user-select: none;
    pointer-events: none;
}

.sidebar.dragging .sidebar-resize-handle {
    pointer-events: auto;
}

.hamburger-dropdown {
    display: none;
    position: absolute;
    top: auto;
    left: auto;
    z-index: 300;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 6px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--glass-border);
    flex-direction: column;
    animation: menuScaleIn 0.15s cubic-bezier(0.16,1,0.3,1);
    transform-origin: top left;
}

.hamburger-dropdown.show { display: flex; }

.hamburger-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.15s;
}

.hamburger-dropdown .dropdown-item:hover { background: var(--bg-hover); }
.hamburger-dropdown .dropdown-item svg { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }

.hamburger-close {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 1px;
    margin-top: 2px;
    border-radius: 8px;
    transition: all 0.15s;
}
.hamburger-close:hover { color: var(--text-primary); background: var(--bg-hover); }
