/* ═══════════════════════════════════════════════════════════════════════
   🎨 QUIZ "TROUVE L'ERREUR" - STYLES COMPLETS
   Architecture modulaire - Fichier CSS séparé
   ═══════════════════════════════════════════════════════════════════════ */

/* ===== VARIABLES COULEURS ===== */
:root {
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --dark: #2C3E50;
  --success: #51CF66;
  --danger: #FF6B6B;
}

/* ===== RESET & BASE ===== */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body {
  font-family: 'Tajawal', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== PARTICLES BACKGROUND ===== */
#particles {
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  pointer-events: none; 
  z-index: 0;
}

.particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  pointer-events: none;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 15px;
  position: relative;
  z-index: 1;
}

/* ===== VIDEO SECTION ===== */
.video-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.video-section h2 {
  font-size: 1.4em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.video-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  background: #000;
}

.video-container iframe {
  width: 100%;
  height: 280px;
  border: 0;
  display: block;
  background: #000;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-card:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-size: 1.5em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label { 
  font-size: 0.75em; 
  color: #666; 
  font-weight: 600; 
  margin-top: 3px; 
}

/* ===== XP BAR ===== */
.xp-bar-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}

.xp-bar {
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 1s ease;
  border-radius: 10px;
}

/* ===== PROGRESS CIRCLE ===== */
.progress-hero {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.progress-circle { 
  position: relative; 
  width: 100px; 
  height: 100px; 
  margin: 0 auto 12px; 
}

.progress-circle svg { 
  transform: rotate(-90deg); 
}

.progress-bg { 
  fill: none; 
  stroke: #e0e0e0; 
  stroke-width: 8; 
}

.progress-fill {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}

.progress-text {
  position: absolute; 
  top: 50%; 
  left: 50%;
  transform: translate(-50%, -50%); 
  text-align: center;
}

.progress-percent {
  font-size: 1.6em;
  font-weight: 900;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.progress-label { 
  font-size: 0.8em; 
  color: var(--dark); 
  font-weight: 600; 
  margin-top: 5px; 
}

/* ===== QUIZ BOX ===== */
.quiz-box {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.6s ease-out;
}

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

/* ===== QUESTION HEADER ===== */
.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--secondary);
}

.question-num {
  font-size: 1em;
  font-weight: 900;
  color: var(--primary);
  background: rgba(255, 107, 107, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
}

.combo-badge {
  display: none;
  background: linear-gradient(135deg, #FF6B6B, #FFE66D);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 900;
  font-size: 0.9em;
  animation: pulse 1s infinite;
}

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

/* ===== QUESTION TEXT ===== */
.question-text {
  font-size: 1.05em;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 14px;
  line-height: 1.8;
  padding: 12px;
  background: rgba(78, 205, 196, 0.08);
  border-radius: 10px;
  border-right: 4px solid var(--secondary);
}

/* ===== STATEMENT BOX (العبارة الخاطئة) ===== */
.statement-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.08);
  border-right: 4px solid var(--primary);
  color: var(--dark);
  font-weight: 700;
  line-height: 1.8;
}

/* ===== OPTIONS ===== */
.options-grid { 
  display: grid; 
  gap: 10px; 
  margin-bottom: 18px; 
}

.option {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95em;
  font-weight: 700;
}

.option:hover {
  background: #e9ecef;
  transform: translateX(-3px);
  border-color: var(--secondary);
}

.option.selected {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(78, 205, 196, 0.3));
  border-color: var(--secondary);
  border-width: 3px;
}

.option.correct {
  background: linear-gradient(135deg, rgba(81, 207, 102, 0.3), rgba(81, 207, 102, 0.2));
  border-color: var(--success);
  animation: correctPulse 0.5s ease;
}

.option.wrong {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(255, 107, 107, 0.2));
  border-color: var(--danger);
  animation: shake 0.5s ease;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ===== CONTROLS & BUTTONS ===== */
.controls { 
  display: flex; 
  gap: 10px; 
  margin-bottom: 15px; 
  flex-wrap: wrap; 
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 0.95em;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Tajawal', sans-serif;
  min-width: 160px;
}

