.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
    padding: 0;
}

.show-sidebar-btn {
    margin-right: 12px;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    transition: background 0.2s;
    font-size: 14px;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background-color: var(--hover-bg);
}

.history-item.active {
    background-color: #e8e8e8;
    font-weight: 500;
}

.delete-chat-btn {
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px;
}

.history-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    color: var(--primary-color);
}

/* 移动端调整 */
@media (max-width: 768px) {
    .sidebar {
        width: 260px; /* 移动端抽屉宽度固定 */
    }

    .sidebar-header {
        padding: 20px 16px; /* 移动端增加头部点击区域 */
    }

    .history-item {
        padding: 14px 12px; /* 移动端增加点击区域 */
        margin-bottom: 8px;
    }
    
    .delete-chat-btn {
        opacity: 1; /* 移动端直接显示删除按钮，因为没有 hover */
    }
}
