/* ============================================================
   Learn English with Cyn — Design system
   Palette reprise de la couverture (vert British / navy / rouge)
   ============================================================ */

:root {
  --green:        #00BF63;
  --green-dark:   #009951;
  --green-light:  #E8FBF1;
  --navy:         #1B2A54;
  --navy-deep:    #10193A;
  --red:          #E63946;
  --gold:         #F4C430;
  --white:        #FFFFFF;
  --cream:        #F7FAF8;
  --grey:         #64748B;
  --grey-light:   #E2E8F0;
  --shadow: 0 10px 30px rgba(16, 25, 58, 0.10);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--navy);
  line-height: 1.6;
}

h1, h2, h3, h4, .display {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  letter-spacing: -0.2px;
}

a { color: inherit; }

/* ---------- Header d'outil / unité (bande verte + bloc navy) ---------- */

.header-unit {
  background: var(--green);
  padding: 34px 24px 60px;
  text-align: center;
  position: relative;
  color: var(--white);
}

.header-unit .back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255,255,255,0.22);
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 20px;
  transition: background 0.2s;
}
.header-unit .back-btn:hover { background: rgba(255,255,255,0.35); }

.unit-badge {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  border: 1.5px solid rgba(255,255,255,0.5);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.header-unit .title-box {
  display: inline-block;
  background: var(--navy);
  padding: 18px 38px 20px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-top: 4px;
}

.header-unit .title-box .section-kicker {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(244, 196, 48, 0.65);
  margin-bottom: 6px;
}

.header-unit .title-box h1 {
  color: var(--gold);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 4.2vw, 2.4rem);
  line-height: 1.15;
}

/* ancien badge séparé : conservé pour les pages qui l'utilisent seul (hub d'unité, menus) */

.header-unit p.subtitle {
  max-width: 640px;
  margin: 18px auto 0;
  color: rgba(255,255,255,0.92);
  font-size: 1rem;
}

/* ---------- Conteneur principal ---------- */

.unit-container {
  max-width: 900px;
  margin: -34px auto 0;
  padding: 0 20px 60px;
  position: relative;
  z-index: 2;
}

.content-section {
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 30px;
  margin-bottom: 40px;
  border-top: 5px solid var(--navy);
  position: relative;
}

.illustration-banner { width: 100%; height: auto; border-radius: 14px; margin-bottom: 18px; display: block; }

.content-section h3 {
  color: var(--navy);
  font-size: 1.3rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-section h4 {
  color: var(--green-dark);
  font-size: 1.05rem;
  margin: 18px 0 8px;
}

.content-section p, .content-section li { color: #334155; }
.content-section ul, .content-section ol { padding-left: 20px; margin: 8px 0; }

.theory-block {
  background: var(--green-light);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 16px 18px 14px;
  margin: 16px 0;
}
.theory-block::before {
  content: "📌 À RETENIR";
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--green-dark);
  margin-bottom: 8px;
}
.theory-block.warning {
  background: #FFF4E5;
  border-left-color: var(--gold);
}
.theory-block.warning::before {
  content: "⚠️ ATTENTION";
  color: #B8860B;
}

.example {
  background: var(--cream);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 8px 0;
  font-size: 0.95rem;
  border: 1px dashed var(--grey-light);
}
.example em { color: var(--grey); font-style: italic; }

/* ---------- Tableaux vocabulaire ---------- */

.vocab-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.95rem;
}
.vocab-table caption {
  text-align: left;
  font-weight: 700;
  color: var(--white);
  background: var(--green);
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
}
.vocab-table th {
  background: var(--navy);
  color: var(--white);
  padding: 9px 12px;
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vocab-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--grey-light);
}
.vocab-table tr:nth-child(even) td { background: var(--cream); }
.vocab-table td.fr { color: var(--grey); font-style: italic; width: 40%; }

