/* ==========================================================================
   aptitude.css — Aptitude Practice Module (unique styles only)
   Depends on: main.css (btn, faq-*), practice.css (mod-*, quick-stats-bar,
               qstat-*, resume-btn, practice-card-icon, practice-premium-badge)
   ========================================================================== */

/* ── PAGE WRAPPER ─────────────────────────────────────────────────────────── */
.aptitude-main {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-16);
}

/* ── SCREENS (show/hide) ──────────────────────────────────────────────────── */
.apt-screen { display: none; }
.apt-screen.active { display: block; }

/* ── RESUME BANNER (wrapper only — button uses .resume-btn from practice.css) */
.apt-resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.apt-resume-banner-text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-main);
}
.apt-resume-banner-text svg { width: 18px; height: 18px; color: #6366f1; flex-shrink: 0; }
.apt-resume-banner-text strong { font-weight: var(--fw-semibold); }

/* ── SECTION LABEL ────────────────────────────────────────────────────────── */
.apt-section-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

/* ── TOPIC GRID ───────────────────────────────────────────────────────────── */
.apt-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.apt-topic-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-section);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  text-align: center;
  position: relative;
}
.apt-topic-btn:hover {
  border-color: var(--accent-primary);
  background: var(--admin-hover-bg);
  transform: translateY(-1px);
}
.apt-topic-btn.selected {
  border-color: var(--accent-primary);
  background: var(--admin-active-bg);
}

/* Topic icon — smaller than practice-card-icon (40px vs 48px) */
.apt-topic-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.apt-topic-icon svg { width: 20px; height: 20px; color: #fff; }

.apt-topic-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  line-height: 1.3;
}

/* Premium badge — icon only, no text (text overflows small topic cards) */
.apt-topic-btn .practice-premium-badge {
  top: 6px;
  right: 6px;
  padding: 4px 5px;
}
.apt-topic-btn .practice-premium-badge span { display: none; }

/* Mix Mode icon — brand gradient (no mod-* equivalent) */
.apt-icon-mix { background: var(--accent-gradient); }

/* ── CONTROLS ROW ─────────────────────────────────────────────────────────── */
.apt-controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
@media (max-width: 520px) {
  .apt-controls-row { grid-template-columns: 1fr; gap: var(--space-4); }
}
.apt-control-group { display: flex; flex-direction: column; gap: var(--space-2); }
.apt-control-group label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── PILL SELECTORS (difficulty / count) ──────────────────────────────────── */
.apt-pill-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.apt-pill {
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--border-subtle);
  border-radius: 100px;
  background: var(--bg-section);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.apt-pill:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.apt-pill.selected { border-color: var(--accent-primary); background: var(--accent-primary); color: #fff; }

/* ── START BUTTON (extends .btn.btn-gradient from main.css) ───────────────── */
.apt-start-btn {
  width: 100%;
  margin-top: var(--space-2);
  border-radius: var(--radius-lg);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}
.apt-start-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ── QUIZ SCREEN ──────────────────────────────────────────────────────────── */
.apt-quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
  flex-wrap: wrap;
}
.apt-progress-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
}
.apt-timer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  padding: var(--space-1) var(--space-3);
}
.apt-timer svg { width: 14px; height: 14px; }
.apt-timer.apt-timer-warn { color: #dc2626; border-color: rgba(220, 38, 38, 0.3); }

.apt-progress-bar-wrap {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 100px;
  margin-bottom: var(--space-5);
  overflow: hidden;
}
.apt-progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent-gradient);
  transition: width 0.3s ease;
}

/* Question card */
.apt-question-card {
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}
.apt-question-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.apt-topic-badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(0, 126, 255, 0.1);
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.apt-question-text {
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
  color: var(--text-main);
  line-height: var(--lh-relaxed);
}

/* Options */
.apt-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
@media (max-width: 480px) { .apt-options-grid { grid-template-columns: 1fr; } }

.apt-option-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-section);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  text-align: left;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--text-main);
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}
.apt-option-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  background: rgba(0, 126, 255, 0.04);
}
.apt-option-btn:disabled { cursor: default; }
.apt-option-btn.correct { border-color: var(--color-success); background: var(--color-success-bg); color: var(--color-success); }
.apt-option-btn.wrong   { border-color: var(--color-error);   background: var(--color-error-bg);   color: var(--color-error); }