.btn-primary { 
  background: linear-gradient(135deg, var(--secondary), #45b7af); 
  color: white; 
}

.btn-primary:hover:not(:disabled) { 
  transform: translateY(-2px); 
  box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4); 
}

.btn-secondary { 
  background: linear-gradient(135deg, #FFE66D, #ffd93d); 
  color: var(--dark); 
}

.btn-secondary:hover:not(:disabled) { 
  transform: translateY(-2px); 
  box-shadow: 0 5px 15px rgba(255, 230, 109, 0.4); 
}

.btn:disabled { 
  opacity: 0.5; 
  cursor: not-allowed; 
}

/* ===== EXPLANATION ===== */
.explanation {
  display: none;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.1), rgba(102, 126, 234, 0.1));
  padding: 12px;
  border-radius: 10px;
  border-right: 4px solid var(--secondary);
  margin-top: 15px;
}

.explanation h3 { 
  font-size: 1em; 
  color: var(--secondary); 
  margin-bottom: 8px; 
}

.explanation p { 
  font-size: 0.92em; 
  line-height: 1.7; 
  color: var(--dark); 
}

/* ===== MODAL ===== */
.modal {
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex; 
  align-items: center; 
  justify-content: center;
  z-index: 1000;
  opacity: 0; 
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.show { 
  opacity: 1; 
  visibility: visible; 
}

.modal-content {
  background: white;
  padding: 25px;
  border-radius: 15px;
  text-align: center;
  max-width: 380px;
  animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop { 
  from { transform: scale(0.5); opacity: 0; } 
  to { transform: scale(1); opacity: 1; } 
}

.modal-icon { 
  font-size: 3.5em; 
  margin-bottom: 12px; 
}

.modal-title { 
  font-size: 1.4em; 
  font-weight: 900; 
  color: var(--dark); 
  margin-bottom: 8px; 
}

.modal-text { 
  font-size: 1em; 
  color: #666; 
  margin-bottom: 12px; 
}

.xp-display {
  font-size: 1.3em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.close-btn {
  margin-top: 15px;
  padding: 10px 25px;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
}

.close-btn:hover {
  background: #45b7af;
}

/* ===== ACHIEVEMENT NOTIFICATION ===== */
.achievement {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FFD93D, #FF6B6B);
  color: white;
  padding: 15px 25px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement.show { 
  top: 20px; 
}

.achievement-title { 
  font-size: 1.1em; 
  font-weight: 900; 
  margin-bottom: 4px; 
}

.achievement-desc { 
  font-size: 0.85em; 
  opacity: 0.9; 
}

/* ===== FINAL SCREEN ===== */
.final-screen { 
  display: none; 
  text-align: center; 
}

.final-screen.show { 
  display: block; 
  animation: slideUp 0.6s ease-out; 
}

.rank-badge { 
  font-size: 5em; 
  margin-bottom: 15px; 
  animation: bounce 1s infinite; 
}

@keyframes bounce { 
  0%, 100% { transform: translateY(0); } 
  50% { transform: translateY(-15px); } 
}

.final-title {
  font-size: 2em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}

.final-stats { 
  display: grid; 
  grid-template-columns: repeat(2, 1fr); 
  gap: 12px; 
  margin-bottom: 20px; 
}

.final-stat { 
  background: rgba(255, 255, 255, 0.95); 
  padding: 15px; 
  border-radius: 12px; 
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); 
}

.final-value {
  font-size: 2em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.final-label { 
  font-size: 0.85em; 
  color: #666; 
  margin-top: 5px; 
}

/* ===== CONFETTI CANVAS ===== */
#confettiCanvas {
  position: fixed; 
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* ===== MATHJAX / LATEX ===== */
.math { 
  direction: ltr !important; 
  unicode-bidi: embed; 
  display: inline-block; 
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .container { padding: 10px; }
  .question-text { font-size: 1em; }
  .stat-value { font-size: 1.3em; }
  .final-title { font-size: 1.5em; }
  .video-container iframe { height: 220px; }
  .btn { min-width: 120px; font-size: 0.9em; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .final-stats { grid-template-columns: 1fr; }
}