.vocab-input {
  width: 100%;
  border: none;
  background: transparent;
  border-bottom: 2px solid var(--grey-light);
  padding: 4px 2px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--navy);
  outline: none;
}
.vocab-input:focus { border-bottom-color: var(--green); }
.vocab-input.correct-input { border-bottom-color: var(--green); background: var(--green-light); }
.vocab-input.wrong-input { border-bottom-color: var(--red); background: #FDECEE; }

/* ---------- Exercices ---------- */

.exercise-section {
  background: linear-gradient(180deg, #FFFFFF 0%, var(--green-light) 260%);
  border: 1.5px solid var(--grey-light);
  border-top: 5px solid var(--green);
  border-radius: 18px;
  padding: 26px 30px;
  margin-bottom: 40px;
}

/* ---------- Séparateur entre parties d'une même page ---------- */
.part-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 900px;
  margin: 8px auto 30px;
  padding: 0 20px;
  color: var(--navy);
}
.part-divider .line { flex: 1; height: 2px; background: var(--grey-light); }
.part-divider .label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--navy);
  color: var(--gold);
  padding: 8px 20px;
  border-radius: 30px;
  white-space: nowrap;
}
.exercise-section h4 {
  color: var(--navy);
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.exercise-section > p.instructions {
  color: var(--grey);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* QCM */
.quiz-container { margin-bottom: 14px; }
.quiz-question { font-weight: 700; margin-bottom: 8px; color: var(--navy); }
.quiz-option {
  display: inline-block;
  background: var(--white);
  border: 1.5px solid var(--grey-light);
  border-radius: 10px;
  padding: 8px 16px;
  margin: 4px 8px 4px 0;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.92rem;
}
.quiz-option:hover { border-color: var(--green); background: var(--green-light); }
.quiz-option.correct { background: var(--green); color: var(--white); border-color: var(--green); }
.quiz-option.wrong { background: var(--red); color: var(--white); border-color: var(--red); }

/* Fill-in */
.fill-line { margin: 10px 0; font-size: 0.97rem; color: var(--navy); }
.fill-input {
  border: none;
  border-bottom: 2px solid var(--grey-light);
  background: var(--cream);
  border-radius: 6px 6px 0 0;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  color: var(--navy);
}
.fill-input:focus { border-bottom-color: var(--green); }
.fill-input.short { width: 110px; }
.fill-input.medium { width: 220px; }
.fill-input.long { width: 100%; max-width: 460px; }
.fill-input.correct-input { border-bottom-color: var(--green); background: var(--green-light); }
.fill-input.wrong-input { border-bottom-color: var(--red); background: #FDECEE; }
.fill-input.edited-input, .vocab-input.edited-input { border-bottom-color: var(--gold); background: #FFF8E1; }

.check-btn {
  background: var(--navy);
  color: var(--white);
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 26px;
  border-radius: 30px;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, background 0.15s;
}
.check-btn:hover { background: var(--green-dark); transform: translateY(-2px); }

.score-zone {
  display: inline-block;
  margin-left: 14px;
  font-weight: 700;
  background: var(--gold);
  color: var(--navy);
  padding: 8px 18px;
  border-radius: 20px;
}

/* Matching (click-to-pair) */
.match-grid { display: flex; gap: 40px; flex-wrap: wrap; }
.match-col { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.match-item {
  background: var(--white);
  border: 1.5px solid var(--grey-light);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.93rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  box-sizing: border-box;
}
.match-item:hover { border-color: var(--green); }
.match-item.selected { border-color: var(--navy); background: var(--green-light); }
.match-item.correct { border-color: var(--green); background: var(--green); color: var(--white); }
.match-item.wrong { border-color: var(--red); background: #FDECEE; color: inherit; }
.match-item img.flag { width: 34px; height: auto; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,0.25); }
.match-item .pair-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--navy);
  font-size: 0.7rem; font-weight: 800;
}

/* Categorize (click item -> click bucket) */
.cat-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-chip {
  background: var(--navy);
  color: var(--white);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-chip.selected { background: var(--gold); color: var(--navy); }
.cat-pool:empty::before {
  content: "Tous les mots ont été placés — clique sur \"Vérifier\".";
  color: var(--grey);
  font-size: 0.85rem;
  font-style: italic;
}
.cat-buckets { display: flex; gap: 16px; flex-wrap: wrap; }
.cat-bucket {
  flex: 1; min-width: 180px;
  background: var(--cream);
  border: 2px dashed var(--grey-light);
  border-radius: 12px;
  padding: 12px;
  min-height: 90px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cat-bucket:hover { border-color: var(--green); }
.cat-bucket h5 { font-size: 0.85rem; text-transform: uppercase; color: var(--green-dark); margin-bottom: 8px; letter-spacing: 0.5px; pointer-events: none; }
.cat-bucket .placed {
  display: inline-block;
  background: var(--white);
  border: 1.5px solid var(--grey-light);
  border-radius: 14px;
  padding: 4px 12px;
  margin: 3px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all .15s;
}
.cat-bucket .placed:hover { border-color: var(--navy); }
.cat-bucket .placed.correct { background: var(--green); border-color: var(--green); color: var(--white); }
.cat-bucket .placed.wrong { background: #FDECEE; border-color: var(--red); color: var(--red); }
.cat-hint { color: var(--grey); font-size: 0.78rem; margin-top: 10px; }

/* ---------- Cards / grille de navigation ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.nav-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: var(--navy);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s, box-shadow 0.18s, border-color .18s;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.nav-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(16,25,58,0.16); border-color: var(--green); }
.nav-card .emoji {
  font-size: 1.5rem; margin-bottom: 10px; display: flex;
  width: 44px; height: 44px; align-items: center; justify-content: center;
  background: var(--green-light); border-radius: 12px;
}
.nav-card h3 { font-size: 1.05rem; margin-bottom: 5px; }
.nav-card p { color: #4B5566; font-size: 0.86rem; }
.nav-card .tag {
  display: block;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--grey-light);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green-dark);
}

.nav-card.disabled { opacity: 0.5; pointer-events: none; }
.nav-card.disabled .tag { color: var(--grey); }

/* ---------- Navigation bas de page ---------- */

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-nav a {
  text-decoration: none;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--white);
  border: 1.5px solid var(--grey-light);
  padding: 10px 20px;
  border-radius: 30px;
  transition: all 0.15s;
}
.page-nav a:hover { border-color: var(--green); background: var(--green-light); }

.main-footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--grey);
  font-size: 0.82rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .content-section, .exercise-section { padding: 20px 18px; }
  .match-grid { gap: 20px; }
  .header-unit { padding: 60px 18px 50px; }
}
