/* Legacy academy.css — quiz/exam/guide styles pending migration */

/* ─── Quiz ─── */
.quiz-progress {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.quiz-progress-bar {
  flex: 1; height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; background: var(--gold);
  border-radius: 3px; transition: width 0.3s ease;
}
.quiz-progress-text { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.quiz-timer { font-size: 14px; color: var(--gold); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.quiz-timer.timer-warning { color: var(--red); animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.quiz-q-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.quiz-q-domain {
  font-size: 12px; color: var(--blue);
  background: rgba(96,165,250,0.12);
  padding: 2px 8px; border-radius: 999px;
}
.quiz-q-difficulty {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
}
.diff-junior { color: var(--green); background: rgba(74,222,128,0.12); }
.diff-mid { color: var(--orange); background: rgba(251,146,60,0.12); }
.diff-senior { color: var(--red); background: rgba(248,113,113,0.12); }

.quiz-q-text {
  font-size: var(--font-base);
  line-height: 1.7;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.quiz-q-audio {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(201,169,98,0.08);
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer; font-size: 14px;
  color: var(--gold);
  margin-bottom: 16px;
}
.quiz-q-audio:active { background: rgba(201,169,98,0.2); }

/* ─── Answer options ─── */
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: flex-start; gap: 12px;
  min-height: var(--btn-min-h);
  padding: 14px 16px;
  background: var(--bg-panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.option-btn:active { border-color: var(--gold); }
.option-key {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
}
.option-text { flex: 1; font-size: var(--font-base); line-height: 1.5; padding-top: 2px; }

/* Option states */
.option-btn.selected { border-color: var(--gold); background: rgba(201,169,98,0.08); }
.option-btn.selected .option-key { background: var(--gold); color: #020408; }
.option-btn.correct { border-color: var(--green); background: rgba(74,222,128,0.08); }
.option-btn.correct .option-key { background: var(--green); color: #020408; }
.option-btn.wrong { border-color: var(--red); background: rgba(248,113,113,0.08); }
.option-btn.wrong .option-key { background: var(--red); color: #020408; }
.option-btn.disabled { pointer-events: none; opacity: 0.7; }

/* Multi-choice: square key indicator */
.option-btn.multi .option-key { border-radius: 4px; }
/* Multi-choice: missed correct option (green dashed border) */
.option-btn.missed { border-color: var(--green); border-style: dashed; background: rgba(74,222,128,0.04); }
.option-btn.missed .option-key { background: rgba(74,222,128,0.2); color: var(--green); }

/* Multi-choice submit button */
.multi-submit-btn { margin-top: 14px; }
.multi-submit-btn.btn-disabled { opacity: 0.4; pointer-events: none; }

/* Multi-choice tag */
.quiz-q-multi-tag {
  font-size: 12px; color: var(--orange);
  background: rgba(251,146,60,0.12);
  padding: 2px 8px; border-radius: 999px;
  font-weight: 600;
}

/* Short answer tag */
.quiz-q-sa-tag {
  font-size: 12px; color: var(--blue);
  background: rgba(96,165,250,0.12);
  padding: 2px 8px; border-radius: 999px;
  font-weight: 600;
}

/* Short answer input */
.sa-textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: var(--font-base);
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.6;
}
.sa-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
.sa-textarea::placeholder { color: var(--text-muted); }
.sa-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.sa-counter { font-size: 12px; color: var(--text-muted); }
.sa-answer {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: var(--font-base);
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.6;
}
.sa-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.sa-score {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

/* True/False buttons */
.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px; font-size: var(--font-lg); font-weight: 600;
  background: var(--bg-panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ─── AI Chat ─── */
.ai-chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - 52px - 32px);
  margin: -16px; margin-top: -16px;
}
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-msg {
  display: flex; gap: 10px;
  max-width: 90%;
}
.ai-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ai-msg-bot { align-self: flex-start; }
.ai-msg-avatar {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  border-radius: 50%;
  background: var(--bg-panel);
}
.ai-msg-content { flex: 1; }
.ai-msg-text {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-msg-user .ai-msg-text {
  background: rgba(201,169,98,0.15);
  border: 1px solid var(--line-gold);
  color: var(--text-primary);
}
.ai-msg-bot .ai-msg-text {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-primary);
}

/* Sources */
.ai-sources {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.ai-sources-title {
  font-size: 12px; color: var(--blue);
  font-weight: 600; margin-bottom: 4px;
}
.ai-source-item {
  color: var(--text-secondary);
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* TTS button */
.ai-tts-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  background: rgba(201,169,98,0.08);
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  font-size: 12px; color: var(--gold);
  cursor: pointer;
}
.ai-tts-btn:active { background: rgba(201,169,98,0.2); }

/* Feedback stars */
.ai-feedback-row {
  display: flex; gap: 4px;
  margin-top: 8px;
}
.ai-star-btn {
  width: 28px; height: 28px;
  background: none; border: none;
  font-size: 16px; cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s;
}
.ai-star-btn:hover, .ai-star-btn.active { opacity: 1; }

/* Typing indicator */
.ai-typing-dots {
  display: flex; gap: 4px;
  padding: 14px;
}
.ai-typing-dots span {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input area */
.ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(2,4,8,0.95);
}
.ai-input-row {
  display: flex; gap: 8px; align-items: center;
}
.ai-input {
  flex: 1;
  min-height: var(--btn-min-h);
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-base);
  outline: none;
}
.ai-input:focus { border-color: var(--gold); }
.ai-input::placeholder { color: var(--text-muted); }
.ai-send-btn {
  min-width: 60px;
  padding: 0 16px;
}
.ai-voice-btn {
  width: 44px; height: 44px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.ai-voice-btn.recording {
  background: rgba(248,113,113,0.15);
  border-color: var(--red);
  animation: pulse-recording 1s infinite;
}
@keyframes pulse-recording {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* History items */
.ai-history-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.ai-history-q {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 4px;
}
.ai-history-a {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.ai-history-meta {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 12px; color: var(--text-muted);
}
.ai-history-stars { letter-spacing: 2px; }

/* ─── Admin Page ─── */
.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
}
.admin-btn:active {
  border-color: var(--gold);
}
.admin-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}
.admin-btn-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.admin-btn-text {
  flex: 1;
}
.admin-btn-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.admin-btn-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.admin-result {
  font-size: 12px;
  color: var(--green);
  margin-top: 4px;
}
.admin-result.error {
  color: var(--red);
}
.admin-stats {
  margin-top: 16px;
}
.admin-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.admin-stat-row .label {
  color: var(--text-muted);
}
.admin-stat-row .value {
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── Guide Page ─── */
.guide-intro {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}
.guide-section {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.guide-section[open] {
  border-color: var(--line-gold);
}
.guide-section summary {
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 2px;
}
.guide-section summary::-webkit-details-marker { display: none; }
.guide-section summary::after {
  content: '›';
  margin-left: auto;
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.guide-section[open] summary::after {
  transform: rotate(90deg);
  color: var(--gold);
}
.guide-content {
  padding: 0 16px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ─── AI Explain ─── */
.ai-explain-container { margin-top: 10px; }
.ai-explain-btn { font-size: 13px; }
.ai-explain-loading {
  text-align: center; padding: 12px;
  color: var(--gold); font-size: 13px;
}
.ai-explain-result {
  background: rgba(201,169,98,0.06);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius);
  padding: 12px; margin-top: 8px;
}
.ai-explain-header {
  font-size: 13px; font-weight: 600;
  color: var(--gold); margin-bottom: 8px;
}
.ai-explain-text {
  font-size: 14px; line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.ai-explain-sources {
  margin-top: 8px; font-size: 12px;
  color: var(--text-secondary);
}
.ai-source-tag {
  display: inline-block;
  background: rgba(96,165,250,0.1);
  color: var(--blue); padding: 1px 8px;
  border-radius: 999px; margin: 2px 4px 2px 0;
  font-size: 11px;
}
.ai-explain-error {
  color: var(--red); font-size: 13px;
  padding: 8px; text-align: center;
}

/* ─── Answer Sheet (Exam Mode) ─── */
.answer-sheet {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}
.answer-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.answer-sheet-summary {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 12px;
}
.answer-sheet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.answer-dot {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.answer-dot.unanswered {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--line);
}
.answer-dot.answered {
  background: rgba(201,169,98,0.2);
  color: var(--gold);
  border: 1px solid rgba(201,169,98,0.3);
}
.answer-dot.current {
  background: rgba(201,169,98,0.08);
  color: var(--gold);
  border: 2px solid var(--gold);
}
.answer-dot:active {
  transform: scale(0.92);
}

/* ─── Session answer detail (dashboard) ─── */
.session-answers-detail {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 8px 0;
}
.answer-detail-item {
  border-bottom: 1px solid var(--line);
}
.answer-detail-item:last-child {
  border-bottom: none;
}
.answer-detail-item summary {
  list-style: none;
}
.answer-detail-item summary::-webkit-details-marker {
  display: none;
}
