/* ==========================================================================
   Practice Test Styles
   ========================================================================== */

/* Test Selection Page */
.test-selection {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.test-selection h1 {
  text-align: center;
  margin-bottom: var(--space-2);
}

.test-selection .lead {
  text-align: center;
  margin-bottom: var(--space-8);
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

.test-card {
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.test-card:hover {
  border-color: var(--amber-400);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.test-card h3 {
  margin-bottom: var(--space-3);
  color: var(--color-heading);
}

.test-card-info {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.test-card-score {
  background: var(--sage-100);
  color: var(--sage-700);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

/* Test History */
.test-history {
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.test-history h2 {
  margin-bottom: var(--space-4);
  font-size: var(--text-xl);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  border-radius: var(--radius-md);
}

.history-test {
  font-weight: 600;
}

.history-score {
  font-weight: 700;
  color: var(--sage-600);
}

.history-date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Practice Test Header */
.practice-test-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.test-info h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-2xl);
}

.test-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.question-counter {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.domain-badge {
  background: var(--slate-100);
  color: var(--slate-700);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Timer */
.test-timer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--slate-100);
  border-radius: var(--radius-lg);
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-mono);
}

.test-timer .timer-icon {
  width: 24px;
  height: 24px;
}

.test-timer.warning {
  background: var(--amber-100);
  color: var(--amber-800);
}

.test-timer.critical {
  background: var(--rose-100);
  color: var(--rose-600);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-500), var(--amber-400));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Question Card */
.question-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
}

.question-text {
  font-size: var(--text-lg);
  line-height: 1.7;
  margin-bottom: var(--space-6);
  color: var(--color-heading);
}

/* Answer Options */
.answer-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.answer-option:hover {
  border-color: var(--amber-300);
  background: var(--amber-50);
}

.answer-option.selected {
  border-color: var(--amber-500);
  background: var(--amber-100);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  font-weight: 700;
  flex-shrink: 0;
}

.answer-option.selected .option-letter {
  background: var(--amber-500);
  color: white;
}

.option-text {
  padding-top: var(--space-1);
  line-height: 1.5;
}

/* Test Navigation */
.test-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.question-dots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: center;
}

.question-dot {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.question-dot:hover {
  border-color: var(--amber-400);
}

.question-dot.current {
  background: var(--amber-500);
  border-color: var(--amber-500);
  color: white;
}

.question-dot.answered {
  background: var(--sage-100);
  border-color: var(--sage-300);
  color: var(--sage-700);
}

.question-dot.answered.current {
  background: var(--amber-500);
  border-color: var(--amber-500);
  color: white;
}

/* Results Page */
.results-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.results-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.results-header h2 {
  margin-bottom: var(--space-2);
}

.time-expired-notice {
  color: var(--rose-600);
  font-weight: 600;
}

.score-display {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-8);
}

.score-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--slate-100);
  border: 6px solid var(--slate-300);
}

.score-circle.excellent {
  background: var(--sage-100);
  border-color: var(--sage-400);
}

.score-circle.good {
  background: var(--amber-100);
  border-color: var(--amber-400);
}

.score-circle.needs-work {
  background: var(--rose-100);
  border-color: var(--rose-400);
}

.score-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1;
}

.score-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-heading);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Domain Breakdown */
.domain-breakdown {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}

.domain-breakdown h3 {
  margin-bottom: var(--space-5);
}

.domain-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.domain-bar-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.domain-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.domain-name {
  font-weight: 600;
}

.domain-score {
  color: var(--color-text-muted);
}

.progress-bar__fill.excellent {
  background: linear-gradient(90deg, var(--sage-500), var(--sage-400));
}

.progress-bar__fill.good {
  background: linear-gradient(90deg, var(--amber-500), var(--amber-400));
}

.progress-bar__fill.needs-work {
  background: linear-gradient(90deg, var(--rose-500), var(--rose-400));
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

/* Review Section */
.review-section {
  margin-top: var(--space-8);
}

.review-section h3 {
  margin-bottom: var(--space-6);
  text-align: center;
}

.review-question {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.review-question.correct {
  border-left: 4px solid var(--sage-500);
}

.review-question.incorrect {
  border-left: 4px solid var(--rose-500);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.review-number {
  font-weight: 600;
  color: var(--color-text-muted);
}

.review-status {
  font-weight: 600;
}

.review-question.correct .review-status {
  color: var(--sage-600);
}

.review-question.incorrect .review-status {
  color: var(--rose-600);
}

.review-text {
  font-size: var(--text-base);
  margin-bottom: var(--space-4);
}

.review-answers {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.review-option {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.review-option.correct-answer {
  background: var(--sage-100);
  color: var(--sage-800);
  font-weight: 600;
}

.review-option.wrong-answer {
  background: var(--rose-100);
  color: var(--rose-800);
}

.review-explanation {
  background: var(--slate-50);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Dark Mode */
[data-theme="dark"] .test-card {
  background: var(--color-bg-elevated);
}

[data-theme="dark"] .test-timer {
  background: var(--slate-800);
}

[data-theme="dark"] .question-card {
  background: var(--color-bg-elevated);
}

[data-theme="dark"] .answer-option {
  background: var(--slate-800);
}

[data-theme="dark"] .answer-option:hover {
  background: var(--slate-700);
}

[data-theme="dark"] .answer-option.selected {
  background: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .option-letter {
  background: var(--slate-700);
}

[data-theme="dark"] .question-dot {
  background: var(--slate-800);
}

[data-theme="dark"] .score-circle {
  background: var(--slate-800);
  border-color: var(--slate-600);
}

[data-theme="dark"] .domain-breakdown,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .review-question {
  background: var(--slate-800);
}

[data-theme="dark"] .review-explanation {
  background: var(--slate-700);
}

/* Responsive */
@media (max-width: 640px) {
  .practice-test-header {
    flex-direction: column;
    align-items: stretch;
  }

  .test-timer {
    justify-content: center;
  }

  .question-dots {
    display: none;
  }

  .test-navigation {
    justify-content: center;
  }

  .results-stats {
    grid-template-columns: 1fr;
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Dark Mode Overrides
   ========================================================================== */
[data-theme="dark"] .test-card {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .test-card:hover {
  border-color: var(--amber-400);
  background: var(--color-surface);
}

[data-theme="dark"] .question-card {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .answer-option {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .answer-option:hover {
  border-color: var(--amber-400);
  background: rgba(251, 191, 36, 0.1);
}

[data-theme="dark"] .answer-option.selected {
  border-color: var(--amber-500);
  background: rgba(251, 191, 36, 0.15);
}

[data-theme="dark"] .option-letter {
  background: var(--color-surface);
  color: var(--color-text);
}

[data-theme="dark"] .answer-option.selected .option-letter {
  background: var(--amber-500);
  color: #111827;
}

[data-theme="dark"] .domain-badge {
  background: var(--color-surface);
  color: var(--color-text);
}

[data-theme="dark"] .test-timer {
  background: var(--color-surface);
  color: var(--color-text);
}

[data-theme="dark"] .question-dot {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .question-dot.answered {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--sage-600);
  color: var(--sage-400);
}

[data-theme="dark"] .progress-bar {
  background: var(--color-surface);
}

[data-theme="dark"] .test-history {
  background: var(--color-bg-alt);
}

[data-theme="dark"] .history-item {
  background: var(--color-bg-elevated);
}

[data-theme="dark"] .results-card {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .stat-card {
  background: var(--color-bg-elevated);
}

[data-theme="dark"] .domain-item {
  background: var(--color-bg-elevated);
}

[data-theme="dark"] .review-item {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}
