/* ============================================================
   QUIZ-ORALE.CSS — Quiz Compréhension Orale
   Inspiré de maitrisetcf.com + design référence
   ============================================================ */

:root {
  --qo-green:      #1a5c48;
  --qo-green-mid:  #2e7d5e;
  --qo-green-bg:   #e8f5f0;
  --qo-blue:       #2563eb;
  --qo-page-bg:    #f0f4f8;
  --qo-sidebar-bg: #ffffff;
  --qo-card-bg:    #ffffff;
  --qo-radius:     12px;
  --qo-shadow:     0 2px 12px rgba(0,0,0,.08);
}

body { background: var(--qo-page-bg); }

/* ══ LAYOUT 2 COLONNES ══════════════════════════════════════ */
.qo-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  gap: 0;
}

/* ══ SIDEBAR ════════════════════════════════════════════════ */
.qo-sidebar {
  background: var(--qo-sidebar-bg);
  border-right: 1px solid #e2e8f0;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Timer — identique à la compréhension écrite */
.qo-timer-box {
  background: linear-gradient(135deg, #6366f1 0%, #3b5bdb 100%);
  border-radius: 14px;
  padding: 16px 14px 12px;
  color: #fff;
  text-align: center;
}
.qo-timer-label {
  font-size: 11px;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.qo-timer-icon { font-size: 16px; opacity: .85; }
.qo-timer-val {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
  margin: 4px 0;
}
.qo-timer-bar-wrap {
  background: rgba(255,255,255,.2);
  border-radius: 50px;
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
}
.qo-timer-bar {
  height: 100%;
  background: #fff;
  border-radius: 50px;
  width: 100%;
  transition: width 1s linear;
}

/* Auto-fill */
.qo-autofill-btn {
  width: 100%;
  padding: 9px 14px;
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  transition: background .2s, transform .2s;
}
.qo-autofill-btn:hover { background: #ea6c0a; transform: translateY(-1px); }

/* Nav section */
.qo-nav-section { flex: 1; }
.qo-nav-title {
  font-weight: 700;
  font-size: .82rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.qo-nav-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
}
.qo-nav-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.qo-nav-btn:hover       { border-color: #4169E1; color: #1e3a8a; }
.qo-nav-btn.qo-nav-current  { background: #3b5bdb; border-color: #3b5bdb; color: #fff; }
.qo-nav-btn.qo-nav-answered { background: #22c55e; border-color: #22c55e; color: #fff; }

/* Légende */
.qo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.qo-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
}
.qo-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  flex-shrink: 0;
}
.qo-dot-current  { background: #3b5bdb; border-color: #3b5bdb; }
.qo-dot-answered { background: #22c55e; border-color: #22c55e; }
.qo-dot-none     { background: #fff; }

/* Quitter */
.qo-quit-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: #ef4444;
  border: 1.5px solid #fecaca;
  border-radius: 8px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  transition: all .15s;
}
.qo-quit-btn:hover { background: #fef2f2; }

/* ══ MAIN ═══════════════════════════════════════════════════ */
.qo-main {
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
}

/* Badge question */
.qo-q-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.qo-q-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border: 2px solid var(--qo-green);
  border-radius: 50px;
  color: var(--qo-green);
  font-weight: 700;
  font-size: .95rem;
}
.qo-pts-badge {
  background: #22c55e;
  color: #fff;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 700;
}
.qo-level-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 700;
}

/* Image */
.qo-img-wrap {
  border-radius: var(--qo-radius);
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.qo-img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: var(--qo-radius);
  display: block;
}

/* Instruction verte */
.qo-instruction {
  background: var(--qo-green-bg);
  color: #14532d;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: .95rem;
  font-weight: 600;
  text-align: center;
}

/* Énoncé */
.qo-enonce {
  background: #f8fafc;
  border-left: 4px solid var(--qo-green);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  font-size: .93rem;
  line-height: 1.6;
  color: #374151;
}

/* ══ LECTEUR AUDIO PERSONNALISÉ ═════════════════════════════ */
.qo-audio-card {
  background: #eef6ff;
  border: 1.5px solid #c7d2fe;
  border-radius: var(--qo-radius);
  padding: 14px 18px;
}
.qo-audio-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--qo-blue);
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: 12px;
}
.qo-audio-header i { font-size: 1.1rem; }
.qo-audio-player-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qo-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--qo-blue);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.qo-play-btn:hover  { background: #1d4ed8; }
.qo-play-btn:active { transform: scale(.95); }
.qo-audio-progress-wrap {
  flex: 1;
  height: 8px;
  background: #c7d2fe;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}
.qo-audio-progress {
  height: 100%;
  background: var(--qo-blue);
  border-radius: 4px;
  width: 0%;
  pointer-events: none;
}
.qo-audio-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: var(--qo-blue);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  pointer-events: none;
}
.qo-audio-time, .qo-audio-dur {
  font-size: .8rem;
  font-weight: 600;
  color: var(--qo-blue);
  white-space: nowrap;
  min-width: 34px;
}
.qo-audio-dur { opacity: .6; }

/* ══ OPTIONS ════════════════════════════════════════════════ */
.qo-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qo-opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: .93rem;
  color: #374151;
  text-align: left;
  transition: all .15s;
}
.qo-opt-btn:hover   { border-color: var(--qo-green); background: var(--qo-green-bg); }
.qo-opt-btn.selected { border-color: var(--qo-green); background: var(--qo-green-bg); box-shadow: 0 0 0 3px rgba(26,92,72,.12); }
.qo-opt-letter {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #64748b;
  flex-shrink: 0;
  transition: all .15s;
}
.qo-opt-btn.selected .qo-opt-letter {
  border-color: var(--qo-green);
  background: var(--qo-green);
  color: #fff;
}
.qo-opt-text { flex: 1; line-height: 1.4; }

/* ══ NAVIGATION BAS ═════════════════════════════════════════ */
.qo-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.qo-score-badge {
  background: #dcfce7;
  color: #14532d;
  border-radius: 50px;
  padding: 6px 18px;
  font-size: .85rem;
  font-weight: 700;
  border: 1.5px solid #86efac;
}
.qo-btn-prev {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 22px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #374151;
  font-weight: 600; font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.qo-btn-prev:hover { background: #f1f5f9; color: #374151; }
.qo-btn-next {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 26px;
  border-radius: 8px;
  border: none;
  background: var(--qo-green);
  color: #fff;
  font-weight: 700; font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.qo-btn-next:hover { background: var(--qo-green-mid); }

/* ══ RÉSULTATS ══════════════════════════════════════════════ */
.qo-result-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 16px; gap: 8px;
}
.qo-result-card {
  background: #fff; border-radius: 16px;
  padding: 40px 32px; max-width: 480px; width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
}
.qo-corrections-wrap { width: 100%; max-width: 860px; margin-top: 24px; }
.qo-result-circle {
  width: 130px; height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--qo-green), var(--qo-green-mid));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.qo-result-stats {
  display: flex; justify-content: center; gap: 24px;
  margin: 16px 0 24px;
}
.qo-stat-val   { font-size: 1.6rem; font-weight: 800; color: #22c55e; }
.qo-stat-label { font-size: .78rem; color: #94a3b8; }

/* ══ RESPONSIVE ═════════════════════════════════════════════ */
/* ══ Barre supérieure mobile (timer · compteur · sommaire · quitter) ══ */
.qo-topbar { display:none; align-items:center; justify-content:space-between; padding:0 14px; height:54px;
  background:#fff; border-bottom:2px solid #e2e8f0; position:sticky; top:168px; z-index:1001; gap:10px;
  box-shadow:0 2px 8px rgba(0,0,0,.07); }
.qo-topbar-timer { display:flex; align-items:center; gap:6px; font-weight:800; font-size:18px; color:#1a5c48; min-width:80px; white-space:nowrap; }
.qo-topbar-timer i { color:#16a34a; font-size:16px; }
.qo-topbar-counter { font-size:15px; font-weight:700; color:#475569; flex:1; text-align:center; white-space:nowrap; }
.qo-topbar-actions { display:flex; align-items:center; gap:8px; }
.qo-topbar-icon-btn { display:flex; align-items:center; gap:5px; padding:6px 10px; border-radius:8px; border:none;
  background:#f1f5f9; color:#475569; font-size:13px; font-weight:700; cursor:pointer; white-space:nowrap; }
.qo-topbar-icon-btn:hover { background:#e2e8f0; }
.qo-topbar-quit-btn { background:#ef4444; color:#fff; border-radius:50%; width:38px; height:38px; padding:0; justify-content:center; box-shadow:0 2px 8px rgba(239,68,68,.35); }
.qo-topbar-quit-btn:hover { background:#dc2626; }
.qo-topbar-progress { display:none; height:4px; background:#e2e8f0; position:sticky; top:222px; z-index:1000; }
.qo-topbar-progress-fill { height:100%; background:linear-gradient(90deg,#22c55e,#1a5c48); transition:width 1s linear; }
.qo-mob-overlay { display:none; position:fixed; top:168px; left:0; right:0; bottom:0; background:rgba(0,0,0,.4); z-index:1002; }
.qo-mob-overlay.open { display:block; }
.qo-mob-nav-panel { position:fixed; top:168px; right:-340px; width:310px; max-width:85vw; height:calc(100vh - 168px);
  background:#fff; z-index:1003; padding:14px; overflow-y:auto; transition:right .3s ease; display:flex; flex-direction:column; gap:12px; box-shadow:-4px 0 20px rgba(0,0,0,.15); }
.qo-mob-nav-panel.open { right:0; }
.qo-mob-panel-header { display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid #e2e8f0; padding-bottom:10px; }
.qo-mob-panel-title { font-size:14px; font-weight:700; color:#1e293b; }
.qo-mob-panel-close { background:none; border:none; font-size:18px; color:#94a3b8; cursor:pointer; }

@media (max-width: 768px) {
  .qo-wrapper { grid-template-columns: 1fr; }
  .qo-sidebar { display: none; }
  .qo-main    { padding: 16px; }
  .qo-options { grid-template-columns: 1fr; }
  .qo-topbar  { display:flex; }
  .qo-topbar-progress { display:block; }

  /* Le header fixe mesure 128px sur mobile (la top-bar est masquée) */
  .qo-topbar          { top: 128px; }
  .qo-topbar-progress { top: 182px; }
  .qo-mob-overlay     { top: 128px; }
  .qo-mob-nav-panel   { top: 128px; height: calc(100vh - 128px); }

  /* Le badge question + niveau ne doit pas passer sous la barre */
  .qo-q-header { scroll-margin-top: 195px; padding-top: 4px; }
  .qo-q-badge  { font-size: .95rem; }
}

/* Petits téléphones */
@media (max-width: 430px) {
  .qo-main           { padding: 12px; }
  .qo-q-badge        { font-size: .9rem; padding: 5px 12px; }
  .qo-instruction    { font-size: .92rem; }
  .qo-enonce         { font-size: .92rem; }
  .qo-opt-btn        { padding: 12px 12px; font-size: .92rem; }
  .qo-bottom-nav     { flex-wrap: wrap; gap: 8px; }
  .qo-bottom-nav .qo-btn-prev,
  .qo-bottom-nav .qo-btn-next { flex: 1; justify-content: center; }
  .qo-audio-card     { padding: 12px; }
  .qo-topbar-counter { font-size: 13px; }
  .qo-topbar-timer   { font-size: 16px; min-width: 66px; }
}

/* ── Transcription ──────────────────────────────────────── */
.qo-transcription-wrap {
  margin-top: 8px;
}
.qo-transcription-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all .15s;
}
.qo-transcription-btn:hover { background: #f1f5f9; border-color: var(--qo-green); color: var(--qo-green); }
.qo-transcription-btn i { transition: transform .2s; }
.qo-transcription-body {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 14px 16px;
  font-size: .9rem;
  line-height: 1.7;
  color: #374151;
}

/* ── Bouton Révision ────────────────────────────────────── */
.qo-btn-revise {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1.5px solid #d97706;
  background: #fff;
  color: #92400e;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.qo-btn-revise:hover, .qo-btn-revise.active {
  background: #fef3c7;
  border-color: #d97706;
}
.qo-nav-btn.qo-nav-revise { background: #fef3c7; border-color: #d97706; color: #92400e; }
