/* ==============================
   ARABIW - Apprendre l'Arabe
   Style Principal
   ============================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #7c3aed;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --bg: #f0f4ff;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --arabic-font: 'Tajawal', 'Arial', sans-serif;
  --latin-font: 'Poppins', sans-serif;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(37,99,235,0.10);
  --shadow-lg: 0 8px 40px rgba(37,99,235,0.18);
  --transition: all 0.25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--latin-font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- NAVBAR ---- */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(37,99,235,0.3);
}

.navbar-brand {
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--arabic-font);
  letter-spacing: -1px;
}

.navbar-brand span { font-size: 2rem; }

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  align-items: center;
}

.navbar-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.navbar-nav a:hover, .navbar-nav a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

.btn-nav-cta {
  background: var(--accent) !important;
  color: #1e293b !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 60%, #c026d3 100%);
  color: white;
  padding: 80px 2rem 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: 'ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه و ي';
  position: absolute;
  font-family: var(--arabic-font);
  font-size: 4rem;
  opacity: 0.06;
  width: 100%;
  top: 10px;
  left: 0;
  letter-spacing: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.hero-title .arabic {
  font-family: var(--arabic-font);
  display: block;
  font-size: clamp(3rem, 7vw, 5.5rem);
  opacity: 0.9;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.hero-stat { text-align: center; }
.hero-stat-num { font-size: 2.2rem; font-weight: 800; }
.hero-stat-label { font-size: 0.85rem; opacity: 0.8; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  font-family: var(--latin-font);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,0.35); }

.btn-white { background: white; color: var(--primary); }
.btn-white:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; transform: translateY(-2px); }

