/* =============================================
   QUIZ STYLES
   ============================================= */

/* Quiz wrapper */
.quiz-wrapper {
  padding: 4px 0;
}
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.quiz-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  margin: 0;
}
.quiz-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface, #f0f4ff);
  padding: 3px;
  border-radius: 8px;
}
.quiz-tab {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary, #666);
  transition: all 0.2s;
}
.quiz-tab.active {
  background: white;
  color: var(--primary, #667eea);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Quota badge */
.quiz-quota-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary, #667eea);
  background: rgba(102,126,234,0.08);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  display: inline-block;
}

/* Step labels */
.quiz-step-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary, #555);
  margin: 0 0 12px;
}
.quiz-back-btn {
  background: none;
  border: none;
  color: var(--primary, #667eea);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Concours grid */
.quiz-concours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.quiz-concours-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 2px solid rgba(102,126,234,0.15);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  position: relative;
}
.quiz-concours-card:hover:not(.locked) {
  border-color: var(--primary, #667eea);
  background: rgba(102,126,234,0.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102,126,234,0.15);
}
.quiz-concours-card.locked {
  opacity: 0.55;
  cursor: default;
}
.quiz-concours-icon {
  font-size: 28px;
}
.quiz-concours-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  text-align: center;
  line-height: 1.3;
}
.quiz-concours-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(72,187,120,0.1);
  color: #2d7a4f;
}
.quiz-badge-locked { background: rgba(160,160,160,0.1); color: #888; }
.quiz-badge-free { background: rgba(102,126,234,0.1); color: var(--primary, #667eea); }

/* Matiere list */
.quiz-matieres-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-matiere-btn {
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border: 1.5px solid rgba(102,126,234,0.15);
  border-radius: 10px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1a1a2e);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.quiz-matiere-btn:hover {
  border-color: var(--primary, #667eea);
  background: rgba(102,126,234,0.04);
}
[dir="rtl"] .quiz-matiere-btn { text-align: right; }

/* Loading */
.quiz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
}
.quiz-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(102,126,234,0.2);
  border-top-color: var(--primary, #667eea);
  border-radius: 50%;
  animation: quiz-spin 0.8s linear infinite;
}
@keyframes quiz-spin { to { transform: rotate(360deg); } }

/* Quiz card */
.quiz-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 4px 0;
}
.quiz-progress-bar {
  height: 6px;
  background: rgba(102,126,234,0.12);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary, #667eea), var(--secondary, #764ba2));
  border-radius: 3px;
  transition: width 0.4s ease;
}
.quiz-progress-text {
  font-size: 13px;
  color: var(--text-secondary, #888);
  margin-bottom: 16px;
  text-align: center;
}
.quiz-question {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  line-height: 1.5;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(102,126,234,0.04);
  border-radius: 10px;
  border-left: 3px solid var(--primary, #667eea);
}
[dir="rtl"] .quiz-question { border-left: none; border-right: 3px solid var(--primary, #667eea); }

/* Options */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid rgba(102,126,234,0.15);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1a1a2e);
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--primary, #667eea);
  background: rgba(102,126,234,0.04);
}
.quiz-option:disabled { cursor: default; }
.quiz-option.correct {
  border-color: #48bb78;
  background: rgba(72,187,120,0.08);
  color: #2d7a4f;
}
.quiz-option.wrong {
  border-color: #e53e3e;
  background: rgba(229,62,62,0.07);
  color: #c53030;
}
.quiz-option-letter {
  font-size: 13px;
  font-weight: 700;
  width: 28px; height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: rgba(102,126,234,0.1);
  color: var(--primary, #667eea);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.quiz-option.correct .quiz-option-letter { background: rgba(72,187,120,0.2); color: #2d7a4f; }
.quiz-option.wrong .quiz-option-letter { background: rgba(229,62,62,0.15); color: #c53030; }
[dir="rtl"] .quiz-option { text-align: right; }

/* Feedback */
.quiz-feedback {
  padding: 14px;
  border-radius: 10px;
  background: rgba(102,126,234,0.04);
  border: 1.5px solid rgba(102,126,234,0.12);
  animation: quiz-slide-down 0.3s ease;
}
@keyframes quiz-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.quiz-feedback-status {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}
.quiz-feedback-status.correct { color: #2d7a4f; }
.quiz-feedback-status.wrong   { color: #c53030; }
.quiz-feedback-explanation {
  font-size: 13px;
  color: var(--text-secondary, #555);
  line-height: 1.5;
  margin-bottom: 12px;
}
.quiz-next-btn {
  width: 100%;
  margin-top: 4px;
}

/* Result */
.quiz-result {
  text-align: center;
  padding: 20px 0;
}
.quiz-result-emoji {
  font-size: 56px;
  margin-bottom: 12px;
}
.quiz-result h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  margin-bottom: 8px;
}
.quiz-result-score {
  font-size: 16px;
  color: var(--text-secondary, #555);
  margin-bottom: 8px;
}
.quiz-result-pct {
  font-size: 42px;
  font-weight: 800;
  color: var(--primary, #667eea);
  margin-bottom: 12px;
}
.quiz-result-bar {
  height: 10px;
  background: rgba(102,126,234,0.12);
  border-radius: 5px;
  overflow: hidden;
  max-width: 300px;
  margin: 0 auto 16px;
}
.quiz-result-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease;
}
.quiz-result-answers {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.quiz-answer-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}
.quiz-answer-dot.correct { background: #48bb78; }
.quiz-answer-dot.wrong   { background: #e53e3e; }

/* Quota exceeded */
.quiz-quota-exceeded {
  text-align: center;
  padding: 30px 20px;
}
.quiz-quota-icon { font-size: 48px; margin-bottom: 12px; }
.quiz-quota-exceeded h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Stats */
.quiz-stats { padding: 4px 0; }
.quiz-stats h4 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  margin-bottom: 14px;
}
.quiz-stats h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary, #555);
}
.quiz-stats-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.quiz-stat-card {
  background: rgba(102,126,234,0.05);
  border: 1.5px solid rgba(102,126,234,0.12);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
}
.quiz-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary, #667eea);
  line-height: 1;
  margin-bottom: 4px;
}
.quiz-stat-label {
  font-size: 12px;
  color: var(--text-secondary, #888);
  font-weight: 500;
}
.quiz-recent-list { display: flex; flex-direction: column; gap: 8px; }
.quiz-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(102,126,234,0.03);
  border-radius: 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.quiz-recent-score { font-weight: 700; }
.quiz-recent-score.good { color: #2d7a4f; }
.quiz-recent-score.bad  { color: #c53030; }
.quiz-recent-date { color: #aaa; font-size: 12px; }
.quiz-matiere-stats { display: flex; flex-direction: column; gap: 10px; }
.quiz-matiere-stat-item {}
.quiz-matiere-stat-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.quiz-matiere-bar {
  height: 6px;
  background: rgba(102,126,234,0.1);
  border-radius: 3px;
  overflow: hidden;
}

/* OTP styles in register modal */
.otp-section { display: none; }
.otp-section.visible { display: block; }
.otp-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.otp-input-row input { flex: 1; }
.otp-send-btn {
  white-space: nowrap;
  padding: 10px 14px;
  font-size: 13px;
}
.otp-status {
  font-size: 12px;
  margin-top: 4px;
  padding: 4px 0;
}
.otp-status.success { color: #2d7a4f; }
.otp-status.error   { color: #c53030; }
.phone-verified-badge {
  font-size: 12px;
  color: #2d7a4f;
  font-weight: 600;
  margin-top: 4px;
}
