.sidebar {
    position: fixed;
    left: 0;
    top: 70px; /* 低于顶部导航栏 */
    bottom: 0;
    width: 250px;
    background-color: whitesmoke; /* 背景色  f8f9fa*/
    border-right: 1px solid #dee2e6;
    z-index: 1000;
    transition: all 0.3s ease;
    border-radius: 0 12px 12px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-fixed {
    padding: 1px;
    /* 固定高度，可根据实际情况调整 */
    height: auto;
    z-index: 1;
}

/* 滚动条区域重点优化 */
.sidebar-scrollable {
    max-height: calc(100vh - 180px); /* 调整高度避免覆盖底部 */
    overflow-y: auto;
    overflow-x: hidden;
    /*padding: 1rem;*/
    padding: 0px;
}

/* 优化后的滚动条样式 */
.sidebar-scrollable::-webkit-scrollbar {
    width: 8px; /* 加粗滚动条 */
}

.sidebar-scrollable::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: #b3b3b3;
}

.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 1 !important; /* 确保内容不透明 */
    display: block !important;
}

.toggle-sidebar {
    left: 10px;
    width: 90%;
    margin: 0 auto 10px; /* 上下边距保持不变，左右边距自动分配实现居中 */
    border-radius: 8px;
}

.new-chat-button {
    left: 10px;
    width: 90%;
    margin: 0 auto 10px; /* 上下边距保持不变，左右边距自动分配实现居中 */
    border-radius: 8px;
}

.sidebar.collapsed {
    width: 60px; /* 收起时的宽度 */
}

.sidebar.collapsed .sidebar-text {
    display: none; /* 收起时隐藏文字 */
}

.sidebar.collapsed .nav-link {
    text-align: center; /* 收起时图标居中 */
}

.sidebar.collapsed .nav-link i {
    margin-right: 0; /* 收起时移除图标右边距 */
}


.nav-link {
    border-radius: 8px; /* 圆角 */
    margin-bottom: 1px; /* 底部间距 */
    display: flex; /* 新增，使图标和文字水平排列 */
    align-items: center; /* 新增，使图标和文字垂直居中 */
    justify-content: left; /* 新增，使图标和文字水平居中 */
}
.nav-link:hover {
    background-color: #e9ecef;
}
.nav-link-left {
    border-radius: 8px; /* 圆角 */
    margin-bottom: 1px; /* 底部间距 */
    display: flex; /* 新增，使图标和文字水平排列 */
    align-items: center; /* 新增，使图标和文字垂直居中 */
    justify-content: left; /* 新增，使图标和文字水平居中 */
}

.nav-link-left:hover {
    background-color: #e9ecef;
}

.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.sidebar-inner {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0px;
    /* 显示滚动条 */
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;

    transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-inner {
    opacity: 0;
}

.sidebar-inner.toggle-sidebar {
    text-align: center;
}

.nav-item {
    /* 在这里添加你想要的样式属性，比如颜色、字体大小等 */
    left: 0px;
    color: #333;
    font-size: 14px;
}

.nav-item.active {
    background-color: #f0f0f0;
    border-left: 3px solid #0d6efd; /* 蓝色边框 */
}

.nav-item.active .sidebar-text {
    font-weight: bold;
}

.loading-indicator {
    padding: 20px;
    text-align: center;
    color: #6c757d;
}

.error-message {
    padding: 20px;
    text-align: center;
    color: #dc3545;
}


/* 移动端样式 */
@media (max-width: 768px) {
    .toggle-sidebar {
        visibility: hidden;
    }

    .sidebar {
        width: 80%;
        top: 56px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        backdrop-filter: blur(5px);
        z-index: 2000;
        background-color: whitesmoke; /* 修改为与桌面端一致的颜色 */
    }

    .sidebar.show-mobile {
        transform: translateX(0);
    }

    .sidebar:not(.show-mobile) {
        transform: translateX(-100%);
    }

    .sidebar.collapsed .sidebar-inner {
        opacity: 1;
    }


}