.btn-accent { background: var(--accent); color: #1e293b; }
.btn-accent:hover { background: #d97706; transform: translateY(-2px); }

.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

.btn-lg { padding: 16px 40px; font-size: 1.1rem; border-radius: 16px; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

/* ---- GRID ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ---- ARABIC LETTER CARD ---- */
.letter-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.letter-card:hover, .letter-card.active {
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(37,99,235,0.2);
  transform: translateY(-4px);
}

.letter-main {
  font-family: var(--arabic-font);
  font-size: 4rem;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.letter-card:hover .letter-main { transform: scale(1.1); }

.letter-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.letter-transliteration { color: var(--text-muted); font-size: 0.85rem; }
.letter-forms {
  display: flex;
  justify-content: space-around;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.letter-form-item { text-align: center; }
.letter-form-label { font-size: 0.7rem; color: var(--text-muted); display: block; }
.letter-form-char { font-family: var(--arabic-font); font-size: 1.5rem; color: var(--text); }

.letter-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.5rem;
}
.badge-basic { background: #dbeafe; color: var(--primary); }
.badge-throat { background: #fce7f3; color: #be185d; }
.badge-emphatic { background: #fef3c7; color: #92400e; }
.badge-semi-vowel { background: #dcfce7; color: #166534; }

/* ---- PROGRESS ---- */
.progress-bar-container {
  background: var(--border);
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 20px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* ---- XP & LEVEL ---- */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  color: #92400e;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---- QUIZ ---- */
.quiz-container { max-width: 700px; margin: 0 auto; }

.quiz-question {
  background: white;
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.quiz-arabic-text {
  font-family: var(--arabic-font);
  font-size: 5rem;
  color: var(--primary);
  line-height: 1.2;
  margin: 1rem 0;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

.quiz-option {
  padding: 1.2rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
  text-align: center;
  font-family: var(--latin-font);
}

.quiz-option:hover { border-color: var(--primary); background: #eff6ff; }
.quiz-option.correct { border-color: var(--success); background: #dcfce7; color: var(--success); }
.quiz-option.wrong { border-color: var(--danger); background: #fee2e2; color: var(--danger); }

/* ---- LESSON ---- */
.lesson-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: var(--transition);
}

.step-dot.active { background: white; transform: scale(1.3); }
.step-dot.done { background: var(--accent); }

/* ---- AUDIO BUTTON ---- */
.audio-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(37,99,235,0.3);
}

.audio-btn:hover { transform: scale(1.1); box-shadow: 0 8px 24px rgba(37,99,235,0.4); }
.audio-btn.playing { animation: pulse 1s infinite; background: linear-gradient(135deg, var(--success), #059669); }

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

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--border);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  font-family: var(--latin-font);
  font-size: 0.9rem;
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- DASHBOARD ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* ---- LESSON LIST ---- */
.lesson-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  background: white;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}

.lesson-item:hover { transform: translateX(6px); box-shadow: var(--shadow-lg); }
.lesson-item.locked { opacity: 0.5; cursor: not-allowed; }
.lesson-item.completed { border-left: 4px solid var(--success); }
.lesson-item.in-progress { border-left: 4px solid var(--accent); }

.lesson-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.lesson-icon.done { background: #dcfce7; }
.lesson-icon.active { background: #fef3c7; }
.lesson-icon.locked { background: var(--border); }

.lesson-info { flex: 1; }
.lesson-title { font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.lesson-subtitle { font-size: 0.85rem; color: var(--text-muted); }
.lesson-meta { display: flex; align-items: center; gap: 1rem; }
.lesson-xp { font-weight: 700; color: var(--accent); font-size: 0.9rem; }
.lesson-duration { color: var(--text-muted); font-size: 0.85rem; }

/* ---- BADGES ---- */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
}

.badge-card {
  text-align: center;
  padding: 1rem;
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow);
}

.badge-card.earned { border: 2px solid var(--accent); }
.badge-card.locked { opacity: 0.4; filter: grayscale(1); }

.badge-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.badge-name { font-size: 0.75rem; font-weight: 600; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: scale(1); }

/* ---- FORM ---- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: var(--latin-font);
  transition: var(--transition);
  background: white;
  color: var(--text);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

/* ---- ALERTS ---- */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--primary); }

/* ---- VOCAB CARD ---- */
.vocab-card {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.vocab-card:hover { transform: rotateY(5deg) translateY(-4px); }
.vocab-arabic { font-family: var(--arabic-font); font-size: 3.5rem; color: var(--primary); }
.vocab-transliteration { font-size: 1.1rem; color: var(--text-muted); margin: 0.5rem 0; }
.vocab-french { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.vocab-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

/* ---- SECTION ---- */
.section { padding: 4rem 0; }
.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.section-subtitle { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 1.05rem; }

/* ---- HARAKAT ---- */
.harakat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.harakat-symbol {
  font-family: var(--arabic-font);
  font-size: 3rem;
  color: var(--secondary);
}

.harakat-name { font-weight: 700; font-size: 1rem; margin-top: 0.5rem; }
.harakat-sound { color: var(--primary); font-weight: 600; }
.harakat-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }
.harakat-example {
  font-family: var(--arabic-font);
  font-size: 1.3rem;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #eff6ff;
  border-radius: 8px;
}

/* ---- FOOTER ---- */
.footer {
  background: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  font-size: 0.9rem;
}

.footer a { color: #60a5fa; text-decoration: none; }
.footer .footer-arabic {
  font-family: var(--arabic-font);
  font-size: 2rem;
  color: white;
  margin-bottom: 0.5rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .navbar-nav { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .quiz-options { grid-template-columns: 1fr; }
  .hero { padding: 50px 1rem 40px; }
  .container { padding: 0 1rem; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

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

.fade-in { animation: fadeIn 0.5s ease forwards; }
.bounce-in { animation: bounceIn 0.4s cubic-bezier(.36,.07,.19,.97) forwards; }
.shake { animation: shake 0.4s ease; }

/* ---- LOADING ---- */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- WRITING PRACTICE ---- */
.writing-canvas {
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: crosshair;
  touch-action: none;
  background: #fafafa;
}

/* ---- TOOLTIP ---- */
.tooltip-wrap { position: relative; }
.tooltip {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
.tooltip-wrap:hover .tooltip { opacity: 1; }

/* ---- CONFETTI RESULT ---- */
.result-screen {
  text-align: center;
  padding: 3rem;
}

.result-emoji { font-size: 5rem; margin-bottom: 1rem; }
.result-score {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- ALPHABET TABLE ---- */
.alphabet-table-wrap { overflow-x: auto; }

.alphabet-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.alphabet-table th {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
}

.alphabet-table td {
  padding: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.alphabet-table tr:hover td { background: #f8faff; }

.alphabet-table .arabic-cell {
  font-family: var(--arabic-font);
  font-size: 1.8rem;
  color: var(--primary);
  font-weight: 700;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
