/* ==========================================
   《工程数学》交互复习系统 - 样式设计 (styles.css)
   设计风格: Glassmorphism (磨砂玻璃拟态)
   支持特性: 亮/暗主题, 动态彩色光晕背景, 平滑过渡
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* 全局变量与调色盘 */
:root {
    /* 暗色模式默认 */
    --bg-gradient: linear-gradient(135deg, #0f111a 0%, #171926 100%);
    --glass-bg: rgba(23, 25, 38, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --text-primary: #f1f3f9;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    --primary-color: #7f5af0;
    --primary-hover: #9370db;
    --secondary-color: #2cb67d;
    --accent-color: #ff8e3c;
    --error-color: #e53e3e;
    
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --shadow-inset: inset 0 1px 0 var(--glass-highlight);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="light"] {
    /* 亮色模式 */
    --bg-gradient: linear-gradient(135deg, #eef2f7 0%, #dfe6ed 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.5);
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    --primary-color: #6246ea;
    --primary-hover: #4b36c4;
    --secondary-color: #2b6cb0;
    --accent-color: #dd6b20;
    --error-color: #c53030;
    
    --shadow-main: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --shadow-inset: inset 0 1px 0 var(--glass-highlight);
}

/* 页面基本重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    position: relative;
    transition: var(--transition-smooth);
}

/* 背景炫彩发光球 (提供毛玻璃透光背景) */
.bg-glow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-ball {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    transition: var(--transition-smooth);
}

.ball-1 {
    top: -10%;
    right: 5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #7f5af0 0%, transparent 70%);
}

.ball-2 {
    bottom: -10%;
    left: 10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #2cb67d 0%, transparent 70%);
}

[data-theme="light"] .glow-ball {
    opacity: 0.25;
}

/* 框架布局 */
#app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ==========================================
   左侧侧边栏 (Sidebar)
   ========================================== */
aside {
    width: 320px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
    transition: var(--transition-smooth);
}

.logo-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(120deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-area p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 导航菜单 */
nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(127, 90, 240, 0.15);
    border: 1px solid rgba(127, 90, 240, 0.25);
    color: var(--primary-color);
}

[data-theme="light"] .nav-item.active {
    background: rgba(98, 70, 234, 0.08);
    border: 1px solid rgba(98, 70, 234, 0.18);
}

/* 侧边栏底部设置 */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

/* 亮暗切换按钮 */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* ==========================================
   中间主内容区 (Main Panel)
   ========================================== */
main {
    margin-left: 320px;
    flex-grow: 1;
    padding: 2.5rem;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* 顶部状态栏 */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-main);
    border-radius: 16px;
    padding: 1.25rem 2rem;
}

.header-info h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 统计看板 */
.stats-container {
    display: flex;
    gap: 1.5rem;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
}

.stat-box .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-box .val {
    font-size: 1.1rem;
    font-weight: 700;
}

.stat-box.score .val {
    color: var(--primary-color);
}

.stat-box.rate .val {
    color: var(--secondary-color);
}

/* ==========================================
   题目卡片列表
   ========================================== */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 单个题目卡片 */
.question-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-main);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: var(--transition-smooth);
    animation: fadeInUp 0.5s ease forwards;
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(127, 90, 240, 0.2);
}

/* 题卡头部信息 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.choice {
    background: rgba(127, 90, 240, 0.12);
    color: var(--primary-color);
    border: 1px solid rgba(127, 90, 240, 0.2);
}

.badge.fill {
    background: rgba(44, 182, 125, 0.12);
    color: var(--secondary-color);
    border: 1px solid rgba(44, 182, 125, 0.2);
}

.badge.calculate {
    background: rgba(255, 142, 60, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(255, 142, 60, 0.2);
}

.q-number {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* 题干文本 */
.q-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
}

/* ==========================================
   选择题选项区域 (Options)
   ========================================== */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
}

.option-btn {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(127, 90, 240, 0.3);
    color: var(--text-primary);
}

/* 选项选择状态样式 */
.option-btn.selected {
    border-color: var(--primary-color);
    background: rgba(127, 90, 240, 0.1);
    color: var(--primary-color);
}

.option-btn.correct {
    border-color: var(--secondary-color);
    background: rgba(44, 182, 125, 0.15);
    color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(44, 182, 125, 0.1);
}

.option-btn.incorrect {
    border-color: var(--error-color);
    background: rgba(229, 62, 62, 0.15);
    color: var(--error-color);
}

/* ==========================================
   解析控制展示 (Analysis Drawer)
   ========================================== */
.action-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.action-btn.show-ans {
    background: var(--primary-color);
    color: #fff;
    border: none;
}

.action-btn.show-ans:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 15px rgba(127, 90, 240, 0.4);
}

/* 解析抽屉区域 */
.analysis-drawer {
    display: none;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 14px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary-color);
    margin-top: 0.5rem;
    line-height: 1.7;
    animation: slideDown 0.3s ease forwards;
}

.analysis-drawer p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.analysis-drawer strong {
    color: var(--text-primary);
}

.analysis-drawer .ans-block {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 网页中的公式样式微调 */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
}

/* ==========================================
   动画定义
   ========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 底部复习进度说明 */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

/* ==========================================
   新增模拟考试结算明细与解析样式
   ========================================== */
.exam-section-report {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1rem;
}

[data-theme="light"] .exam-section-report {
    background: rgba(255, 255, 255, 0.4);
}

.report-section-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.exam-detail-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.exam-detail-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: fadeInUp 0.4s ease forwards;
}

[data-theme="light"] .exam-detail-item {
    background: rgba(255, 255, 255, 0.6);
}

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

.exam-item-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

.status-badge.correct-badge {
    background: rgba(44, 182, 125, 0.12);
    color: var(--secondary-color);
    border: 1px solid rgba(44, 182, 125, 0.2);
}

.status-badge.incorrect-badge {
    background: rgba(229, 62, 62, 0.12);
    color: var(--error-color);
    border: 1px solid rgba(229, 62, 62, 0.2);
}

.exam-detail-qtext {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.exam-detail-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--glass-border);
    padding-top: 0.5rem;
}

.ans-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

[data-theme="light"] .ans-code {
    background: rgba(0, 0, 0, 0.04);
}

.exam-ans-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
}

.exam-analysis-drawer {
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    border-left: 4px solid var(--primary-color);
    animation: slideDown 0.3s ease forwards;
    color: var(--text-primary);
}

[data-theme="light"] .exam-analysis-drawer {
    background: rgba(0, 0, 0, 0.02);
}

