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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

/* 登录页面背景 */
#loginPage {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 主应用页面背景 */
#mainApp {
    background: white;
}

/* 页面容器 */
.page {
    display: none !important;
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.page.active {
    display: block !important;
    z-index: 2;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.6s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.login-brand-text {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 1px;
}

.login-header h1 {
    color: #667eea;
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 16px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid #e1e5e9;
    color: #666;
}

.btn-outline:hover {
    border-color: #667eea;
    color: #667eea;
}

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

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

.btn-success {
    background: #2ed573;
    color: white;
}

.btn-success:hover {
    background: #26d467;
}

/* 错误消息 */
.error-message {
    color: #ff4757;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 71, 87, 0.1);
    border-radius: 8px;
    display: none;
}

.error-message.show {
    display: block;
}

/* 主应用样式 */
#mainApp {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f8f9fa;
}

/* 导航栏 */
.navbar {
    background: white;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.nav-brand-text {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    gap: 10px;
}

.nav-item {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-item.active {
    background: #667eea;
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 内容页面 */
.content-page {
    display: none;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.content-page.active {
    display: block;
}

/* 聊天页面 */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chat-messages {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.welcome-message i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.message.user .message-avatar {
    background: #667eea;
}

.message.assistant .message-avatar {
    background: #2ed573;
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.message.user .message-bubble {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.message.assistant .message-bubble {
    background: #f0f0f0;
    color: #333;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.chat-input-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: all 0.3s ease;
}

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

/* 历史记录页面 */
.history-container {
    max-width: 1000px;
    margin: 0 auto;
}

.history-header {
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.history-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e1e5e9;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-header span:first-child {
    font-weight: 600;
    color: #333;
}

.history-item-time {
    color: #666;
    font-size: 14px;
}

.history-item-content {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-stats {
    color: #999;
    font-size: 12px;
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
}

/* 消息格式化样式 */
.message-bubble pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
}

.message-bubble code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.message-bubble strong {
    font-weight: 600;
    color: #333;
}

.message-bubble em {
    font-style: italic;
    color: #555;
}

.message-bubble a {
    color: #667eea;
    text-decoration: none;
}

.message-bubble a:hover {
    text-decoration: underline;
}

/* 成功消息样式 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    z-index: 10000;
    font-weight: 500;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .history-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .success-message {
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* 管理员页面 */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-header {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stat-card-icon {
    font-size: 36px;
    margin-bottom: 15px;
}

.stat-card-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-card-label {
    color: #666;
    font-size: 14px;
}

.admin-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.data-table tr:hover {
    background: #f8f9fa;
}

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

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

.modal-content {
    background: white;
    border-radius: 15px;
    width: 95%;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 25px;
}

/* 加载指示器 */
.loading-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-indicator.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    /* 页面显示控制 - 修复滚动问题 */
    .page {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100vw !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden;
        z-index: 1;
        -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    }
    
    .page:not(.active) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .page.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 10;
    }
    
    /* 主应用容器滚动优化 */
    #mainApp {
        height: auto !important;
        min-height: 100vh;
    }
    
    /* 内容页面滚动优化 */
    .content-page {
        padding: 15px;
        height: auto !important;
        min-height: calc(100vh - 80px); /* 减去导航栏高度 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 聊天消息容器滚动优化 */
    .chat-messages {
        height: auto !important;
        max-height: calc(100vh - 200px); /* 减去导航栏和输入框高度 */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 20px;
    }
    
    /* 管理员页面滚动优化 */
    .admin-container {
        height: auto !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 50px;
    }
    
    .admin-section {
        margin-bottom: 20px;
        max-height: none !important;
        overflow: visible !important;
    }
    
    /* 历史记录页面滚动优化 */
    .history-container {
        height: auto !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 50px;
    }
    
    /* 登录页面移动端优化 */
    .login-card {
        padding: 30px 20px;
        margin: 10px;
        border-radius: 15px;
        max-width: 90%;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .login-header p {
        font-size: 14px;
    }
    
    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    /* 导航栏移动端优化 */
    .navbar {
        padding: 0 15px;
        height: 60px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .nav-brand {
        font-size: 18px;
    }
    
    .nav-item span {
        display: none;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

/* 状态指示器 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-admin {
    background: #d1ecf1;
    color: #0c5460;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    padding: 20px 0;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover {
    background: #f5f5f5;
    border-color: #667eea;
}

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

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #999;
}

/* 表格头部样式 */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.table-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

/* 消息预览样式 */
.message-preview {
    max-width: 300px;
    word-break: break-word;
    line-height: 1.4;
}

/* 记录详情模态框样式 */
.record-detail {
    max-width: 1200px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.record-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.record-info {
    margin-bottom: 25px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.info-item span {
    color: #333;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

.record-content h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.conversation-detail {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
}

.message-item {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    background: white;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.message-item.highlight {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.message-type {
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    color: white;
}

.message-type:contains("用户") {
    background: #667eea;
}

.message-type:contains("AI") {
    background: #28a745;
}

.message-time {
    color: #999;
}

.message-text {
    line-height: 1.6;
    color: #333;
    word-break: break-word;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .record-detail {
        width: 95vw;
        max-height: 85vh;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .pagination-info {
        font-size: 12px;
    }
    
    .message-preview {
        max-width: 200px;
    }
}


/* 搜索和筛选样式 */
.search-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-box button {
    padding: 8px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-box button:hover {
    background: #5a67d8;
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-box select,
.filter-box input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-box span {
    color: #666;
    font-size: 14px;
}

/* 批量操作样式 */
.batch-operations {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.batch-info {
    color: #1976d2;
    font-weight: 500;
}

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

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideInRight 0.3s ease;
}

.notification-info {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1976d2;
}

.notification-success {
    background: #e8f5e8;
    border-left: 4px solid #4caf50;
    color: #2e7d32;
}

.notification-warning {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    color: #f57c00;
}

.notification-error {
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.notification-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 主题切换样式 */
.theme-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    margin-right: 10px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 暗色主题 */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #404040;
    --accent-color: #667eea;
}

[data-theme="dark"] body {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .login-card,
[data-theme="dark"] .data-table,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .search-filter-bar {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .data-table th,
[data-theme="dark"] .data-table td {
    border-color: var(--border-color);
}

[data-theme="dark"] .data-table th {
    background: var(--bg-tertiary);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .navbar {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .content-page {
    background: var(--bg-primary);
}

[data-theme="dark"] .chat-messages {
    background: var(--bg-secondary);
}

[data-theme="dark"] .message.user {
    background: var(--accent-color);
}

[data-theme="dark"] .message.assistant {
    background: var(--bg-tertiary);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .search-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .filter-box {
        justify-content: space-between;
    }
    
    .batch-operations {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .batch-actions {
        justify-content: center;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

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

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .loading-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 表格优化 */
.data-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 0;
}

.data-table th,
.data-table td {
    text-align: left;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

[data-theme="dark"] .data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* 状态徽章优化 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    min-width: 60px;
}

.status-active {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-inactive {
    background: #ffebee;
    color: #c62828;
}

.status-admin {
    background: #e3f2fd;
    color: #1976d2;
}

[data-theme="dark"] .status-active {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

[data-theme="dark"] .status-inactive {
    background: rgba(244, 67, 54, 0.2);
    color: #e57373;
}

[data-theme="dark"] .status-admin {
    background: rgba(33, 150, 243, 0.2);
    color: #64b5f6;
}


/* 使用记录详情对话样式 */
.conversation-detail {
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

[data-theme="dark"] .conversation-detail {
    background: #2d3748;
    border-color: #4a5568;
}

.conversation-message {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 12px;
    position: relative;
    animation: fadeIn 0.3s ease-in;
}

.conversation-message.user {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    margin-left: 0;
    margin-right: 40px;
}

.conversation-message.assistant {
    background: #f3e5f5;
    border-left: 4px solid #9c27b0;
    margin-left: 40px;
    margin-right: 0;
}

.conversation-message.current-message {
    box-shadow: 0 0 0 2px #ffc107;
    border-color: #ffc107;
}

[data-theme="dark"] .conversation-message.user {
    background: rgba(33, 150, 243, 0.1);
    border-left-color: #64b5f6;
}

[data-theme="dark"] .conversation-message.assistant {
    background: rgba(156, 39, 176, 0.1);
    border-left-color: #ba68c8;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.message-avatar.user {
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

.message-avatar.assistant {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.message-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-sender {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

[data-theme="dark"] .message-sender {
    color: #e2e8f0;
}

.message-time {
    font-size: 12px;
    color: #666;
}

[data-theme="dark"] .message-time {
    color: #a0aec0;
}

.message-body {
    padding-left: 48px;
}

.message-content {
    line-height: 1.6;
    color: #333;
    word-wrap: break-word;
}

[data-theme="dark"] .message-content {
    color: #e2e8f0;
}

.message-content p {
    margin: 0 0 12px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    font-weight: 600;
    color: #2c3e50;
}

[data-theme="dark"] .message-content strong {
    color: #f7fafc;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

[data-theme="dark"] .message-content code {
    background: rgba(255, 255, 255, 0.1);
}

.message-content pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 12px 0;
}

[data-theme="dark"] .message-content pre {
    background: #1a202c;
    border-color: #4a5568;
}

.message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* 记录详情模态框优化 */
.record-detail {
    max-width: 1200px; /* 增加最大宽度 */
    width: 95vw; /* 增加默认宽度 */
    max-height: 85vh; /* 增加最大高度 */
    overflow-y: auto;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px; /* 增加内边距 */
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

[data-theme="dark"] .record-header {
    background: #2d3748;
    border-bottom-color: #4a5568;
}

.record-header h3 {
    margin: 0;
    font-size: 22px; /* 增加字体大小 */
    font-weight: 600;
    color: #2c3e50;
}

[data-theme="dark"] .record-header h3 {
    color: #f7fafc;
}

.record-info {
    padding: 24px 32px; /* 增加内边距 */
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
}

[data-theme="dark"] .record-info {
    border-bottom-color: #4a5568;
    background: #1a202c;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 增加最小宽度 */
    gap: 20px; /* 增加间距 */
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-item label {
    font-weight: 600;
    font-size: 13px; /* 稍微增加字体大小 */
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .info-item label {
    color: #a0aec0;
}

.info-item span {
    font-size: 15px; /* 增加字体大小 */
    color: #333;
    padding: 10px 14px; /* 增加内边距 */
    background: #f8f9fa;
    border-radius: 8px; /* 增加圆角 */
    border: 1px solid #e9ecef;
    font-weight: 500;
}

[data-theme="dark"] .info-item span {
    color: #e2e8f0;
    background: #2d3748;
    border-color: #4a5568;
}

.record-content {
    padding: 24px 32px; /* 增加内边距 */
    background: #ffffff;
}

[data-theme="dark"] .record-content {
    background: #1a202c;
}

.record-content h4 {
    margin: 0 0 20px 0; /* 增加底部间距 */
    font-size: 18px; /* 增加字体大小 */
    font-weight: 600;
    color: #2c3e50;
}

[data-theme="dark"] .record-content h4 {
    color: #f7fafc;
}

/* 使用记录详情对话样式优化 */
.conversation-detail {
    max-height: 600px; /* 增加最大高度 */
    overflow-y: auto;
    padding: 20px; /* 增加内边距 */
    background: #f8f9fa;
    border-radius: 12px; /* 增加圆角 */
    border: 1px solid #e9ecef;
    margin-top: 8px;
}

[data-theme="dark"] .conversation-detail {
    background: #2d3748;
    border-color: #4a5568;
}

.conversation-message {
    margin-bottom: 24px; /* 增加间距 */
    padding: 20px; /* 增加内边距 */
    border-radius: 16px; /* 增加圆角 */
    position: relative;
    animation: fadeIn 0.3s ease-in;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 添加阴影 */
}

.conversation-message.user {
    background: #e3f2fd;
    border-left: 5px solid #2196f3; /* 增加边框宽度 */
    margin-left: 0;
    margin-right: 60px; /* 增加右边距 */
}

.conversation-message.assistant {
    background: #f3e5f5;
    border-left: 5px solid #9c27b0; /* 增加边框宽度 */
    margin-left: 60px; /* 增加左边距 */
    margin-right: 0;
}

.conversation-message.current-message {
    box-shadow: 0 0 0 3px #ffc107; /* 增加高亮边框宽度 */
    border-color: #ffc107;
}

[data-theme="dark"] .conversation-message.user {
    background: rgba(33, 150, 243, 0.15); /* 增加透明度 */
    border-left-color: #64b5f6;
}

[data-theme="dark"] .conversation-message.assistant {
    background: rgba(156, 39, 176, 0.15); /* 增加透明度 */
    border-left-color: #ba68c8;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px; /* 增加间距 */
    gap: 16px; /* 增加间距 */
}

.message-avatar {
    width: 42px; /* 增加尺寸 */
    height: 42px; /* 增加尺寸 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px; /* 增加字体大小 */
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); /* 添加阴影 */
}

.message-avatar.user {
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

.message-avatar.assistant {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.message-meta {
    display: flex;
    flex-direction: column;
    gap: 4px; /* 增加间距 */
}

.message-sender {
    font-weight: 600;
    font-size: 16px; /* 增加字体大小 */
    color: #333;
}

[data-theme="dark"] .message-sender {
    color: #e2e8f0;
}

.message-time {
    font-size: 13px; /* 增加字体大小 */
    color: #666;
}

[data-theme="dark"] .message-time {
    color: #a0aec0;
}

.message-body {
    padding-left: 58px; /* 增加左边距 */
}

.message-content {
    line-height: 1.7; /* 增加行高 */
    color: #333;
    word-wrap: break-word;
    font-size: 15px; /* 增加字体大小 */
}

[data-theme="dark"] .message-content {
    color: #e2e8f0;
}

.message-content p {
    margin: 0 0 14px 0; /* 增加间距 */
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    font-weight: 600;
    color: #2c3e50;
}

[data-theme="dark"] .message-content strong {
    color: #f7fafc;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 3px 8px; /* 增加内边距 */
    border-radius: 6px; /* 增加圆角 */
    font-family: 'Courier New', monospace;
    font-size: 14px; /* 增加字体大小 */
}

[data-theme="dark"] .message-content code {
    background: rgba(255, 255, 255, 0.1);
}

.message-content pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px; /* 增加圆角 */
    padding: 16px; /* 增加内边距 */
    overflow-x: auto;
    margin: 16px 0; /* 增加间距 */
    font-size: 14px; /* 增加字体大小 */
}

[data-theme="dark"] .message-content pre {
    background: #1a202c;
    border-color: #4a5568;
}

.message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* 滚动条样式优化 */
.conversation-detail::-webkit-scrollbar {
    width: 8px; /* 增加宽度 */
}

.conversation-detail::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px; /* 增加圆角 */
}

.conversation-detail::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px; /* 增加圆角 */
}

.conversation-detail::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

[data-theme="dark"] .conversation-detail::-webkit-scrollbar-track {
    background: #2d3748;
}

[data-theme="dark"] .conversation-detail::-webkit-scrollbar-thumb {
    background: #4a5568;
}

[data-theme="dark"] .conversation-detail::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* 响应式设计优化 */
@media (max-width: 1024px) {
    .record-detail {
        width: 98vw;
        max-height: 90vh;
    }
    
    .conversation-message.user {
        margin-right: 30px;
    }
    
    .conversation-message.assistant {
        margin-left: 30px;
    }
}

@media (max-width: 768px) {
    .record-detail {
        width: 100vw;
        max-height: 95vh;
        border-radius: 0; /* 移除圆角 */
    }
    
    .record-header {
        padding: 16px 20px;
        border-radius: 0;
    }
    
    .record-header h3 {
        font-size: 18px;
    }
    
    .record-info,
    .record-content {
        padding: 16px 20px;
    }
    
    .conversation-detail {
        padding: 16px;
        max-height: 50vh; /* 减少移动端高度 */
        border-radius: 8px;
    }
    
    .conversation-message {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    .message-body {
        padding-left: 0;
        margin-top: 12px;
    }
    
    .message-header {
        margin-bottom: 12px;
        gap: 12px;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .message-sender {
        font-size: 14px;
    }
    
    .message-time {
        font-size: 12px;
    }
    
    .message-content {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .info-item span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .record-detail {
        max-height: 100vh;
    }
    
    .conversation-detail {
        max-height: 40vh;
        padding: 12px;
    }
    
    .conversation-message {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .message-content {
        font-size: 13px;
    }
    
    .record-header {
        padding: 12px 16px;
    }
    
    .record-info,
    .record-content {
        padding: 12px 16px;
    }
}

/* 模态框关闭按钮优化 */
.modal-close {
    background: none;
    border: none;
    font-size: 22px; /* 增加字体大小 */
    color: #666;
    cursor: pointer;
    padding: 10px; /* 增加内边距 */
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* 增加尺寸 */
    height: 40px; /* 增加尺寸 */
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: scale(1.1); /* 添加悬停效果 */
}

[data-theme="dark"] .modal-close {
    color: #a0aec0;
}

[data-theme="dark"] .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}



/* 新增图标样式 */
.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

.nav-logo {
    width: 30px;
    height: 30px;
    margin-right: 5px;
}

.welcome-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}


