/**
 * Quiz System CSS v3.0 - Clean & Professional
 * Standalone quiz styles that override any conflicting styles
 * 
 * @author Sarosh Baig
 * @version 3.0.0
 */

/* ============================================
   QUIZ CONTAINER
   ============================================ */
.quiz-container-modern,
.quiz-container {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  padding: 2rem;
  margin-top: 2rem;
}

.quiz-container-modern .lead-text,
.quiz-container .lead-text {
  color: var(--bs-secondary-color);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* ============================================
   QUESTION CARDS
   ============================================ */
.quiz-question {
  background: var(--bs-body-bg);
  border: 1px solid rgba(var(--bs-border-color-rgb), 0.4);
  border-left: 4px solid rgba(var(--bs-border-color-rgb), 0.6);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: all 0.3s ease;
}

.quiz-question:hover {
  border-left-color: var(--bs-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Question States */
.quiz-question.answered {
  border-left-color: var(--bs-primary);
  background: rgba(99, 102, 241, 0.02);
}

.quiz-question.result-correct {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.04);
}

.quiz-question.result-wrong {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
}

.quiz-question.unanswered {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.04);
  animation: pulseWarning 0.6s ease-in-out;
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.01); }
}

/* Question Number */
.question-number {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: var(--bs-primary);
  margin-bottom: 0.625rem;
  opacity: 0.9;
}

/* Question Text */
.question-text,
.quiz-question h5 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

/* ============================================
   OPTIONS
   ============================================ */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.quiz-options label,
.quiz-options .quiz-option {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  background: var(--bs-body-bg);
  border: 2px solid rgba(var(--bs-border-color-rgb), 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.4;
}

.quiz-options label:hover,
.quiz-options .quiz-option:hover {
  border-color: var(--bs-primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateX(4px);
}

.quiz-options label.selected,
.quiz-options .quiz-option.selected {
  border-color: var(--bs-primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Radio Button */
.quiz-options input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-right: 0.875rem;
  accent-color: var(--bs-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Option Text */
.option-text {
  flex: 1;
  line-height: 1.5;
}

.option-text code {
  background: rgba(var(--bs-primary-rgb), 0.1);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Option States After Submit */
.quiz-options label.correct,
.quiz-options .quiz-option.correct {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.1) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.quiz-options label.correct::after,
.quiz-options .quiz-option.correct::after {
  content: '✓';
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 700;
  color: #10b981;
}

.quiz-options label.wrong,
.quiz-options .quiz-option.wrong {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.quiz-options label.wrong::after,
.quiz-options .quiz-option.wrong::after {
  content: '✗';
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ef4444;
}

/* ============================================
   EXPLANATION
   ============================================ */
.quiz-explanation {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-explanation.correct {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #065f46;
}

.quiz-explanation.wrong {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--bs-body-color);
}

.quiz-explanation i {
  flex-shrink: 0;
  margin-top: 2px;
}

.quiz-explanation.correct i {
  color: #10b981;
}

.quiz-explanation.wrong i {
  color: var(--bs-primary);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .quiz-explanation.correct {
  color: #6ee7b7;
}

[data-bs-theme="dark"] .quiz-explanation.wrong {
  color: #c7d2fe;
}

/* ============================================
   QUIZ ACTIONS
   ============================================ */
.quiz-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(var(--bs-border-color-rgb), 0.2);
}

.quiz-check-btn {
  padding: 0.875rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.quiz-check-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.quiz-check-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.quiz-progress-text {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
  transition: all 0.3s ease;
}

.quiz-progress-text.warning {
  color: #f59e0b;
  font-weight: 600;
}

/* ============================================
   RESULT CARD
   ============================================ */
.quiz-result {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 2rem;
  padding: 2.5rem;
  border-radius: 16px;
  animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-result.show {
  display: flex;
}

/* Result Grades */
.quiz-result.perfect {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.quiz-result.excellent {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(52, 211, 153, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.quiz-result.good {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.quiz-result.fair {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(251, 191, 36, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.quiz-result.needs-work {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(248, 113, 113, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Result Icon */
.result-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.quiz-result.perfect .result-icon { color: #fbbf24; }
.quiz-result.excellent .result-icon { color: #10b981; }
.quiz-result.good .result-icon { color: var(--bs-primary); }
.quiz-result.fair .result-icon { color: #f59e0b; }
.quiz-result.needs-work .result-icon { color: #ef4444; }

/* Result Content */
.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-grade {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--bs-body-color);
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.score-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--bs-body-color);
}

.score-divider {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

.score-total {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

.score-percent {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  margin-left: 0.5rem;
}

.result-message {
  font-size: 1rem;
  color: var(--bs-secondary-color);
  margin-bottom: 1.5rem;
  max-width: 400px;
  line-height: 1.5;
}

/* Retake Button */
.btn-retake {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  background: var(--bs-primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-retake:hover {
  background: #4f46e5;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .quiz-container-modern {
    padding: 1.25rem;
    border-radius: 16px;
  }
  
  .quiz-question {
    padding: 1.25rem;
  }
  
  .quiz-options label {
    padding: 0.75rem 0.875rem;
    font-size: 0.9rem;
  }
  
  .quiz-options input[type="radio"] {
    width: 16px;
    height: 16px;
  }
  
  .quiz-result {
    padding: 1.5rem;
  }
  
  .result-icon {
    font-size: 2.5rem;
  }
  
  .result-grade {
    font-size: 1.5rem;
  }
  
  .score-number {
    font-size: 2rem;
  }
  
  .quiz-check-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .quiz-container-modern {
    padding: 1rem;
  }
  
  .question-text,
  .quiz-question h5 {
    font-size: 0.95rem;
  }
  
  .quiz-options label {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
  }
}
