/**
 * Exam Result — Shared Styles
 * Used by ExamResultRenderer across all exam modes
 */

/* ══════════════════════════════════════
   CONTAINER
   ══════════════════════════════════════ */

.er-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.er-container.er-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Practice history modal — compact canvas review */
.er-container--history {
  max-width: none;
  margin: 0;
  padding: 0 0 16px;
}

#practiceDetailModal .er-container--history,
#historyUnifiedResultContainer.er-container {
  opacity: 1;
  transform: none;
}

#historyUnifiedResultContainer .er-review-canvas,
#practiceHistoryCanvasContainer .er-review-canvas {
  width: 100%;
  display: block;
}

#practiceHistoryCanvasContainer.er-container {
  opacity: 1;
  transform: none;
}

/* ══════════════════════════════════════
   SCORE HEADER
   ══════════════════════════════════════ */

.er-score-header {
  text-align: center;
  margin-bottom: 28px;
}

.er-trophy-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 16px;
  font-size: 32px;
  color: #fff;
  animation: er-pop-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.er-trophy-ring.er-gradient-high {
  background: linear-gradient(135deg, #22c55e, #059669);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.er-trophy-ring.er-gradient-mid {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

.er-trophy-ring.er-gradient-low {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.er-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px;
  animation: er-fade-up 0.5s ease 0.2s both;
}

.er-subtitle {
  font-size: 15px;
  color: #64748b;
  margin: 0 0 12px;
  animation: er-fade-up 0.5s ease 0.3s both;
}

.er-score {
  font-size: 48px;
  font-weight: 800;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: er-score-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.er-score.er-gradient-high {
  background-image: linear-gradient(135deg, #22c55e, #059669);
}

.er-score.er-gradient-mid {
  background-image: linear-gradient(135deg, #f59e0b, #d97706);
}

.er-score.er-gradient-low {
  background-image: linear-gradient(135deg, #ef4444, #dc2626);
}

@media (min-width: 640px) {
  .er-title { font-size: 28px; }
  .er-score { font-size: 56px; }
  .er-trophy-ring { width: 96px; height: 96px; font-size: 36px; }
}

/* ══════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════ */

.er-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
  animation: er-fade-up 0.5s ease 0.5s both;
}

@media (min-width: 768px) {
  .er-stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.er-stat {
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  transition: transform 0.2s ease;
}

.er-stat:hover {
  transform: translateY(-2px);
}

.er-stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.er-stat-label {
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
}

.er-stat--correct { background: #dcfce7; }
.er-stat--correct .er-stat-value { color: #16a34a; }
.er-stat--correct .er-stat-label { color: #15803d; }

.er-stat--wrong { background: #fee2e2; }
.er-stat--wrong .er-stat-value { color: #dc2626; }
.er-stat--wrong .er-stat-label { color: #b91c1c; }

.er-stat--skipped { background: #f1f5f9; }
.er-stat--skipped .er-stat-value { color: #475569; }
.er-stat--skipped .er-stat-label { color: #64748b; }

.er-stat--time { background: #ede9fe; }
.er-stat--time .er-stat-value { color: #7c3aed; }
.er-stat--time .er-stat-label { color: #6d28d9; }

/* ══════════════════════════════════════
   SUMMARY PALETTE
   ══════════════════════════════════════ */

.er-summary-section {
  margin-bottom: 28px;
  animation: er-fade-up 0.5s ease 0.6s both;
}

.er-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.er-section-title i {
  color: #6366f1;
}

.er-summary-info {
  font-size: 13px;
  color: #94a3b8;
  margin: 0 0 12px;
}

.er-palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

@media (min-width: 640px) {
  .er-palette-grid { grid-template-columns: repeat(8, 1fr); }
}

@media (min-width: 1024px) {
  .er-palette-grid { grid-template-columns: repeat(10, 1fr); }
}

.er-palette-btn {
  height: 36px;
  width: 100%;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.er-palette-btn:hover {
  transform: scale(1.1);
}

.er-palette-btn--correct {
  background: #dcfce7;
  color: #16a34a;
  border-color: #86efac;
}

.er-palette-btn--wrong {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.er-palette-btn--skipped {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: default;
  opacity: 0.6;
}

.er-palette-btn--skipped:hover {
  transform: none;
}

.er-palette-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: #64748b;
}

.er-palette-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.er-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.er-legend-dot--correct { background: #dcfce7; border: 1px solid #86efac; }
.er-legend-dot--wrong { background: #fee2e2; border: 1px solid #fca5a5; }
.er-legend-dot--skipped { background: #f1f5f9; border: 1px solid #e2e8f0; }

/* ══════════════════════════════════════
   REVIEW SECTION (Canvas-based)
   ══════════════════════════════════════ */

.er-review-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 24px;
  margin-bottom: 28px;
  animation: er-fade-up 0.5s ease 0.7s both;
}

.er-review-container {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.er-review-container::-webkit-scrollbar {
  width: 6px;
}

.er-review-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.er-canvas-card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  min-height: 80px;
}

.er-canvas-card--highlight {
  border-color: #818cf8;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.er-review-canvas {
  width: 100%;
  display: block;
  border-radius: 12px;
}

/* ══════════════════════════════════════
   ACTION BUTTONS
   ══════════════════════════════════════ */

.er-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  animation: er-fade-up 0.5s ease 0.8s both;
}

@media (min-width: 640px) {
  .er-actions {
    flex-direction: row;
  }
}

.er-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.er-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.er-btn--secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.er-btn--secondary:hover {
  background: #e2e8f0;
}

.er-btn--primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.er-btn--primary:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ══════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════ */

@keyframes er-pop-in {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes er-fade-up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes er-score-pop {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
