/* ===== 高中数学快速测评系统 — 统一样式 ===== */

:root {
  --bg: #ffffff;
  --text: #2d2d2d;
  --text-light: #666666;
  --green: #4CAF50;
  --green-dark: #2E7D32;
  --green-bg: #E8F5E9;
  --red: #e74c3c;
  --red-bg: #FDEDEC;
  --yellow: #f39c12;
  --yellow-bg: #FEF9E7;
  --divider: #e8e8e8;
  --border: #d0d0d0;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --max-width: 720px;
}

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

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===== Typography ===== */
h1 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 16px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 40px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.btn-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.btn-outline {
  background: var(--bg);
  color: var(--green);
  border-color: var(--green);
}

.btn-outline:hover {
  background: var(--green-bg);
}

.btn-lg {
  min-height: 56px;
  padding: 16px 48px;
  font-size: 18px;
  width: 100%;
  max-width: 320px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.input-text {
  width: 100%;
  max-width: 320px;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s;
}

.input-text:focus {
  outline: none;
  border-color: var(--green);
}

/* ===== Grade Selector ===== */
.grade-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.grade-btn {
  flex: 1;
  min-width: 100px;
  max-width: 140px;
  min-height: 52px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.grade-btn:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.grade-btn.selected {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* ===== Progress Bar ===== */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.progress-label {
  font-size: 14px;
  color: var(--text-light);
  white-space: nowrap;
  font-weight: 500;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ===== Quiz ===== */
.quiz-card {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.question-text {
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 28px;
  color: var(--text);
}

.question-image {
  max-width: 100%;
  margin: 0 auto 20px;
  border-radius: 4px;
  display: block;
  border: 1px solid var(--divider);
}

.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--divider);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 16px;
  line-height: 1.6;
}

.option-item:hover {
  border-color: var(--green);
  background: #FAFFFA;
}

.option-item.selected {
  border-color: var(--green);
  background: var(--green-bg);
  border-left: 4px solid var(--green);
  padding-left: 14px;
}

.option-label {
  font-weight: 600;
  color: var(--green-dark);
  min-width: 24px;
}

.option-text {
  flex: 1;
}

.quiz-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 8px;
}

.quiz-actions .btn-lg {
  max-width: 240px;
}

/* ===== Report ===== */
.report-header {
  text-align: center;
  margin-bottom: 32px;
}

.report-header h1 {
  margin-bottom: 4px;
}

.report-date {
  font-size: 14px;
  color: var(--text-light);
}

.chart-container {
  max-width: 100%;
  margin: 0 auto 40px;
  overflow-x: auto;
}

/* Module summary table */
.module-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 40px;
}

.module-table th,
.module-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--divider);
}

.module-table th {
  color: var(--text-light);
  font-weight: 500;
  font-size: 13px;
}

.module-table .status-icon {
  font-size: 18px;
  text-align: center;
  width: 40px;
}

.module-table .score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-table .score-bar {
  flex: 1;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
  max-width: 120px;
}

.module-table .score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.module-table .score-fill.green { background: var(--green); }
.module-table .score-fill.yellow { background: var(--yellow); }
.module-table .score-fill.red { background: var(--red); }

.module-table .score-text {
  font-weight: 600;
  font-size: 14px;
  min-width: 42px;
  text-align: right;
}

/* Analysis section */
.analysis-section {
  margin-bottom: 40px;
}

.analysis-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.analysis-item {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 14px;
  border-left: 4px solid var(--divider);
}

.analysis-item.weak { border-left-color: var(--red); }
.analysis-item.caution { border-left-color: var(--yellow); }
.analysis-item.good { border-left-color: var(--green); }

.analysis-item .module-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.analysis-item .module-score {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.analysis-item .module-detail {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}

.analysis-item .module-detail .problem {
  color: var(--red);
}

.analysis-item .module-detail .suggestion {
  color: var(--green-dark);
}

/* History comparison */
.history-section {
  background: #FAFAFA;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 40px;
}

.history-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 8px 10px;
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid var(--divider);
}

.history-table th {
  font-weight: 500;
  color: var(--text-light);
}

.history-table .improve { color: var(--green); }
.history-table .decline { color: var(--red); }
.history-table .same { color: var(--text-light); }

/* Print button */
.print-bar {
  text-align: center;
  padding: 20px 0 40px;
}

/* ===== Start Page ===== */
.start-card {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.start-card .form-group {
  text-align: left;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.start-card .btn-primary {
  margin-top: 8px;
}

/* ===== Footer note ===== */
.footer-note {
  text-align: center;
  font-size: 13px;
  color: #aaa;
  margin-top: 32px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .container {
    padding: 20px 16px;
  }

  h1 {
    font-size: 22px;
  }

  .question-text {
    font-size: 16px;
  }

  .option-item {
    font-size: 15px;
    padding: 12px 14px;
  }

  .btn-lg {
    max-width: 100%;
  }

  .quiz-card {
    padding: 24px 18px;
  }

  .grade-btn {
    min-width: 80px;
    font-size: 15px;
  }

  .chart-container {
    max-width: 100%;
  }
}

/* ===== Print styles ===== */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .print-bar,
  .btn,
  .grade-btn,
  .progress-bar-wrap {
    display: none !important;
  }

  .quiz-card,
  .analysis-item,
  .history-section {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }

  .chart-container {
    max-width: 350px;
    margin: 0 auto 24px;
  }
}
