/* ============================================================
   HERPSA QUIZ — Front-end CSS
   ============================================================ */
.herpsa-quiz {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 720px;
  margin: 2rem auto;
}

/* ── En-tête ── */
.hq-header {
  background: #1e3a5f;
  color: #fff;
  border-radius: 16px 16px 0 0;
  padding: 1.5rem 2rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.hq-title { font-size: 1.125rem; font-weight: 700; margin: 0; }
.hq-meta { font-size: .8125rem; color: rgba(255,255,255,.7); margin-top: .25rem; }
.hq-timer { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #d4a843; }
.hq-timer.urgent { color: #f87171; animation: pulse .8s infinite; }

/* ── Progression ── */
.hq-progress-wrap {
  background: #f1f5f9;
  padding: .75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.hq-progress-bar {
  flex: 1; height: 6px; background: #e2e8f0;
  border-radius: 9999px; overflow: hidden;
}
.hq-progress-fill {
  height: 100%; background: #1e3a5f;
  border-radius: 9999px; transition: width .4s ease;
}
.hq-progress-label { font-size: .8125rem; color: #64748b; white-space: nowrap; }

/* ── Corps question ── */
.hq-body {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  padding: 2rem;
}
.hq-q-num { font-size: .75rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.hq-q-text { font-size: 1rem; font-weight: 700; color: #1e293b; line-height: 1.5; margin-bottom: 1.5rem; }
.hq-q-type-hint { font-size: .8125rem; color: #94a3b8; font-style: italic; margin-bottom: 1rem; }
.hq-q-points { font-size: .75rem; font-weight: 600; color: #1e3a5f; background: #eff6ff; padding: 2px 8px; border-radius: 9999px; display: inline-block; margin-bottom: 1.25rem; }

/* ── Options QCM ── */
.hq-options { display: flex; flex-direction: column; gap: .625rem; }
.hq-option {
  display: flex; align-items: center; gap: .875rem;
  padding: .875rem 1rem; border: 2px solid #e2e8f0;
  border-radius: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.hq-option:hover { border-color: #94a3b8; background: #f8fafc; }
.hq-option.selected { border-color: #1e3a5f; background: #eff6ff; }
.hq-option.correct  { border-color: #10b981; background: #ecfdf5; }
.hq-option.wrong    { border-color: #ef4444; background: #fef2f2; }
.hq-option.missed   { border-color: #10b981; background: #ecfdf5; opacity: .6; }
.hq-option-letter {
  width: 32px; height: 32px; border-radius: 8px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #475569;
  flex-shrink: 0;
}
.hq-option.selected .hq-option-letter { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.hq-option.correct  .hq-option-letter { background: #10b981; color: #fff; border-color: #10b981; }
.hq-option.wrong    .hq-option-letter { background: #ef4444; color: #fff; border-color: #ef4444; }
.hq-option-text { font-size: .9375rem; color: #1e293b; flex: 1; }

/* ── Vrai/Faux ── */
.hq-vf-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.hq-vf-btn {
  padding: 1rem; border: 2px solid #e2e8f0; border-radius: 10px;
  background: #fff; cursor: pointer; font-size: 1rem; font-weight: 700;
  transition: all .15s; display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.hq-vf-btn:hover { border-color: #94a3b8; }
.hq-vf-btn.selected { border-color: #1e3a5f; background: #eff6ff; color: #1e3a5f; }
.hq-vf-btn.correct  { border-color: #10b981; background: #ecfdf5; color: #047857; }
.hq-vf-btn.wrong    { border-color: #ef4444; background: #fef2f2; color: #dc2626; }

/* ── Texte à trous ── */
.hq-sentence { font-size: 1rem; line-height: 2; color: #1e293b; margin-bottom: 1rem; }
.hq-blank {
  display: inline-block; min-width: 80px;
  border-bottom: 2px solid #1e3a5f;
  padding: 0 6px; margin: 0 4px;
  text-align: center; font-weight: 600;
}
.hq-blank input {
  border: none; outline: none; background: transparent;
  font-size: 1rem; font-weight: 600; color: #1e3a5f;
  width: 100%; min-width: 80px; text-align: center;
}
.hq-blank.correct { border-color: #10b981; }
.hq-blank.wrong   { border-color: #ef4444; }

/* ── Remise en ordre ── */
.hq-order-items { display: flex; flex-direction: column; gap: .5rem; }
.hq-order-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border: 2px solid #e2e8f0;
  border-radius: 10px; background: #fff; cursor: grab;
  transition: box-shadow .15s, border-color .15s;
}
.hq-order-item:active { cursor: grabbing; box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.hq-order-item.dragging { opacity: .4; }
.hq-order-item.correct-pos { border-color: #10b981; background: #ecfdf5; }
.hq-order-item.wrong-pos   { border-color: #ef4444; background: #fef2f2; }
.hq-order-handle { color: #94a3b8; font-size: 18px; }
.hq-order-num {
  width: 28px; height: 28px; border-radius: 8px;
  background: #f1f5f9; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #64748b; flex-shrink: 0;
}

/* ── Association ── */
.hq-assoc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hq-assoc-col-title { font-size: .75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.hq-assoc-items { display: flex; flex-direction: column; gap: .5rem; }
.hq-assoc-item {
  padding: .75rem 1rem; border: 2px solid #e2e8f0;
  border-radius: 10px; font-size: .9rem; cursor: pointer;
  transition: all .15s; background: #fff;
}
.hq-assoc-item.selected { border-color: #1e3a5f; background: #eff6ff; font-weight: 600; }
.hq-assoc-item.matched  { border-color: #10b981; background: #ecfdf5; }
.hq-assoc-item.wrong    { border-color: #ef4444; background: #fef2f2; }
.hq-assoc-pair-line { font-size: .8rem; color: #64748b; }

/* ── Question ouverte ── */
.hq-open-textarea {
  width: 100%; padding: .875rem 1rem;
  border: 2px solid #e2e8f0; border-radius: 10px;
  font-size: .9375rem; line-height: 1.6; resize: vertical; min-height: 120px;
  font-family: inherit; box-sizing: border-box;
  transition: border-color .15s;
}
.hq-open-textarea:focus { outline: none; border-color: #1e3a5f; }

/* ── Feedback ── */
.hq-feedback {
  margin-top: 1.25rem; padding: .875rem 1rem;
  border-radius: 10px; font-size: .875rem; line-height: 1.5;
  display: none;
}
.hq-feedback.show { display: block; }
.hq-feedback.correct-fb { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.hq-feedback.wrong-fb   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.hq-feedback.neutral-fb { background: #f8fafc; border: 1px solid #e2e8f0; color: #475569; }

/* ── Actions ── */
.hq-actions {
  display: flex; justify-content: flex-end; gap: .75rem;
  padding: 1.25rem 2rem; background: #f8fafc;
  border: 1px solid #e2e8f0; border-top: none;
  border-radius: 0 0 16px 16px;
}
.hq-btn {
  padding: .625rem 1.5rem; border-radius: 8px; border: none;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: all .15s; display: inline-flex; align-items: center; gap: .4rem;
}
.hq-btn-primary { background: #1e3a5f; color: #fff; }
.hq-btn-primary:hover { background: #2c5282; }
.hq-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.hq-btn-skip { background: transparent; color: #94a3b8; border: 1px solid #e2e8f0; }
.hq-btn-skip:hover { color: #475569; border-color: #94a3b8; }

/* ── Résultats finaux ── */
.hq-results {
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  text-align: center !important;
}
.hq-results-header {
  padding: 2.5rem 2rem 1.5rem !important;
  background: linear-gradient(135deg, #1e3a5f, #2c5282) !important;
  color: #fff !important;
}
.hq-results-header * { color: #fff !important; }
.hq-score-circle {
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,.15) !important;
  border: 4px solid;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  margin: 0 auto 1rem !important;
}
.hq-score-pct { font-size: 1.75rem !important; font-weight: 800 !important; line-height: 1 !important; color: #fff !important; }
.hq-score-pts { font-size: .75rem !important; opacity: .8 !important; color: #fff !important; }
.hq-results-title { font-size: 1.25rem !important; font-weight: 700 !important; margin: 0 0 .375rem !important; color: #fff !important; border: none !important; padding: 0 !important; }
.hq-results-sub   { font-size: .875rem !important; opacity: .8 !important; margin: 0 !important; color: #fff !important; }
.hq-results-body  { padding: 1.5rem 2rem !important; background: #fff !important; }
.hq-detail-list   { text-align: left !important; }
.hq-detail-item {
  display: flex !important; align-items: flex-start !important; gap: .75rem !important;
  padding: .75rem 0 !important; border-bottom: 1px solid #f1f5f9 !important;
  border-left: none !important; border-right: none !important; border-top: none !important;
  font-size: .875rem !important; background: transparent !important;
}
.hq-detail-item:last-child { border-bottom: none !important; }
.hq-detail-icon { font-size: 1.25rem !important; flex-shrink: 0 !important; margin-top: 1px !important; }
.hq-detail-q { color: #1e293b !important; font-weight: 500 !important; flex: 1 !important; }
.hq-detail-pts { font-weight: 700 !important; color: #1e3a5f !important; font-size: .8125rem !important; white-space: nowrap !important; }
.hq-results-actions { padding: .75rem 2rem 1.5rem !important; display: flex !important; justify-content: center !important; gap: .75rem !important; background: #fff !important; flex-wrap: wrap; }

/* ── Animations ── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
@keyframes slideIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.hq-body { animation: slideIn .25s ease; }

/* ── Mobile ── */
@media(max-width:600px) {
  .hq-header  { padding: 1rem; flex-direction: column; align-items: flex-start; gap: .5rem; }
  .hq-body    { padding: 1.25rem 1rem; }
  .hq-actions { padding: 1rem; }
  .hq-vf-options { grid-template-columns: 1fr; }
  .hq-assoc-grid { grid-template-columns: 1fr; }
  .hq-progress-wrap { padding: .625rem 1rem; }
}

/* ============================================================
   FLASHCARDS CSS
   ============================================================ */
.herpsa-flashcards {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 680px;
  margin: 2rem auto;
}

/* En-tête */
.hfc-header {
  background: #1e3a5f;
  color: #fff;
  border-radius: 16px 16px 0 0;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hfc-title { font-size: 1rem; font-weight: 700; margin: 0; }
.hfc-counter { font-size: .8125rem; color: rgba(255,255,255,.7); }

/* Barre de progression */
.hfc-progress-wrap { background: #f1f5f9; padding: .625rem 2rem; display: flex; align-items: center; gap: 1rem; }
.hfc-progress-bar  { flex:1; height:5px; background:#e2e8f0; border-radius:9999px; overflow:hidden; }
.hfc-progress-fill { height:100%; background:#d4a843; border-radius:9999px; transition:width .4s ease; }
.hfc-progress-pct  { font-size:.75rem; color:#64748b; white-space:nowrap; }

/* Zone carte */
.hfc-stage {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  padding: 2.5rem 2rem;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Carte flip */
.hfc-card-wrap {
  width: 100%; max-width: 520px;
  perspective: 1200px;
  cursor: pointer;
  user-select: none;
}
.hfc-card {
  position: relative;
  width: 100%; min-height: 180px;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.hfc-card.flipped { transform: rotateY(180deg); }

.hfc-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem; border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
}
.hfc-front {
  background: #1e3a5f; color: #fff;
}
.hfc-back {
  background: #fff;
  border: 2px solid #e2e8f0;
  color: #1e293b;
  transform: rotateY(180deg);
}
.hfc-face-label {
  font-size: .6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; opacity: .6; margin-bottom: .875rem;
}
.hfc-front .hfc-face-label { color: rgba(255,255,255,.6); }
.hfc-back  .hfc-face-label { color: #94a3b8; }
.hfc-face-text {
  font-size: 1.125rem; font-weight: 700; line-height: 1.45;
}
.hfc-face-hint {
  font-size: .8rem; color: rgba(255,255,255,.5);
  margin-top: 1.5rem;
}

/* Boutons évaluation (après flip) */
.hfc-eval {
  display: flex; gap: .75rem; margin-top: 1.5rem;
  justify-content: center; flex-wrap: wrap;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s .1s, transform .25s .1s;
  pointer-events: none;
}
.hfc-eval.show { opacity: 1; transform: translateY(0); pointer-events: all; }

.hfc-eval-btn {
  padding: .625rem 1.25rem; border-radius: 9999px;
  border: 2px solid; font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: all .15s; background: #fff;
  display: flex; align-items: center; gap: .4rem;
}
.hfc-eval-btn.knew    { border-color: #10b981; color: #047857; }
.hfc-eval-btn.knew:hover    { background: #ecfdf5; }
.hfc-eval-btn.unsure  { border-color: #f59e0b; color: #b45309; }
.hfc-eval-btn.unsure:hover  { background: #fffbeb; }
.hfc-eval-btn.didnt   { border-color: #ef4444; color: #dc2626; }
.hfc-eval-btn.didnt:hover   { background: #fef2f2; }

/* Navigation */
.hfc-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-top: none; border-radius: 0 0 16px 16px;
}
.hfc-nav-btn {
  padding: .5rem 1.25rem; border-radius: 8px;
  border: 1px solid #e2e8f0; background: #fff;
  font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: all .15s; color: #475569;
}
.hfc-nav-btn:hover:not(:disabled) { border-color: #94a3b8; color: #1e293b; }
.hfc-nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.hfc-nav-tip { font-size: .75rem; color: #94a3b8; }

/* Résultats flashcards */
.hfc-results {
  background: #fff; border: 1px solid #e2e8f0;
  border-top: none; border-radius: 0 0 16px 16px;
  padding: 2rem; text-align: center;
}
.hfc-results-title { font-size: 1.25rem; font-weight: 700; color: #1e293b; margin-bottom: 1.5rem; }
.hfc-stats { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 2rem; flex-wrap: wrap; }
.hfc-stat {
  padding: 1rem 1.5rem; border-radius: 12px;
  min-width: 90px; text-align: center;
}
.hfc-stat--knew   { background: #ecfdf5; }
.hfc-stat--unsure { background: #fffbeb; }
.hfc-stat--didnt  { background: #fef2f2; }
.hfc-stat-n { font-size: 2rem !important; font-weight: 800 !important; line-height: 1 !important; }
.hfc-stat--knew   .hfc-stat-n { color: #047857 !important; }
.hfc-stat--unsure .hfc-stat-n { color: #b45309 !important; }
.hfc-stat--didnt  .hfc-stat-n { color: #dc2626 !important; }
.hfc-stat-l { font-size: .75rem !important; font-weight: 600 !important; color: #64748b !important; margin-top: .25rem !important; }
.hfc-results-title { font-size: 1.25rem !important; font-weight: 700 !important; color: #1e293b !important; margin-bottom: 1.5rem !important; border: none !important; padding: 0 !important; }
.hfc-results-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; }
.hfc-results-actions .hq-btn { font-size: .875rem; }

/* Indicateurs deck */
.hfc-dots {
  display: flex; gap: 5px; flex-wrap: wrap;
  justify-content: center; margin-top: 1.5rem;
}
.hfc-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e2e8f0; transition: background .2s;
}
.hfc-dot.knew   { background: #10b981; }
.hfc-dot.unsure { background: #f59e0b; }
.hfc-dot.didnt  { background: #ef4444; }
.hfc-dot.current { box-shadow: 0 0 0 2px #1e3a5f; }

@media(max-width:600px) {
  .hfc-header, .hfc-stage, .hfc-nav { padding-left: 1rem; padding-right: 1rem; }
  .hfc-face-text { font-size: 1rem; }
  .hfc-eval { gap: .5rem; }
  .hfc-eval-btn { padding: .5rem .875rem; font-size: .8125rem; }
}

/* ── Wrapper quiz ── */
.herpsa-quiz-wrap {
  margin: 2rem 0;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1e293b;
}
.herpsa-quiz-wrap, .herpsa-quiz-wrap * { box-sizing: border-box; }
/* Reset ciblé — uniquement les éléments hors composants quiz */
.herpsa-quiz-wrap > p { margin: 0; }
/* NE PAS reset les ul/ol internes au quiz — ils n'existent pas structurellement */
/* Reset les surcharges du thème sur les textes colorés */
.hq-results-header * { color: inherit !important; }
.hq-header * { color: inherit !important; }
.hq-results-title, .hq-results-sub { color: #fff !important; }
.hq-detail-q { color: #1e293b !important; }
.hq-detail-pts { color: #1e3a5f !important; }
