/* RAG 知识库管理系统 - 全局样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #303133;
}

#app {
    min-height: 100vh;
}

/* 布局样式 */
.layout-container {
    display: flex;
    min-height: 100vh;
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-wrapper {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f5f7fa;
}

/* 侧边栏样式 */
.sidebar {
    width: 220px;
    background-color: #304156;
    color: #bfcbd9;
    transition: width 0.3s;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #263445;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}

.sidebar-menu {
    border-right: none;
    background-color: transparent;
}

.sidebar-menu .el-menu-item,
.sidebar-menu .el-sub-menu__title {
    color: #bfcbd9;
}

.sidebar-menu .el-menu-item:hover,
.sidebar-menu .el-sub-menu__title:hover {
    background-color: #263445;
}

.sidebar-menu .el-menu-item.is-active {
    color: #409eff;
    background-color: #263445;
}

/* 顶部导航样式 */
.header {
    height: 60px;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.collapse-btn {
    font-size: 20px;
    cursor: pointer;
    color: #606266;
}

/* 页面标题 */
.page-header {
    margin-bottom: 10px;
}

.page-title {
    font-size: 18px;
    font-weight: 500;
    color: #303133;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-button {
    padding: 0;
    height: auto;
    line-height: 1;
}

.home-button .el-icon {
    font-size: 20px;
    color: #409eff;
    vertical-align: middle;
}

.home-button:hover .el-icon {
    color: #66b1ff;
}

.page-description {
    color: #909399;
    font-size: 14px;
}

/* 卡片样式 */
.content-card {
    background-color: #fff;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}

/* 表格样式优化 */
.el-table {
    margin-top: 15px;
}

/* 按钮组 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* 状态标签 */
.status-tag {
    display: inline-flex;
    align-items: center;
}

.status-tag::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active::before {
    background-color: #67c23a;
}

.status-inactive::before {
    background-color: #909399;
}

.status-pending::before {
    background-color: #e6a23c;
}

.status-error::before {
    background-color: #f56c6c;
}

/* 聊天界面样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #ebeef5;
    background-color: #fafafa;
}

.message {
    display: flex;
    margin-bottom: 20px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.message-avatar.user {
    background-color: #409eff;
    color: #fff;
}

.message-avatar.ai {
    background-color: #67c23a;
    color: #fff;
}

.message-content {
    flex: 1;
    background-color: #f5f7fa;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 80%;
}

.message.user .message-content {
    background-color: #ecf5ff;
}

/* 响应式 */
@media screen and (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content-wrapper {
        padding: 10px;
    }
}

/* 加载动画 */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #909399;
}

.empty-state .el-icon {
    font-size: 60px;
    margin-bottom: 20px;
    color: #dcdfe6;
}

/* 代码块样式 */
pre {
    background-color: #f5f7fa;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
}

code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #303133;
}

/* ==================== 文件管理页面样式 ==================== */

.files-page {
    height: 100%;
}

.files-container {
    display: flex;
    height: calc(100vh - 90px);
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 左侧目录树区域 */
.directory-sidebar {
    width: 260px;
    border-right: 1px solid #ebeef5;
    display: flex;
    flex-direction: column;
    background-color: #fafafa;
}

.sidebar-header {
    padding: 10px 15px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #303133;
}

.directory-tree {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.directory-tree .el-tree-node__content {
    height: 36px;
    border-radius: 4px;
}

.directory-tree .el-tree-node__content:hover {
    background-color: #ecf5ff;
}

.directory-tree .el-tree-node.is-current > .el-tree-node__content {
    background-color: #409eff;
    color: #fff;
}

.directory-tree .el-tree-node.is-current > .el-tree-node__content .el-icon {
    color: #fff;
}

.tree-node-content {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.tree-node-content .el-icon {
    color: #e6a23c;
    font-size: 16px;
}

/* 右侧文件列表区域 */
.file-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    padding: 10px 15px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
}

.breadcrumb {
    flex: 1;
}

.breadcrumb .clickable {
    cursor: pointer;
    color: #409eff;
}

.breadcrumb .clickable:hover {
    color: #66b1ff;
}

.content-actions {
    display: flex;
    gap: 10px;
}

/* 搜索栏 */
.search-section {
    padding: 15px 20px;
    border-bottom: 1px solid #ebeef5;
    background-color: #fff;
}

/* 文件列表表格 */
.file-table-container {
    flex: 1;
    overflow: auto;
    padding: 0 20px 20px;
}

.file-table-container .el-table {
    margin-top: 0;
}

.file-table-container .el-table__row {
    cursor: default;
}

.file-table-container .el-table__row:hover {
    background-color: #f5f7fa;
}

/* 目录行显示手型光标 */
.file-table-container .el-table__row.directory-row,
.file-table-container .directory-row {
    cursor: pointer !important;
}

/* 目录文件名显示手型光标 */
.file-name-cell .filename {
    cursor: pointer;
}

/* Markdown 渲染样式 */
.markdown-rendered {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #24292e;
}

.markdown-rendered h1 {
    font-size: 2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

.markdown-rendered h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

.markdown-rendered h3 {
    font-size: 1.25em;
}

.markdown-rendered p {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-rendered ul,
.markdown-rendered ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-rendered li {
    margin-bottom: 4px;
}

.markdown-rendered code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.markdown-rendered pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 6px;
    margin-bottom: 16px;
}

.markdown-rendered pre code {
    padding: 0;
    background-color: transparent;
}

.markdown-rendered blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 16px 0;
}

.markdown-rendered table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

.markdown-rendered th,
.markdown-rendered td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-rendered th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.markdown-rendered tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-rendered img {
    max-width: 100%;
    box-sizing: border-box;
}

.markdown-rendered a {
    color: #0366d6;
    text-decoration: none;
}

.markdown-rendered a:hover {
    text-decoration: underline;
}

/* 文件类型图标 */
.file-icon {
    font-size: 18px;
}

.file-icon.directory {
    color: #e6a23c;
}

.file-icon.file {
    color: #409eff;
}

.file-icon.markdown {
    color: #67c23a;
}

/* 统计信息加载中样式 */
.stats-loading {
    color: #909399;
    font-style: italic;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-buttons .el-dropdown {
    vertical-align: middle;
}

.danger-item {
    color: #f56c6c;
}

.danger-item:hover {
    color: #f78989;
    background-color: #fef0f0;
}

/* 分页 */
.pagination-container {
    padding: 10px 15px;
    border-top: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
}

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

.selected-count {
    color: #606266;
    font-size: 14px;
}

/* 空状态 */
.empty-directory {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #909399;
    padding: 40px;
}

.empty-directory .el-icon {
    font-size: 64px;
    margin-bottom: 16px;
    color: #dcdfe6;
}

.empty-directory p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
    .files-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 140px);
    }

    .directory-sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid #ebeef5;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .content-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}
