/* 管理后台样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 顶部导航 */
.admin-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    position: relative;
}

.admin-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.admin-header .subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.back-link {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 6px;
    transition: all 0.3s;
}

.back-link:hover {
    background: rgba(255,255,255,0.2);
}

/* 统计卡片 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

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

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-top: 5px;
}

/* 会话列表 */
.sessions-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

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

.section-header h2 {
    font-size: 20px;
    color: #2c3e50;
}

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

.refresh-btn {
    padding: 8px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.refresh-btn:hover {
    background: #2980b9;
}

.auto-evaluate-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
}

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

.auto-evaluate-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* 会话卡片 */
.session-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.session-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
}

.session-info {
    flex: 1;
}

.session-id {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.session-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #555;
}

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

.evaluate-btn {
    padding: 8px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.evaluate-btn:hover {
    background: #219a52;
}

.evaluate-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.delete-btn {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.delete-btn:hover {
    background: #c0392b;
}

/* 评估区域 */
.evaluation-summary {
    display: flex;
    gap: 20px;
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.eval-dimension {
    flex: 1;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.eval-dimension:hover {
    background: #e8f4fd;
}

.eval-dimension.expanded {
    background: #e8f4fd;
}

.eval-title {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.eval-score {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.score-value {
    font-size: 24px;
    font-weight: bold;
}

.score-value.score-5 { color: #27ae60; }
.score-value.score-4 { color: #2ecc71; }
.score-value.score-3 { color: #f39c12; }
.score-value.score-2 { color: #e67e22; }
.score-value.score-1 { color: #e74c3c; }
.score-value.score-0 { color: #95a5a6; }

.score-stars {
    color: #f1c40f;
    font-size: 14px;
}

.eval-brief {
    font-size: 14px;
    color: #2c3e50;
}

.eval-detail {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.eval-dimension.expanded .eval-detail {
    display: block;
}

.no-evaluation {
    padding: 15px 20px;
    text-align: center;
    color: #999;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* 会话详情（展开） */
.session-detail {
    display: none;
    border-top: 1px solid #e0e0e0;
}

.session-detail.expanded {
    display: block;
}

.detail-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 25px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #2c3e50;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

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

/* 对话消息 */
.message-item {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    max-width: 85%;
}

.message-item.user {
    background: #e8f4fd;
    margin-left: auto;
}

.message-item.assistant {
    background: #f0f0f0;
}

.message-role {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.message-content {
    font-size: 14px;
    line-height: 1.6;
}

/* Markdown样式 */
.message-content p {
    margin-bottom: 8px;
}

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

.message-content code {
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.message-content pre {
    background: rgba(0,0,0,0.05);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

/* 工具调用样式 */
.tool-calls-section {
    margin-top: 10px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid #667eea;
    border-radius: 6px;
}

.tool-call-item {
    padding: 6px 10px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    font-size: 13px;
    color: #2c3e50;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* KaTeX样式 */
.katex {
    font-size: 1.1em;
}

/* 做题记录 */
.exercise-item {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.exercise-component {
    font-size: 12px;
    color: #7f8c8d;
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 4px;
}

.exercise-result {
    font-size: 14px;
    font-weight: bold;
}

.exercise-result.correct {
    color: #27ae60;
}

.exercise-result.incorrect {
    color: #e74c3c;
}

.exercise-question {
    font-size: 14px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.exercise-meta {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #7f8c8d;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 18px;
    color: #2c3e50;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #7f8c8d;
    line-height: 1;
}

.close-btn:hover {
    color: #2c3e50;
}

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

/* 响应式 */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .evaluation-summary {
        flex-direction: column;
    }

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

    .session-actions {
        width: 100%;
    }

    .session-actions button {
        flex: 1;
    }
}

/* 滚动条样式 */
.tab-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.tab-content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tab-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.tab-content::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 整体评价 */
.overall-assessment {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f4fd 100%);
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
}

.overall-label {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}
