/* ===================================================================
   问知智能体 · 深蓝科技主题 v3 — 深底色+亮内容
   设计哲学：深蓝背景作衬，白色卡片为主，高饱和强调色
   =================================================================== */

:root {
    /* 背景与容器 */
    --bg-primary:    #0f2b5c;   /* 页面底色：深蓝 */
    --bg-sidebar:    #0d2350;   /* 侧边栏：略深于底色 */
    --bg-card:       #ffffff;   /* 卡片背景：纯白 */
    --bg-card-hover: #f8fafc;   /* 卡片悬停：极浅灰 */
    --bg-secondary:  #f1f5f9;   /* 二级背景：浅灰 */
    --bg-input:      #ffffff;   /* 输入框：纯白 */
    --bg-hover:      #e2e8f0;   /* 悬停高亮 */

    /* 强调色 - 高饱和科技色 */
    --accent-cyan:    #0891b2;   /* 青色 */
    --accent-blue:    #2563eb;   /* 蓝 */
    --accent-purple:  #7c3aed;   /* 紫 */
    --accent-green:   #059669;   /* 绿 */
    --accent-amber:   #d97706;   /* 橙黄 */
    --accent-red:     #dc2626;   /* 红 */

    /* 文字颜色 - 分深底和白底两套 */
    --text-on-dark:   #f1f5f9;   /* 深色背景上用的亮文字 */
    --text-on-dark-dim: #94a3b8; /* 深色背景上的弱文字 */
    --text-on-card:   #1e293b;   /* 白色卡片上的主文字 */
    --text-on-card-dim:#64748b;  /* 白色卡片上的弱文字 */

    /* 边框 */
    --border-card:    #e2e8f0;   /* 卡片边框：浅灰 */
    --border-dark:    #1e4180;   /* 深色区域的边框 */

    /* 布局 */
    --sidebar-width: 240px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-card: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    background-image: url("../img/bg_pattern.svg");
    background-repeat: repeat;
    background-attachment: fixed;
    background-size: 400px 400px;
    color: #e2e8f0;             /* 页面底色是深蓝，默认文字用亮色 */
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* 卡片、模态框等白色容器内恢复深色文字 */
.card, .card-body, .modal-content, .list-group-item, .alert {
    color: var(--text-on-card);
}

/* 页面级标题：深色背景上使用亮色 */
h1, h2, h3, h4, h5, h6 { color: #f1f5f9; }
/* 卡片内标题恢复深色 */
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
.modal h1, .modal h2, .modal h3, .modal h4, .modal h5, .modal h6 {
    color: var(--text-on-card);
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-cyan); }

/* ---------- Layout ---------- */
.app-layout { display: flex; min-height: 100vh; }
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px 28px 40px;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ==================== 侧边栏（深色） ==================== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background-color: var(--bg-sidebar);
    background-image: url("../img/bg_pattern.svg");
    background-repeat: repeat;
    background-size: 350px 350px;
    border-right: 1px solid var(--border-dark);
    display: flex; flex-direction: column;
    z-index: 1000; overflow-y: auto;
}
.sidebar-logo {
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--border-dark);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-logo .logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #06b6d4, #7c3aed);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.sidebar-logo .logo-icon-img {
    width: 42px; height: 42px; flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(6,182,212,0.3));
}
.sidebar-logo .logo-text { font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--text-on-dark); }
.sidebar-logo .logo-text small { display: block; font-size: 13px; font-weight: 400; color: var(--text-on-dark-dim); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar-section {
    padding: 18px 20px 8px;
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: #64748b;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; margin: 3px 8px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 15px; font-weight: 500;
    transition: all 0.15s;
    cursor: pointer; border: none; background: none;
    width: calc(100% - 16px); text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #ffffff; }
.nav-item.active {
    background: rgba(6,182,212,0.12);
    color: #22d3ee;
    border-left: 3px solid #22d3ee;
}
.nav-item .nav-icon { width: 24px; text-align: center; font-size: 20px; flex-shrink: 0; }
.nav-item .nav-count {
    margin-left: auto; font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 10px;
    background: #22d3ee; color: #0f2b5c;
}
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border-dark); }
.sidebar-footer .user-info { color: #cbd5e1; font-size: 14px; margin-bottom: 8px; }
.sidebar-footer .role-badge { font-size: 11px; padding: 3px 9px; border-radius: 4px; background: #7c3aed; color: white; margin-left: 4px; }
.sidebar-footer .logout-link { color: #94a3b8; display: flex; align-items: center; gap: 4px; font-size: 13px; }
.sidebar-footer .logout-link:hover { color: #22d3ee; }

/* ==================== 卡片（白色） ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}
.card-body { padding: 20px; }
.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-card);
    padding: 14px 20px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 600; color: var(--text-on-card);
}

/* 页面标题（在深色背景上） */
.page-header { margin-bottom: 24px; }
.page-header h2 { color: #ffffff; font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.page-header h5 { color: #f1f5f9; font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.page-header p { color: #94a3b8; margin: 0; font-size: 15px; }

/* 首页等页面的大标题区域 */
.dashboard-header h2 { color: #ffffff; font-size: 28px; font-weight: 700; }
.dashboard-header p { color: #94a3b8; font-size: 15px; }

/* 页面内直接位于深色背景上的 h2/h4 标题 */
.main-content > .container > h2,
.main-content > .container > .text-center > h2,
.main-content > .container > h4 {
    color: #ffffff; font-weight: 700;
}
.main-content > .container > h4 { font-size: 22px; }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: all 0.15s; font-family: var(--font-sans);
}
.btn-primary { background: var(--accent-cyan); color: white; border-color: var(--accent-cyan); }
.btn-primary:hover { background: #0e7490; border-color: #0e7490; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-outline-primary { background: transparent; color: var(--accent-cyan); border-color: var(--accent-cyan); }
.btn-outline-primary:hover { background: var(--accent-cyan); color: white; }
.btn-outline-light { background: transparent; color: var(--text-on-card-dim); border-color: var(--border-card); }
.btn-outline-light:hover { background: var(--bg-secondary); }
.btn-success { background: var(--accent-green); color: white; }
.btn-warning { background: var(--accent-amber); color: white; }
.btn-danger { background: var(--accent-red); color: white; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ==================== 表单（白色背景） ==================== */
input, textarea, select, .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-on-card);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: border-color 0.2s;
    width: 100%;
}
input:focus, textarea:focus, select:focus, .form-control:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}
::placeholder { color: var(--text-on-card-dim); }

label { font-size: 13px; font-weight: 500; color: var(--text-on-card); margin-bottom: 4px; display: block; }

/* ==================== 徽标 ==================== */
.badge { display: inline-flex; align-items: center; padding: 3px 12px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.bg-primary { background: var(--accent-cyan); color: white; }
.badge.bg-success { background: var(--accent-green); color: white; }
.badge.bg-warning { background: var(--accent-amber); color: white; }
.badge.bg-danger { background: var(--accent-red); color: white; }
.badge.bg-light { background: var(--bg-secondary); color: var(--text-on-card-dim); border: 1px solid var(--border-card); }
.badge.bg-info { background: #ecfeff; color: var(--accent-cyan); }
.badge.bg-secondary { background: var(--bg-secondary); color: var(--text-on-card-dim); }

/* ==================== 文字 ==================== */
.text-muted { color: #94a3b8 !important; }               /* 深色背景上：中亮灰 */
.card .text-muted, .modal .text-muted, .alert .text-muted,
.list-group-item .text-muted { color: var(--text-on-card-dim) !important; }  /* 白色卡片上：深灰 */
.text-secondary { color: #94a3b8 !important; }
.card .text-secondary { color: var(--text-on-card-dim) !important; }
.text-primary { color: var(--accent-cyan) !important; }
.text-success { color: var(--accent-green) !important; }
.text-warning { color: var(--accent-amber) !important; }
.text-danger { color: var(--accent-red) !important; }

/* ==================== 表格（白底） ==================== */
.table { width: 100%; color: var(--text-on-card); border-collapse: collapse; }
.table th {
    background: var(--bg-secondary);
    padding: 12px 14px; font-size: 13px; font-weight: 600;
    color: var(--text-on-card-dim);
    border-bottom: 1px solid var(--border-card);
}
.table td { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--border-card); }
.table-hover tr:hover td { background: var(--bg-secondary); }

/* ==================== 列表组 ==================== */
.list-group-item {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-on-card);
    padding: 14px 18px;
}

/* ==================== Flash 消息 ==================== */
.alert {
    border-radius: var(--radius-md);
    padding: 14px 18px; font-size: 13px; margin-bottom: 20px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    color: var(--text-on-card);
}
.alert-success { border-left: 4px solid var(--accent-green); }
.alert-danger { border-left: 4px solid var(--accent-red); }
.alert-warning { border-left: 4px solid var(--accent-amber); }
.alert-info { border-left: 4px solid var(--accent-cyan); }
.alert .btn-close { filter: none; }

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* ==================== 移动端 ==================== */
.sidebar-toggle {
    display: none; position: fixed; top: 12px; left: 12px; z-index: 1100;
    background: var(--bg-card); border: 1px solid var(--border-card);
    border-radius: var(--radius-sm); padding: 8px 12px;
    color: var(--text-on-card); cursor: pointer; font-size: 18px;
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; max-width: 100vw; padding: 60px 16px 20px; }
}

/* ==================== 登录页 ==================== */
.login-layout {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-card {
    background: var(--bg-card); border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 420px;
}
.login-card .card-body { padding: 40px; }

/* ==================== 首页模块卡片 ==================== */
.module-card {
    cursor: pointer; border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: all 0.2s; height: 100%;
}
.module-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.module-card .card-body { padding: 24px 20px; }
.module-card .card-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.module-card .card-text { font-size: 14px; color: var(--text-on-card-dim); line-height: 1.5; }
.module-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.module-tags .badge { font-size: 11px; padding: 4px 9px; }
.icon-circle { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; }

/* ==================== 动画 ==================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }

/* ==================== 虚拟教研室 · LangGraph 多智能体 ==================== */

/* 专家阵容卡片 */
.studio-roster { }
.studio-expert-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    transition: all 0.2s;
}
.studio-expert-card:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}
.studio-expert-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    margin: 0 auto;
}

/* 流程步骤 */
.studio-flow {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.studio-flow-step {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px; padding: 6px 12px;
    font-size: 13px; color: #cbd5e1;
}
.studio-flow-num {
    width: 22px; height: 22px;
    background: #22d3ee; color: #0f2b5c;
    border-radius: 50%; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.studio-flow-arrow { color: #475569; font-size: 16px; }

/* 讨论主题条 */
.studio-topic-bar {
    background: rgba(34,211,238,0.1);
    border: 1px solid rgba(34,211,238,0.3);
    border-radius: 12px;
    padding: 12px 18px;
    display: flex; align-items: center; gap: 10px;
}
.studio-topic-label {
    color: #22d3ee; font-weight: 700; font-size: 14px;
    white-space: nowrap;
}
.studio-topic-text {
    color: #f1f5f9; font-size: 15px; font-weight: 500;
}

/* 专家阵容条 */
.studio-expert-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    background: rgba(255,255,255,0.04);
    border-radius: 10px; padding: 10px 14px;
}
.studio-expert-chip {
    display: flex; align-items: center; gap: 6px;
    background: var(--chip-bg, rgba(255,255,255,0.08));
    border: 1px solid var(--chip-color, rgba(255,255,255,0.15));
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 13px; font-weight: 600;
    color: var(--chip-color, #cbd5e1);
    transition: all 0.3s;
    opacity: 0.6;
}
.studio-expert-chip .studio-expert-emoji { font-size: 16px; }
.studio-expert-chip.active {
    opacity: 1;
    transform: scale(1.08);
    box-shadow: 0 0 12px var(--chip-color);
}
.studio-expert-chip.done {
    opacity: 1;
}
.studio-expert-chip.done::after {
    content: ' ✓';
    color: #22c55e;
}

/* 消息区域 */
.studio-message-area {
    min-height: 300px;
    padding-bottom: 20px;
}

/* 单条消息 */
.studio-message {
    display: flex; gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}
.studio-message-student {
    flex-direction: row-reverse;
}
.studio-msg-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.studio-msg-bubble {
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    padding: 12px 18px;
    max-width: 75%;
    min-width: 200px;
}
.studio-message-student .studio-msg-bubble {
    background: #dbeafe;
    border-color: #93c5fd;
}
.studio-msg-header {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}
.studio-msg-content {
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 流式打字光标 */
.studio-cursor {
    display: inline-block;
    animation: studio-blink 0.8s infinite;
    color: #22d3ee;
    font-weight: bold;
}
@keyframes studio-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 轮次分隔器 */
.studio-round-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 28px 0 20px;
}
.studio-round-line {
    flex: 1; height: 2px;
    border-radius: 1px;
    opacity: 0.5;
}
.studio-round-badge {
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

/* 底部操作区 */
.studio-action-area {
    position: sticky; bottom: 0;
    background: linear-gradient(180deg, transparent 0%, #0f2b5c 40%);
    padding: 20px 0;
    z-index: 10;
}
.studio-followup-box {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 16px;
}
.studio-complete-box {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 12px;
    padding: 24px;
}

/* ==================== 习题系统 ==================== */
.content-section {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
}
.section-title {
    font-size: 22px; font-weight: 700;
    color: var(--text-on-card);
    margin-bottom: 8px;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
}
.question-type {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 12px; font-weight: 600;
    background: #ecfeff; color: var(--accent-cyan);
}
.question-type.single-choice { background: #ecfeff; color: var(--accent-cyan); }
.question-type.true-false { background: #fef3c7; color: var(--accent-amber); }
.question-type.fill-blank { background: #ede9fe; color: var(--accent-purple); }
.question-type.short-answer { background: #d1fae5; color: var(--accent-green); }

.question-text {
    font-size: 17px; font-weight: 500;
    color: var(--text-on-card);
    line-height: 1.7;
    margin: 16px 0 20px;
}

.option-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px;
    margin-bottom: 10px;
    border: 2px solid var(--border-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-secondary);
    color: var(--text-on-card);
}
.option-item:hover {
    border-color: var(--accent-cyan);
    background: #ecfeff;
}
.option-item.selected {
    border-color: var(--accent-cyan);
    background: #cffafe;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}
.option-key {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-cyan); color: white;
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
}
.option-item.selected .option-key {
    background: #0e7490;
}

.feedback-correct {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: #065f46;
}
.feedback-wrong {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: #991b1b;
}
.ai-explanation {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 12px;
}
.ai-explanation strong { color: var(--accent-cyan); }

.score-display { padding: 20px 0; }
.score-number {
    font-size: 56px; font-weight: 700;
    color: var(--accent-cyan);
}
.score-label { font-size: 14px; color: var(--text-on-card-dim); }

.academic-btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.loading-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-voice {
    border-radius: 50%;
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
}

