﻿/* ============================================================
   医护职称考试题库 —— 完整样式（所有模块优化版）
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: #f0f4f8;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

#app { width: 100%; max-width: 500px; min-height: 100vh; position: relative; }

.page { display: none; }
.page.active { display: block; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff; border-radius: 12px; padding: 20px 16px;
    margin: 10px 12px; box-shadow: 0 2px 12px rgba(0, 119, 182, 0.08);
}

/* ---------- 登录 ---------- */
.login-card { margin-top: 60px; text-align: center; }
.login-card h1 { font-size: 24px; color: #0077B6; margin-bottom: 6px; }
.subtitle { font-size: 13px; color: #666; margin-bottom: 28px; }

.form-group { text-align: left; margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.form-group input, select {
    width: 100%; padding: 12px 14px; border: 1.5px solid #dde4ed;
    border-radius: 8px; font-size: 15px; outline: none;
    transition: border-color .2s; background: #fff;
}
.form-group input:focus, select:focus { border-color: #0077B6; }

.form-actions { display: flex; gap: 12px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

.msg { margin-top: 12px; font-size: 13px; min-height: 20px; }
.msg.error { color: #d63031; }
.msg.success { color: #00b894; }

/* ---------- 按钮 ---------- */
.btn {
    padding: 12px 20px; border: none; border-radius: 8px;
    font-size: 15px; cursor: pointer; font-weight: 600;
    transition: all .2s; display: inline-flex;
    align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: #0077B6; color: #fff; }
.btn-primary:hover { background: #006494; }
.btn-primary:active { transform: scale(0.97); }
.btn-outline { background: #fff; color: #0077B6; border: 1.5px solid #0077B6; }
.btn-outline:hover { background: #e6f4fb; }
.btn-outline-white { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.5); font-size: 13px; padding: 6px 14px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 6px; }
.btn-lg { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 顶栏 ---------- */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: #0077B6; color: #fff;
}
.user-info { display: flex; align-items: center; gap: 8px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #ffd32a; color: #333; }

/* ---------- 统计条 ---------- */
.stats-bar {
    display: flex; justify-content: center; gap: 20px;
    padding: 10px 16px; background: #e6f4fb; font-size: 13px; color: #333;
    border-bottom: 1px solid #d0e6f5;
}
.stats-bar strong { color: #0077B6; font-size: 15px; }

/* ---------- Tab 导航 ---------- */
.tab-nav {
    display: flex; background: #fff; border-bottom: 2px solid #e0e7ef;
    position: sticky; top: 0; z-index: 10;
}
.tab-btn {
    flex: 1; padding: 14px 8px; border: none; background: none;
    font-size: 14px; font-weight: 600; color: #888; cursor: pointer;
    border-bottom: 3px solid transparent; transition: all .2s;
    position: relative;
}
.tab-btn.active { color: #0077B6; border-bottom-color: #0077B6; }
.tab-badge {
    position: absolute; top: 6px; right: 6px;
    background: #d63031; color: #fff; font-size: 10px;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px;
}
.tab-badge.hidden { display: none; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- 题目卡 ---------- */
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tag { font-size: 11px; padding: 2px 10px; border-radius: 10px; background: #e6f4fb; color: #0077B6; }
.q-stem { font-size: 16px; line-height: 1.7; color: #1a1a2e; margin-bottom: 20px; font-weight: 500; }

.q-options { display: flex; flex-direction: column; gap: 10px; }

/* ===== 优化后的选项按钮 ===== */
.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid #e0e7ef;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    text-align: left;
    user-select: none;
}
.option-btn:hover {
    border-color: #0077B6;
    background: #f5faff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.12);
}
.option-btn:active { transform: scale(0.98); }
.option-btn.selected {
    border-color: #0077B6;
    background: #e6f4fb;
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.12);
}
.option-letter {
    width: 32px; height: 32px; border-radius: 50%;
    background: #e6f4fb; color: #0077B6;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
    transition: all 0.2s ease;
}
.option-btn.selected .option-letter { background: #0077B6; color: #fff; }

.option-btn.correct { border-color: #28a745; background: #e6f9ed; }
.option-btn.correct .option-letter { background: #28a745; color: #fff; }
.option-btn.wrong { border-color: #d32f2f; background: #ffeaea; }
.option-btn.wrong .option-letter { background: #d32f2f; color: #fff; }

.q-actions { margin-top: 20px; }

/* ---------- 结果横幅 ---------- */
.result-banner {
    padding: 14px 16px; border-radius: 10px; font-size: 15px; font-weight: 600;
    text-align: center; margin-top: 16px;
}
.result-banner.correct { background: #d4f7e3; color: #00875a; border: 1px solid #a3e4bc; }
.result-banner.wrong { background: #ffe4e4; color: #c0392b; border: 1px solid #f5c6c6; }
.result-banner.hidden { display: none; }

/* ---------- 加载 ---------- */
.loading {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 24px; color: #666; font-size: 14px;
}
.loading.hidden { display: none; }
.spinner {
    width: 36px; height: 36px; border: 3px solid #e0e7ef;
    border-top-color: #0077B6; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 解析 ---------- */
.analysis-card { margin-top: 10px; }
.analysis-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 16px; font-weight: 600; color: #0077B6; cursor: pointer; user-select: none;
}
.arrow { font-size: 12px; transition: transform .3s; }
.analysis-card.collapsed .arrow { transform: rotate(-90deg); }
.analysis-card.collapsed .analysis-body { display: none; }
.analysis-body { margin-top: 14px; font-size: 14px; line-height: 1.8; color: #333; padding-top: 12px; border-top: 1px solid #eef2f7; }
.analysis-body h3 { font-size: 15px; color: #0077B6; margin: 12px 0 6px; }
.analysis-body table { width: 100%; border-collapse: collapse; margin: 12px 0; border-radius: 8px; overflow: hidden; }
.analysis-body th { padding: 10px 12px; background: #0077B6; color: #fff; font-weight: 600; font-size: 14px; }
.analysis-body td { padding: 8px 12px; border: 1px solid #e0e7ef; font-size: 14px; }
.analysis-body tr:nth-child(even) { background: #f5faff; }

/* ---------- 下一题 ---------- */
.next-area { padding: 0 12px 20px; margin-top: 8px; }
.next-area.hidden { display: none; }

/* ---------- 筛选面板 ---------- */
.filter-card { padding: 16px; }
.filter-row { display: flex; gap: 12px; margin-bottom: 12px; }
.filter-item { flex: 1; }
.filter-item label { display: block; font-size: 12px; color: #777; margin-bottom: 4px; }
.filter-item select { width: 100%; padding: 10px 12px; border: 1.5px solid #dde4ed; border-radius: 8px; font-size: 14px; }

/* ---------- 错题本 ---------- */
.wrong-list { padding: 0 12px; }
.wrong-item {
    background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06); cursor: pointer;
    border-left: 4px solid #d63031;
}
.wrong-item .w-stem { font-size: 15px; color: #333; margin-bottom: 8px; }
.wrong-item .w-meta { font-size: 12px; color: #999; display: flex; gap: 12px; }
.wrong-hint {
    padding: 10px 14px; background: #fff3cd; border-radius: 8px;
    font-size: 13px; color: #856404; margin-bottom: 16px;
}

/* ---------- 空状态 ---------- */
.empty-card { text-align: center; color: #999; padding: 40px 20px; }
.empty-card p { font-size: 15px; }

/* ---------- 通用 ---------- */
.hidden { display: none; }

/* ========== 轨道选择卡片 ========== */
.track-card {
    border-radius: 16px; padding: 32px 24px; margin: 12px;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 12px; user-select: none;
}
.track-card:active { transform: scale(0.98); }
.track-card.medical { background: linear-gradient(135deg, #0077B6, #00a8e8); color: #fff; }
.track-card.nursing { background: linear-gradient(135deg, #00a878, #00c896); color: #fff; }
.track-icon { font-size: 48px; }
.track-title { font-size: 22px; font-weight: 700; }
.track-desc { font-size: 13px; opacity: 0.9; }

/* ========== 级别选择卡片 ========== */
.level-card {
    background: #f8f9fa;
    border: 2px solid #e8e8e8;
    border-radius: 16px;
    padding: 20px 24px;
    margin: 8px 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    user-select: none;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.level-card:active { transform: scale(0.98); }
.level-card.selected { border-color: #0077B6; background: #e8f4fd; }
.level-title { font-size: 18px; font-weight: 600; color: #1a1a2e; }
.level-desc { font-size: 12px; color: #888; margin-top: 4px; }

/* ========== 主菜单卡片 ========== */
.menu-card {
    background: #fff; border: 2px solid #eee; border-radius: 16px;
    padding: 20px; margin: 8px 12px; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: row; justify-content: flex-start;
    align-items: center; gap: 16px; user-select: none;
}
.menu-card:active { transform: scale(0.98); }
.menu-icon {
    width: 50px; height: 50px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.menu-icon.random { background: #e8f4fd; color: #0077B6; }
.menu-icon.filter { background: #e8f8f0; color: #00a878; }
.menu-icon.exam { background: #fff3e0; color: #f57c00; }
.menu-icon.wrong { background: #ffeaea; color: #d32f2f; }
.menu-icon.profile { background: #f3e8ff; color: #7c3aed; }
.menu-text { flex: 1; }
.menu-title { font-size: 17px; font-weight: 600; color: #1a1a2e; }
.menu-desc { font-size: 12px; color: #888; margin-top: 2px; }

/* ========== 返回按钮 ========== */
.back-btn {
    background: none; border: none; font-size: 16px;
    cursor: pointer; padding: 4px 8px; color: #fff;
}
.back-btn:hover { opacity: 0.7; }

/* ========== 版本号 ========== */
.version { font-size: 11px; color: #bbb; margin-top: 20px; cursor: pointer; }

/* ========== 登录页 Logo ========== */
.logo-circle {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #0077B6, #00a8e8);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; margin: 0 auto 24px;
}

/* ========== VIP 徽章 ========== */
.vip-badge { background: #0077B6; color: #fff; border-radius: 12px; padding: 2px 10px; font-size: 11px; margin-left: 6px; }

/* ========== 备考进度卡片 ========== */
.progress-card {
    background: #f8fafc; border-radius: 12px; padding: 16px;
    margin: 10px 12px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.progress-card .p-title { font-size: 14px; font-weight: 600; color: #1a1a2e; margin-bottom: 8px; }
.progress-bar-wrap { background: #e8ecf0; border-radius: 20px; height: 24px; overflow: hidden; margin: 8px 0; }
.progress-bar-fill {
    background: linear-gradient(135deg, #0077B6, #00a8e8);
    height: 100%; border-radius: 20px; transition: width 0.4s ease;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #fff; font-weight: 600; min-width: 40px;
}
.progress-stats { display: flex; justify-content: space-between; font-size: 13px; color: #555; margin-top: 6px; }
.progress-stats strong { color: #0077B6; }
.p-today { font-size: 13px; color: #555; margin-top: 4px; }
.p-today strong { color: #0077B6; }

/* ========== 数据看板卡片 ========== */
.dash-cards { display: flex; justify-content: space-around; margin: 0 4px 16px; gap: 8px; }
.dash-card {
    background: #fff; border-radius: 14px; padding: 16px 12px;
    text-align: center; flex: 1; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s;
}
.dash-card:active { transform: scale(0.97); }
.dash-num { font-size: 22px; font-weight: 700; color: #0077B6; }
.dash-lbl { font-size: 11px; color: #888; margin-top: 4px; }

/* ========== 考试倒计时卡片 ========== */
.countdown-card {
    background: #e3f2fd; border-radius: 12px; padding: 16px;
    margin: 10px 12px; text-align: center; cursor: pointer;
    transition: transform 0.2s;
}
.countdown-card:active { transform: scale(0.98); }

/* ========== "我的"页面 ========== */
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #0077B6, #00a8e8);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: #fff; margin: 0 auto 12px;
}
.profile-info { text-align: center; padding: 8px 0; }
.profile-info .p-name { font-size: 20px; font-weight: 700; color: #1a1a2e; }
.profile-info .p-detail { font-size: 14px; color: #888; margin-top: 4px; }
.profile-setting { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid #f0f0f0; }
.profile-setting .s-label { font-size: 15px; color: #333; }
.profile-setting .s-value { font-size: 14px; color: #0077B6; cursor: pointer; }
.profile-setting .s-value:hover { text-decoration: underline; }
.btn-logout-profile {
    background: #fff; color: #d32f2f; border: 2px solid #d32f2f;
    width: 100%; margin-top: 16px; padding: 14px; border-radius: 10px;
    font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-logout-profile:hover { background: #d32f2f; color: #fff; }

/* ========== 学习报告掌握度 ========== */
.mastery-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; }
.mastery-item .m-label { width: 80px; flex-shrink: 0; color: #333; font-weight: 500; }
.mastery-item .m-bar { flex: 1; height: 8px; background: #e8ecf0; border-radius: 4px; overflow: hidden; }
.mastery-item .m-bar .m-fill { height: 100%; border-radius: 4px; transition: width 0.6s; }
.mastery-item .m-pct { width: 50px; text-align: right; font-weight: 600; font-size: 13px; }
.mastery-item .m-level { font-size: 11px; padding: 2px 6px; border-radius: 10px; color: #fff; margin-left: 6px; }
.level-weak { background: #d63031; }
.level-medium { background: #f39c12; }
.level-strong { background: #00b894; }

/* ========== 管理员后台 Tab ========== */
.admin-tab-btn {
    flex: 1; padding: 14px 20px; background: #fff;
    border: 2px solid #e0e0e0; border-radius: 12px;
    font-size: 16px; font-weight: 600; color: #888;
    cursor: pointer; transition: all 0.2s ease;
    margin: 4px; text-align: center; user-select: none;
}
.admin-tab-btn:hover { border-color: #0077B6; color: #0077B6; background: #f0f7ff; }
.admin-tab-btn.active {
    border-color: #0077B6; background: #0077B6;
    color: #fff; box-shadow: 0 4px 12px rgba(0,119,182,0.2);
}

/* ========== 题库管理表格（加强线框） ========== */
.admin-table-wrap {
    overflow-x: auto; background: #fff;
    border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-top: 12px; border: 1px solid #e0e0e0;
}
.admin-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table-wrap th {
    padding: 10px 8px; background: #f0f7ff; color: #0077B6;
    font-weight: 600; text-align: left; border: 1px solid #d0e6f5;
}
.admin-table-wrap td {
    padding: 10px 8px; border: 1px solid #e0e0e0;
    text-align: left; background: #fff;
}
.admin-table-wrap tr:nth-child(even) td { background: #fafcff; }
.admin-table-wrap tr:hover td { background: #e6f4fb; }

/* ========== 兑换码表格 ========== */
.code-table-wrap {
    overflow-x: auto; background: #fff;
    border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-top: 12px; border: 1px solid #e0e0e0;
}
.code-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.code-table-wrap th {
    padding: 10px 8px; background: #f0f7ff; color: #0077B6;
    font-weight: 600; text-align: left; border: 1px solid #d0e6f5;
}
.code-table-wrap td {
    padding: 10px 8px; border: 1px solid #e0e0e0; text-align: left;
}
.code-table-wrap tr:nth-child(even) td { background: #fafcff; }
.code-table-wrap tr:hover td { background: #e6f4fb; }
.status-used { color: #d32f2f; font-weight: 600; }
.status-unused { color: #28a745; font-weight: 600; }

/* ========== 反馈管理报告列表 ========== */
.report-item {
    padding: 14px; margin-bottom: 8px; background: #fffbeb;
    border-radius: 10px; border-left: 3px solid #f5a623; font-size: 13px;
}
.report-item .r-type { font-weight: 600; color: #d32f2f; }
.report-item .r-stem { margin: 4px 0; color: #333; }
.report-item .r-desc { color: #888; font-size: 12px; }
.report-item .r-time { color: #bbb; font-size: 11px; }

/* ========== 弹窗通用 ========== */
.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.hidden { display: none; }
.modal-content {
    background: #fff; border-radius: 16px; padding: 24px;
    width: 90%; max-width: 400px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.modal-content h3 { font-size: 18px; font-weight: 600; color: #1a1a2e; margin-bottom: 16px; }

.modal-overlay {
    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-overlay.hidden { display: none; }
.modal-box {
    background: #fff; border-radius: 16px; padding: 24px;
    width: 90%; max-width: 400px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.modal-box h3 { font-size: 18px; font-weight: 600; color: #1a1a2e; margin-bottom: 16px; }
.modal-box textarea { width: 100%; padding: 12px; border: 1px solid #dde4ed; border-radius: 12px; font-size: 14px; resize: vertical; min-height: 60px; }

/* ========== 题目反馈链接 ========== */
.report-link { font-size: 12px; color: #999; text-align: right; margin-top: 8px; cursor: pointer; }
.report-link:hover { color: #0077B6; }

/* ========== 隐私政策链接 ========== */
.privacy-link { font-size: 12px; color: #888; text-align: center; margin-top: 10px; }
.privacy-link a { color: #0077B6; text-decoration: none; }

/* ========== 解析流程图 ========== */
.flowchart { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; background: #f8f9fb; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.flow-arrow { color: #0077B6; font-size: 18px; font-weight: 700; }

@media (max-width: 400px) {
    .card { padding: 16px 12px; margin: 8px; }
    .tab-btn { font-size: 13px; }
}