.apt-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-section-soft);
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.apt-option-btn.correct .apt-option-letter { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.apt-option-btn.wrong   .apt-option-letter { background: var(--color-error);   border-color: var(--color-error);   color: #fff; }

/* Solution panel */
.apt-solution-panel {
  background: var(--bg-section-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-4);
  display: none;
}
.apt-solution-panel.visible { display: block; }

.apt-solution-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.apt-solution-toggle svg { width: 16px; height: 16px; color: var(--text-soft); transition: transform 0.2s; }
.apt-solution-toggle.open svg { transform: rotate(180deg); }

.apt-solution-body { padding: 0 var(--space-4) var(--space-4); display: none; }
.apt-solution-body.open { display: block; }

.apt-solution-steps { list-style: none; margin: 0; padding: 0; }
.apt-solution-step {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
  color: var(--text-main);
  line-height: var(--lh-relaxed);
}
.apt-solution-step:last-child { border-bottom: none; }
.apt-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Quiz actions */
.apt-quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.apt-skip-btn {
  background: none;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.apt-skip-btn:hover { border-color: var(--text-soft); color: var(--text-main); }
.apt-skip-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.apt-next-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background 0.15s;
}
.apt-next-btn:hover { background: var(--accent-primary-hover); }
.apt-next-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.apt-next-btn svg { width: 14px; height: 14px; }

.apt-pause-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.apt-pause-btn:hover { color: var(--text-main); }
.apt-pause-btn svg { width: 14px; height: 14px; }

/* ── RESULT SCREEN ────────────────────────────────────────────────────────── */
.apt-result-card {
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  margin-bottom: var(--space-6);
}
.apt-result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
}
.apt-result-icon svg { width: 32px; height: 32px; color: #fff; }
.apt-result-icon.excellent { background: var(--gradient-green); }
.apt-result-icon.good      { background: var(--gradient-blue); }
.apt-result-icon.average   { background: var(--gradient-yellow); }
.apt-result-icon.low       { background: var(--gradient-orange); }

.apt-result-score {
  font-size: 3.5rem;
  font-weight: var(--fw-black);
  color: var(--text-main);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.apt-result-label { font-size: var(--fs-base); color: var(--text-soft); margin-bottom: var(--space-6); }

.apt-result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  max-width: 480px;
  margin: 0 auto;
}
.apt-stat-box {
  background: var(--bg-section-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-3);
}
.apt-stat-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--text-main); display: block; }
.apt-stat-value.c-green  { color: var(--color-success); }
.apt-stat-value.c-red    { color: var(--color-error); }
.apt-stat-value.c-yellow { color: var(--color-warning); }
.apt-stat-name { font-size: var(--fs-xs); color: var(--text-soft); margin-top: var(--space-1); display: block; }

/* Result action buttons (use .btn.btn-gradient / .btn.btn-outline from main.css) */
.apt-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-bottom: var(--space-6);
}

.apt-save-status { text-align: center; font-size: var(--fs-sm); color: var(--text-soft); margin-bottom: var(--space-4); }
.apt-save-status.saved { color: var(--color-success); }
.apt-save-status.error { color: var(--color-error); }

/* Review list */
.apt-review-section { margin-top: var(--space-4); }
.apt-review-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-main); margin-bottom: var(--space-4); }
.apt-review-list { display: flex; flex-direction: column; gap: var(--space-3); }

.apt-review-item {
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border-left: 3px solid var(--border-subtle);
}
.apt-review-item.correct  { border-left-color: var(--color-success); }
.apt-review-item.wrong    { border-left-color: var(--color-error); }
.apt-review-item.skipped  { border-left-color: var(--color-warning); }

.apt-review-q { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-main); margin-bottom: var(--space-2); line-height: var(--lh-relaxed); }
.apt-review-ans-row { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--fs-xs); }
.apt-review-correct-ans   { color: var(--color-success); font-weight: var(--fw-semibold); }
.apt-review-your-ans      { color: var(--color-error);   font-weight: var(--fw-semibold); }
.apt-review-skipped-label { color: var(--color-warning); font-weight: var(--fw-semibold); }
.apt-review-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 2px 8px;
  border-radius: 100px;
  float: right;
}
.apt-review-status-chip.correct { background: var(--color-success-bg); color: var(--color-success); }
.apt-review-status-chip.wrong   { background: var(--color-error-bg);   color: var(--color-error); }
.apt-review-status-chip.skipped { background: var(--color-warning-bg); color: var(--color-warning-text); }
.apt-review-status-chip svg { width: 11px; height: 11px; }

/* ── SEO / INFO SECTION ───────────────────────────────────────────────────── */
.apt-info-section {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
}
.apt-info-section h2 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--text-main); margin-bottom: var(--space-3); }
.apt-info-section p  { font-size: var(--fs-base); color: var(--text-soft); line-height: var(--lh-relaxed); margin-bottom: var(--space-4); }

.apt-topic-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
  margin: var(--space-5) 0;
}
.apt-topic-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-main);
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  transition: border-color 0.15s;
  font-weight: var(--fw-medium);
}
.apt-topic-list-item:hover { border-color: var(--accent-primary); }
.apt-topic-list-item svg { width: 14px; height: 14px; color: var(--accent-primary); flex-shrink: 0; }

/* ── PREMIUM WALL ─────────────────────────────────────────────────────────── */
.apt-premium-wall {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
}
.apt-premium-wall svg { width: 40px; height: 40px; color: var(--color-warning); margin-bottom: var(--space-4); }
.apt-premium-wall h3 { font-size: var(--fs-xl); font-weight: var(--fw-bold); margin-bottom: var(--space-2); }
.apt-premium-wall p  { color: var(--text-soft); margin-bottom: var(--space-5); }
.apt-premium-wall .apt-upgrade-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--accent-gradient);
  color: #fff;
  font-weight: var(--fw-semibold);
  padding: var(--space-3) var(--space-7);
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-size: var(--fs-base);
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .apt-topic-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .apt-result-card { padding: var(--space-6) var(--space-4); }
}
@media (max-width: 380px) {
  .apt-topic-grid { grid-template-columns: 1fr 1fr; }
  .apt-result-score { font-size: 2.5rem; }
}
