/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #000000 100%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.logo {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-menu {
    padding: 20px 0;
    flex: 1;
}

.nav-item {
    width: 100%;
    padding: 15px 25px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left: 4px solid white;
}

.nav-item .icon {
    font-size: 20px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.page {
    display: none;
    height: 100%;
    flex-direction: column;
}

.page.active {
    display: flex;
}

/* 页面头部 */
.page-header,
.chat-header {
    padding: 25px 30px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1,
.chat-header h1 {
    font-size: 1.8rem;
    color: #1f2937;
    font-weight: 600;
}

/* 按钮样式 */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-icon {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    background: transparent;
    padding: 8px;
    font-size: 20px;
}

/* 聊天界面 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 18px;
    max-width: 70%;
}

.message-assistant {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.message-assistant .message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 18px;
    max-width: 85%;
}

.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.message-image {
    max-width: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.05);
}

.message-sources {
    margin-top: 15px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    font-size: 13px;
}

.source-item {
    padding: 8px;
    margin: 5px 0;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.faq-badge {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 8px;
}

.message-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f9fafb;
    border-color: #667eea;
}

.action-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 聊天输入区 */
.chat-input-container {
    border-top: 1px solid #e5e7eb;
    padding: 20px;
    background: #fafafa;
}

.image-preview {
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.image-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.btn-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#question-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    resize: none;
    max-height: 150px;
    font-family: inherit;
}

#question-input:focus {
    outline: none;
    border-color: #667eea;
}

/* FAQ列表 */
.faq-list {
    padding: 20px;
    overflow-y: auto;
}

.faq-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.faq-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.faq-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.faq-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

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

.faq-answer {
    color: #4b5563;
    line-height: 1.8;
    margin-bottom: 15px;
}

.faq-answer img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.faq-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #6b7280;
}

.faq-tag {
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 4px;
}

/* 文档上传 */
.upload-container {
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    background: white;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f9fafb;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.upload-area h3 {
    color: #1f2937;
    margin-bottom: 10px;
}

.upload-area p {
    color: #6b7280;
    margin-bottom: 20px;
}

.upload-status {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s;
}

/* 统计页面 */
.stats-container {
    padding: 20px;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card.positive {
    border-left: 4px solid #10b981;
}

.stat-card.negative {
    border-left: 4px solid #ef4444;
}

.stat-label {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}

.stats-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-section h3 {
    margin-bottom: 15px;
    color: #1f2937;
}

.detail-list {
    max-height: 400px;
    overflow-y: auto;
}

.detail-item {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.detail-item:last-child {
    border-bottom: none;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #1f2937;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.modal-close:hover {
    color: #1f2937;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.editor-container {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
}

.ql-editor {
    min-height: 200px;
    max-height: 400px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }

    .logo h2,
    .nav-item span:not(.icon) {
        display: none;
    }

    .stats-details {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 修改后的提示消息样式 - 更小尺寸 */
.toast {
    position: fixed;
    top: 20px;
    /* 改为顶部 */
    right: 20px;
    /* 改为右侧 */
    background: #1f2937;
    color: white;
    padding: 10px 15px;
    /* 减小内边距 */
    border-radius: 6px;
    /* 减小圆角 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s;
    font-size: 14px;
    /* 减小字体大小 */
    max-width: 300px;
    /* 限制最大宽度 */
}

@keyframes slideIn {
    from {
        transform: translateY(-400px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}
/* 负面评价模态框样式 */
#negative-evaluations-modal .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#negative-evaluations-modal .modal-content {
    background: white;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

#negative-evaluations-modal .evaluation-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px;
    background: #fff5f5;
}

#negative-evaluations-modal .positive-card {
    background: #f0fff0;
}

/* 评价记录中图片的样式 */
.negative-evaluations-modal img,
.positive-evaluations-modal img {
    max-width: 300px;
    height: auto;
    margin: 5px 0;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.negative-evaluations-modal .answer-content,
.positive-evaluations-modal .answer-content {
    line-height: 1.6;
}

.negative-evaluations-modal .answer-content img,
.positive-evaluations-modal .answer-content img {
    margin: 10px 0;
}


/* 在您的CSS中添加这些样式 */
.session-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-info {
    flex-grow: 1;
}

.session-id {
    font-weight: bold;
    margin-bottom: 5px;
}

.session-date, .session-message-count {
    font-size: 14px;
    color: #666;
    margin-bottom: 3px;
}

.session-actions {
    flex-shrink: 0;
}

.history-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 10px;
}

.loading-history, .no-history, .error-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.message-timestamp {
    font-size: 12px;
    color: #999;
    text-align: right;
    margin-top: 5px;
}
/* 在 chat-header 中调整按钮布局 */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.chat-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

/* 调整按钮间距 */
.chat-header .btn-secondary,
.chat-header .btn-primary {
    margin-left: 10px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.chat-header .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.chat-header .btn-secondary:hover {
    background-color: #5a6268;
}

.chat-header .btn-primary {
    background-color: #007bff;
    color: white;
}

.chat-header .btn-primary:hover {
    background-color: #0056b3;
}
.document-sources {
    margin-top: 8px;
}

.document-source-item {
    margin-bottom: 6px;
}

.document-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    display: inline-block;
    transition: background-color 0.2s;
}

.document-link:hover {
    background-color: #dbeafe;
    text-decoration: underline;
}
/* 认证弹窗样式 */
.modal.active {
    display: flex;
}

.auth-container {
    background: white;
    min-width: 400px;
    padding: 30px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;

/* 用户管理页面样式 */
/* 用户管理页面样式 */
#users-page {
    display: none;
    padding: 20px;
}

#users-page.active {
    display: block;
}

.user-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.user-info {
    flex-grow: 1;
}

.user-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.user-email {
    color: #666;
    font-size: 14px;
}

.user-meta {
    display: flex;
    gap: 10px;
}

.user-role, .user-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.user-role.admin {
    background-color: #dc3545;
    color: white;
}

.user-role.normal {
    background-color: #17a2b8;
    color: white;
}

.user-status.active {
    background-color: #28a745;
    color: white;
}

.user-status.inactive {
    background-color: #6c757d;
    color: white;
}

.user-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.user-actions button {
    font-size: 12px;
}

.session-user-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.user-badge {
    background-color: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: normal;
}

.user-badge.admin {
    background-color: #dc3545;
}

.user-badge.normal {
    background-color: #28a745;
}



.guest-badge {
    background-color: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn-link {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

.btn-link:hover {
    color: #0056b3;
}

#resend-code-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#resend-code-btn:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
}