/* css/style.css - 经济师题库 H5 版样式 */

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #4A90D9;
  --primary-light: #E8F2FC;
  --primary-dark: #357ABD;
  --correct: #52C41A;
  --correct-bg: #F0FBEB;
  --wrong: #FF4D4F;
  --wrong-bg: #FFF2F0;
  --text: #333333;
  --text-secondary: #888888;
  --text-light: #BFBFBF;
  --bg: #F5F6F8;
  --card-bg: #FFFFFF;
  --border: #E8E8E8;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

#app {
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ===== Views ===== */
.view {
  display: none;
  padding: 16px;
  padding-bottom: 80px;
}
.view.active {
  display: block;
}

/* ===== Page Header ===== */
.page-header {
  padding: 12px 0 20px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.page-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Stats Cards ===== */
.stats-cards {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== Action Cards ===== */
.action-section {
  margin-bottom: 24px;
}
.action-card {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}
.action-card:active {
  transform: scale(0.98);
}
.action-card.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.action-card.primary .action-title,
.action-card.primary .action-desc {
  color: #fff;
}
.action-icon {
  font-size: 28px;
  margin-right: 14px;
}
.action-text {
  flex: 1;
}
.action-title {
  font-size: 16px;
  font-weight: 600;
}
.action-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.action-card.primary .action-desc {
  color: rgba(255,255,255,0.8);
}
.action-arrow {
  font-size: 24px;
  color: var(--text-light);
}
.action-card.primary .action-arrow {
  color: rgba(255,255,255,0.6);
}

/* ===== Tips Section ===== */
.tips-section {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.tip-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===== Chapter List ===== */
.chapter-list {
  margin-bottom: 20px;
}
.subject-group-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  padding: 16px 4px 8px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 10px;
  margin-top: 8px;
}
.chapter-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}
.chapter-item:active {
  transform: scale(0.98);
}
.chapter-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.chapter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chapter-count {
  font-size: 13px;
  color: var(--text-secondary);
}
.chapter-accuracy {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--bg);
}
.chapter-accuracy.good {
  color: var(--correct);
  background: var(--correct-bg);
}
.chapter-accuracy.mid {
  color: #FA8C16;
  background: #FFF7E6;
}
.chapter-accuracy.low {
  color: var(--wrong);
  background: var(--wrong-bg);
}

/* ===== Practice Page ===== */
.practice-content {
  padding: 0;
}
.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 12px;
}
.practice-back {
  font-size: 16px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 8px;
}
.practice-title {
  font-size: 16px;
  font-weight: 600;
}
.practice-progress-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.question-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.question-type {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 12px;
}
.question-text {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 20px;
}

/* ===== Options ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-item {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.option-item:active {
  transform: scale(0.98);
}
.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.option-item.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
}
.option-item.correct-missed {
  border-color: var(--correct);
  border-style: dashed;
  background: var(--correct-bg);
}
.option-item.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
}
.option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
}
.option-item.selected .option-label {
  background: var(--primary);
  color: #fff;
}
.option-item.correct .option-label {
  background: var(--correct);
  color: #fff;
}
.option-item.correct-missed .option-label {
  background: var(--correct);
  color: #fff;
}
.option-item.wrong .option-label {
  background: var(--wrong);
  color: #fff;
}
.option-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.5;
}
.option-icon {
  margin-left: 8px;
  font-size: 18px;
  font-weight: 700;
}
.option-icon.correct { color: var(--correct); }
.option-icon.wrong { color: var(--wrong); }

/* ===== Analysis ===== */
.analysis-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.analysis-result {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.analysis-result.correct {
  color: var(--correct);
}
.analysis-result.wrong {
  color: var(--wrong);
}
.analysis-answer {
  font-size: 15px;
  font-weight: 600;
  color: var(--correct);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--correct-bg);
  border-radius: 8px;
}
.analysis-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.analysis-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

/* ===== Buttons ===== */
.practice-actions {
  padding: 0 0 20px;
}
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:active {
  opacity: 0.85;
}
.btn-secondary {
  width: 100%;
  padding: 14px;
  background: var(--bg);
  color: var(--text);
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}
.btn-danger {
  width: 100%;
  padding: 12px;
  background: #fff;
  color: var(--wrong);
  border: 1px solid var(--wrong);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== Finish Screen ===== */
.practice-finish {
  text-align: center;
  padding: 60px 20px;
}
.finish-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.finish-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.finish-accuracy {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.finish-detail {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}
.finish-actions {
  padding: 0 20px;
}

/* ===== Review Page ===== */
.review-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.review-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.review-count {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  text-align: center;
}
.review-count-num {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
}
.review-count-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Stats Page ===== */
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 12px;
}
.chapter-progress-list {
  margin-bottom: 20px;
}
.chapter-progress-item {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.cp-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.cp-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.cp-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.cp-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}
.danger-zone {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== TabBar ===== */
#tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0 6px;
  cursor: pointer;
  transition: color 0.15s;
}
.tab-icon {
  font-size: 22px;
  line-height: 1;
}
.tab-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.tab-item.active .tab-label {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  display: none;
  max-width: 80%;
  text-align: center;
}
.toast.toast-show {
  animation: toastFade 0.3s ease;
}
@keyframes toastFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Responsive ===== */
@media (min-width: 481px) {
  body {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
