.topics-container {
    display: flex;
    gap: 10px; /* 为搜索框和下拉菜单之间提供间隔 */
    position: fixed;
    left: -100%; /* Initially positioned to the left out of view */
    top: 0;
    width: 230px; /* Adjust according to your needs */
    height: 90%; /* Or adjust according to your needs */
    background-color: #f9f9f9; /* Or any color you prefer */
    transition: left 0.5s; /* Smooth transition for sliding effect */
    z-index: 100; /* 调整z-index以确保其出现在ai-response-box之上 */
    display: flex;
    flex-direction: column; /* 保证搜索框在主题列表上方 */
    max-height: 100vh; /* 确保整个容器不超过视口的高度 */
    overflow: hidden; /* 切断超出部分 */
    font-size: 13.5px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.5); /* 添加阴影效果 */
    border-radius: 4px;
    padding: 10px;
}


.loading {
    text-align: center;
    color: #666;
    padding: 10px;
}

.no-results {
    text-align: center;
    color: #666;
    padding: 10px;
    font-style: italic;
}

.error {
    text-align: center;
    color: #ff4444;
    padding: 10px;
}

/* A class to toggle when showing the topics-container */
.topics-container-visible {
    left: 0;
}

.topics-container-invisible {
    left: -100%;
}

.topics-container div {
    background-color: transparent;
    border: none;
    overflow: hidden;
}

.topics-container input,
.topics-container select {
    width: 100%; /* 让输入框和下拉菜单填满其父容器 */
    border: none;
    padding: 8px 12px;
    outline: none; /* 防止点击时出现轮廓 */
}

#topics_search_box:focus, #topics_dropdown:focus {
    border-color: #5D5CDE;
    box-shadow: #5c5cde67;
}

/* Adjust the styles of your input and dropdown to make sure they look good in vertical arrangement */
#topics_search_box, #topics_dropdown {
    margin: 10px; /* Add margin for spacing, adjust as necessary */
    margin-top: 6px;
    width: 90%; 
    padding: 2px; /* 输入框内边距调整 */
    margin-bottom: 5px; /* 与主题列表之间间距 */
    height: 25px;
    border: 0px;
}


#topics_list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto; /* 允许垂直滚动 */
    max-height: 80vh; /* 设置最大高度，50vh表示视口高度的50% */
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

#topics_list li {
    cursor: pointer;
    padding: 10px;
    border-bottom: 1px solid #ccc;
}

#topics_list li:last-child {
    border-bottom: none;
}

#topics_list li:hover {
    background-color: #f4f4f4;
}

.topics-container {
    /* 确保容器有最小高度 */
    min-height: 50px;
    /* 如果使用固定定位，确保有足够空间 */
    padding: 0;
}

.search-container {
    /* 确保搜索容器不会被压缩 */
    min-height: 40px;
    margin-top: 15px;
    margin-left: 10px;
    margin-bottom: 5px;
    /* 防止内容溢出 */
    overflow: hidden;
    padding: 0;
}

#topics_search_box {
    height: 40px;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 16px;
    background-color: #fff;
    margin: 0;
}

#topics_search_box::placeholder {
    color: #999;  /* 调整placeholder颜色 */
}

/* 滚动条美化 */
#topics_list {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

#topics_list::-webkit-scrollbar {
    width: 6px;
}

#topics_list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#topics_list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#topics_list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 分页控制美化 */
.pagination {
    text-align: center;
    margin-top: 10px;
    padding: 10px 0;
    background: #f9f9f9 !important;
    border-top: 1px solid #ccc;
    position: sticky;
    bottom: 0;
    z-index: 1;
    display: grid;  /* 使用网格布局 */
    grid-template-columns: 70px 1fr 70px;  /* 三列固定宽度布局 */
    align-items: center;
}

/* 分页按钮基础样式 */
.pagination button {
    padding: 4px 0px !important;  /* 缩小按钮 */
    border: 1px solid #ddd;
    border-radius: 12px !important;  /* 稍微调整圆角 */
    background: #fff;
    color: #666 !important;
    font-size: 12px !important;  /* 缩小字体 */
    cursor: pointer !important;
    transition: all 0.2s ease !important·;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    width: 60px !important;  /* 固定宽度 */
    visibility: visible !important;  /* 默认可见 */
}

/* 隐藏按钮但保持占位 */
.pagination button[disabled] {
    visibility: hidden;  /* 隐藏但保持占位 */
}

.pagination button:hover:not([disabled]) {
    background: #f0f0f0;
    border-color: #999;
    color: #333;
}

.pagination button:active:not([disabled]) {
    background: #e8e8e8;  /* 只改变背景色 */
    border-color: #999;   /* 和边框颜色 */
}

/* 页码显示在中间 */
.pagination span {
    color: #666;
    font-size: 13px;
    grid-column: 2;  /* 始终在中间列 */
    text-align: center;
}

/* 确保分页控件在侧边栏滑动时正确显示 */
#topics_list {
    position: relative;  /* 为sticky分页提供定位上下文 */
    height: calc(100% - 50px);  /* 为分页控件留出空间 */
    overflow-y: auto;
}

/* 话题项目容器 */
.topic-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 2px; /* 为删除按钮留出空间 */
}

/* 五角星图标样式 */
.pin-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s ease;
}

.pin-icon.pinned {
    color: #ffd700;
}

/* 五角星悬停效果 */
.pin-icon:hover {
    color: #ffd700;
}

/* 加载动画容器 */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
}

/* 加载动画 */
.loading-spinner::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ccc;
    border-top-color: #666;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 确保加载动画容器不会影响布局 */
#topics_list {
    min-height: 200px;  /* 给予足够空间显示加载动画 */
    position: relative;  /* 为绝对定位的加载动画提供参考 */
}