/* ============================================
   小学奥数自适应学习系统 - 样式表
   ============================================ */

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --border: #E2E8F0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 导航栏 ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.navbar-brand .emoji { font-size: 28px; }

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-link:hover { background: rgba(255,255,255,0.25); }
.nav-link.active { background: white; color: var(--primary); font-weight: 600; }

/* ===== 主容器 ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== 页面视图切换 ===== */
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

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

/* ===== 卡片样式 ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 题目卡片 ===== */
.question-card {
    position: relative;
    overflow: hidden;
}

.question-number {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.question-text {
    font-size: 17px;
    font-weight: 500;
    line-height: 1.7;
    padding-right: 50px;
    margin-bottom: 20px;
    color: var(--text);
}

.question-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #EEF2FF;
    color: var(--primary);
}

.tag.difficulty-1 { background: #D1FAE5; color: #059669; }
.tag.difficulty-2 { background: #FEF3C7; color: #D97706; }
.tag.difficulty-3 { background: #FEE2E2; color: #DC2626; }
.tag.difficulty-4 { background: #EDE9FE; color: #7C3AED; }
.tag.category-tag { background: #F1F5F9; color: #475569; }

/* ===== 选项按钮 ===== */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.option-btn {
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-size: 15px;
    text-align: left;
    transition: all 0.2s;
    position: relative;
}

.option-btn:hover:not(.disabled) {
    border-color: var(--primary-light);
    background: #EEF2FF;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.option-btn.selected {
    border-color: var(--primary);
    background: #EEF2FF;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.option-btn.correct {
    border-color: var(--success);
    background: #ECFDF5 !important;
    animation: pulse-success 0.5s;
}

.option-btn.wrong {
    border-color: var(--danger);
    background: #FEF2F2 !important;
    animation: shake 0.4s;
}

.option-btn.disabled { pointer-events: none; opacity: 0.7; }

.option-label {
    font-weight: 700;
    color: var(--primary);
    margin-right: 8px;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== 提交按钮 ===== */
.submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.submit-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79,70,229,0.4); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 结果反馈 ===== */
.result-panel {
    display: none;
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius-sm);
    animation: slideUp 0.3s ease;
}

.result-panel.show { display: block; }

.result-correct {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    border-left: 4px solid var(--success);
}

.result-wrong {
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
    border-left: 4px solid var(--danger);
}

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

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-icon { font-size: 28px; }

.explanation {
    background: white;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-line;
}

.mastery-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px;
}

.mastery-badge.level-0 { background: #F1F5F9; color: #64748B; }
.mastery-badge.level-1 { background: #DBEAFE; color: #2563EB; }
.mastery-badge.level-2 { background: #FEF3C7; color: #D97706; }
.mastery-badge.level-3 { background: #D1FAE5; color: #059669; }
.mastery-badge.level-4 { background: #ECFDF5; color: #047857; }

.streak-text {
    color: var(--danger);
    font-weight: 600;
    margin-top: 8px;
    font-size: 14px;
}

/* ===== 进度条 ===== */
.progress-bar-container {
    background: #E2E8F0;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 999px;
    transition: width 0.5s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-light);
}

/* ===== 仪表盘统计网格 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--primary);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

.stat-card.success { border-top-color: var(--success); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning { border-top-color: var(--warning); }
.stat-card.warning .stat-value { color: var(--warning); }

/* ===== 知识点热力图 ===== */
.knowledge-map {
    display: grid;
    gap: 12px;
}

.kp-category {
    background: white;
    border-radius: var(--radius-sm);
    padding: 16px;
    box-shadow: var(--shadow);
}

.kp-category-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.kp-item:hover { background: #F8FAFC; }

.kp-name { font-size: 14px; font-weight: 500; }

.kp-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-unknown { background: #CBD5E1; }
.dot-learning { background: var(--warning); animation: blink 1.5s infinite; }
.dot-practicing { background: var(--primary-light); }
.dot-mastered { background: var(--success); }
.dot-review { background: var(--danger); animation: blink 1s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }

.kp-bar {
    width: 60px;
    height: 6px;
    background: #E2E8F0;
    border-radius: 3px;
    overflow: hidden;
}

.kp-bar-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.5s;
}

/* ===== 建议列表 ===== */
.suggestion-list {
    list-style: none;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== 薄弱点列表 ===== */
.weak-list {
    list-style: none;
}

.weak-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #FEF2F2;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--danger);
}

.weak-name { font-weight: 600; font-size: 14px; }
.weak-accuracy {
    font-size: 13px;
    color: var(--danger);
    font-weight: 600;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-emoji { font-size: 64px; margin-bottom: 16px; }

.empty-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-desc { font-size: 14px; max-width: 400px; margin: 0 auto; }

/* ===== 按钮（通用） ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }

.btn-group { display: flex; gap: 8px; margin-top: 16px; }

/* ===== 今日进度概览 ===== */
.today-overview {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    align-items: center;
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.today-circle {
    width: 100px;
    height: 100px;
    position: relative;
}

.today-circle svg { transform: rotate(-90deg); }
.today-circle .circle-bg { fill: none; stroke: #C7D2FE; stroke-width: 8; }
.today-circle .circle-fill { fill: none; stroke: var(--primary); stroke-width: 8; 
    stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.today-circle .today-num {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.today-info h3 { font-size: 18px; margin-bottom: 4px; }
.today-info p { font-size: 14px; color: var(--text-light); margin-bottom: 2px; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .container { padding: 16px; }
    .options-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .nav-links { order: 3; width: 100%; justify-content: center; }
    .today-overview { grid-template-columns: 1fr; text-align: center; }
    .question-text { padding-right: 0; }
    .question-number { position: relative; top: auto; right: auto; display: inline-block; margin-bottom: 12px; }
}
