/* =========================================================================
   Plateforme (login + admin + étudiant) — DESIGN SYSTEM « La Belle Vie »
   Direction artistique reconstruite d'après les maquettes de référence :
   bleu marine profond + accent orange, cartes blanches premium, ombres
   douces, RTL arabe. Toutes les classes existantes sont conservées :
   seul l'aspect visuel change (aucune logique touchée).
   ========================================================================= */
:root {
  /* ---- Marque ---- */
  --navy:      #15294b;   /* bleu marine principal (sidebar, titres, boutons) */
  --navy-700:  #1d365f;
  --navy-600:  #27497c;
  --navy-900:  #0e1d39;
  --orange:    #e8843a;   /* accent (CTA, highlights, WhatsApp-ish) */
  --orange-600:#d4722a;
  --orange-bg: #fdeede;
  --wa:        #1faf54;

  /* ---- Compat (anciens noms => nouvelle palette, pour les styles inline JS) ---- */
  --blue: var(--navy); --blue-600: var(--navy-700);
  --black: #16233c; --ink: #16233c;
  --yellow: var(--orange); --yellow-deep: var(--orange-600); --yellow-light: var(--orange-bg);

  /* ---- Neutres ---- */
  --bg:       #f3f6fb;    /* fond de page */
  --card:     #ffffff;
  --line:     #e7ecf4;    /* bordures de cartes */
  --line-2:   #eef2f8;
  --gray-50:  #f7f9fc;
  --gray-100: #f1f4f9;
  --gray-200: #e7ecf4;
  --gray-300: #d6deea;
  --gray-500: #7a879c;    /* texte secondaire */
  --gray-700: #41506b;
  --text:     #36465f;

  /* ---- Statut ---- */
  --green: #1aa05a; --green-bg: #e6f6ec;
  --amber: #c98317; --amber-bg: #fbf0d9;
  --red:   #dc4a40; --red-bg:   #fdeae8;

  /* ---- Formes ---- */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(21,41,75,.05), 0 1px 3px rgba(21,41,75,.05);
  --shadow:    0 6px 22px rgba(21,41,75,.07);
  --shadow-lg: 0 18px 44px rgba(21,41,75,.16);
  --header-h:  68px;
  --sidebar-w: 250px;

  /* ---- Polices arabes ---- */
  --font-body:  'Tajawal', 'Cairo', 'Segoe UI', system-ui, sans-serif;
  --font-head:  'Cairo', 'Noto Kufi Arabic', 'Segoe UI', system-ui, sans-serif;
  --font-title: 'Noto Kufi Arabic', 'Cairo', system-ui, sans-serif;
  --font-btn:   'Cairo', 'Tajawal', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body); color: var(--text); background: var(--bg);
  line-height: 1.7; font-size: 15px; direction: rtl; text-align: right;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; color: var(--navy); }
a { color: var(--navy); text-decoration: none; }
button { font-family: var(--font-btn); cursor: pointer; }
img { max-width: 100%; }
code { font-family: 'Cairo', monospace; background: var(--gray-100); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 13px; color: var(--navy); }
::selection { background: var(--orange); color: #fff; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 80% -10%, #1e3a63 0%, var(--navy) 45%, var(--navy-900) 100%);
}
.login-card {
  background: var(--card); width: 100%; max-width: 420px; border-radius: 22px;
  box-shadow: var(--shadow-lg); padding: 40px 34px; text-align: center; border: 1px solid var(--line);
}
.login-logo {
  width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 18px;
  background: linear-gradient(160deg, var(--navy-600), var(--navy)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  box-shadow: 0 10px 24px rgba(21,41,75,.28);
}
.login-card h1 { font-family: var(--font-title); font-size: 23px; color: var(--navy); margin-bottom: 6px; }
.login-card .sub { color: var(--gray-500); font-size: 14px; margin-bottom: 26px; }
.login-back { display: inline-block; margin-top: 18px; font-family: var(--font-head); font-weight: 700; font-size: 14px; color: var(--orange); }
.login-back:hover { color: var(--orange-600); }

.form-group { text-align: right; margin-bottom: 17px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 7px; color: var(--gray-700); font-family: var(--font-head); }
.form-control {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 15px; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; font-family: var(--font-body);
}
.form-control:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 4px rgba(39,73,124,.14); }
.form-control::placeholder { color: #aab4c6; }
textarea.form-control { resize: vertical; min-height: 72px; line-height: 1.7; }
select.form-control { background-position: left 12px center; }

/* ---------- BOUTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  padding: 10px 18px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; background: #fff; color: var(--navy);
  transition: background .15s, box-shadow .15s, border-color .15s, transform .1s; font-family: var(--font-btn);
}
.btn:hover { background: var(--gray-50); border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover, .btn-navy:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; box-shadow: 0 8px 20px rgba(21,41,75,.22); }
.btn-accent { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-accent:hover { background: var(--orange-600); border-color: var(--orange-600); color: #fff; }
.btn-danger { background: #fff; color: var(--red); border-color: #f0c4c0; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-success { background: #fff; color: var(--green); border-color: #bfe6cd; }
.btn-success:hover { background: var(--green-bg); border-color: var(--green); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 17px; text-align: right; border: 1px solid; }
.alert-error { background: var(--red-bg); color: #a8332b; border-color: #f3cdc9; }
.alert-success { background: var(--green-bg); color: #14693c; border-color: #c2e8cf; }
.hidden { display: none !important; }

/* ---------- LAYOUT ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: #cdd8ec; flex-shrink: 0;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; right: 0; left: auto; z-index: 30;
  transition: transform .25s; box-shadow: 0 0 40px rgba(14,29,57,.25);
}
.sidebar .brand {
  font-family: var(--font-title); height: var(--header-h); padding: 0 18px; font-size: 16.5px; font-weight: 800; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 11px; flex-shrink: 0;
}
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.10);
  display: flex; align-items: center; justify-content: center; font-size: 20px; border: 1px solid rgba(255,255,255,.12);
}
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px;
  color: #b9c5dc; font-size: 14.5px; font-weight: 600; margin-bottom: 3px; position: relative;
  transition: background .15s, color .15s; font-family: var(--font-head);
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.10); color: #fff; }
.nav a.active::before { content: ''; position: absolute; inset-inline-start: 0; top: 18%; height: 64%; width: 4px; border-radius: 4px; background: var(--orange); }
.nav a .ic { width: 22px; text-align: center; font-size: 17px; opacity: .95; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { font-size: 13px; color: #93a3c0; margin-bottom: 11px; padding: 0 6px; }
.user-chip strong { color: #fff; display: block; font-size: 14.5px; font-family: var(--font-head); }
.sidebar-foot .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.14); }
.sidebar-foot .btn:hover { background: rgba(255,255,255,.16); }

.main { flex: 1; margin-right: var(--sidebar-w); margin-left: 0; min-width: 0; }
.topbar {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-family: var(--font-title); font-size: 19px; color: var(--navy); }
.burger { display: none; background: var(--gray-50); border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 42px; font-size: 20px; color: var(--navy); }
.content { padding: 26px; max-width: 1240px; }

/* ---------- CARTES / GRILLE ---------- */
.grid { display: grid; gap: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .1s; }
.card-pad { padding: 22px 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .12s; }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat .label { font-size: 13px; color: var(--gray-500); font-weight: 700; font-family: var(--font-head); }
.stat .value { font-family: var(--font-title); font-size: 30px; font-weight: 800; color: var(--navy); margin-top: 6px; letter-spacing: -.5px; }
.stat .value small { font-size: 15px; color: var(--gray-500); font-weight: 700; }
.stat.accent { position: relative; overflow: hidden; }
.stat.accent::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: linear-gradient(var(--orange), var(--orange-600)); }

.section-title { font-family: var(--font-head); font-size: 17px; color: var(--navy); font-weight: 800; margin: 28px 0 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 14px; flex-wrap: wrap; gap: 11px; }
.section-head h3 { font-family: var(--font-head); font-size: 17px; color: var(--navy); }

/* ---------- TABLE ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 17px; text-align: right; font-size: 14.5px; border-bottom: 1px solid var(--line-2); }
th { background: var(--gray-50); color: var(--gray-700); font-weight: 700; font-size: 12.5px; font-family: var(--font-head); letter-spacing: .2px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
td.actions { white-space: nowrap; text-align: left; }
td.actions .btn { margin-right: 5px; }
.table-scroll { overflow-x: auto; }

/* ---------- BADGES ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; font-family: var(--font-head); }
.badge-green { background: var(--green-bg); color: #157a45; }
.badge-red { background: var(--red-bg); color: #b83b32; }
.badge-amber { background: var(--amber-bg); color: #9a6512; }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-blue { background: #e8eefb; color: var(--navy-600); }

/* ---------- PROGRESSION ---------- */
.progress { height: 9px; background: var(--gray-200); border-radius: 999px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--navy)); border-radius: 999px; transition: width .4s; }
.progress.lg { height: 12px; }
.progress-row { display: flex; align-items: center; gap: 11px; }
.progress-row small { font-size: 13px; color: var(--gray-700); min-width: 38px; font-family: var(--font-head); font-weight: 700; }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(14,29,57,.5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; z-index: 50; overflow-y: auto;
}
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); animation: pop .16s ease; border: 1px solid var(--line); }
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(-10px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 23px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-family: var(--font-head); font-size: 18px; color: var(--navy); }
.modal-close { background: var(--gray-50); border: 1px solid var(--line); border-radius: 9px; width: 32px; height: 32px; font-size: 19px; color: var(--gray-500); line-height: 1; }
.modal-close:hover { background: var(--gray-100); color: var(--navy); }
.modal-body { padding: 23px; }
.modal-foot { padding: 16px 23px; border-top: 1px solid var(--line); display: flex; justify-content: flex-start; gap: 11px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* ---------- LECTEUR VIDÉO ---------- */
.player-layout { display: grid; grid-template-columns: 330px 1fr; gap: 22px; align-items: start; }
.player-main video { width: 100%; border-radius: var(--radius); background: #000; display: block; }
.video-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-height: 76vh; overflow-y: auto; box-shadow: var(--shadow-sm); }
.module-group { border-bottom: 1px solid var(--line-2); }
.module-group h4 { font-family: var(--font-head); padding: 12px 16px; font-size: 13.5px; color: var(--navy); background: var(--gray-50); position: sticky; top: 0; }
.module-group h4 .mcount { font-family: var(--font-body); font-weight: 600; color: var(--gray-500); font-size: 12px; }
.video-item { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; font-size: 14px; transition: background .12s; }
.video-item:hover { background: var(--gray-50); }
.video-item.active { background: #eef3fb; border-inline-end: 3px solid var(--orange); }
.video-item .vnum { flex-shrink: 0; font-family: var(--font-head); font-weight: 700; font-size: 12.5px; color: var(--gray-700); background: var(--gray-100); border-radius: 7px; padding: 2px 7px; min-width: 30px; text-align: center; }
.video-item.active .vnum { background: var(--navy); color: #fff; }
.video-item .vstatus { width: 18px; text-align: center; flex-shrink: 0; }
.video-item .vtitle { flex: 1; min-width: 0; }
.video-item .vt-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-item .mini-progress { height: 4px; background: var(--gray-200); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.video-item .mini-progress > span { display: block; height: 100%; background: var(--navy-600); border-radius: 999px; }
.vnum-lg { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: #fff; background: var(--navy); border-radius: 7px; padding: 2px 9px; vertical-align: middle; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.done { background: var(--green); }
.dot.progress { background: var(--orange); }
.dot.none { background: var(--gray-300); }

.player-bar { display: flex; align-items: center; justify-content: space-between; margin: 17px 0; gap: 13px; flex-wrap: wrap; }
.player-meta h2 { font-family: var(--font-head); font-size: 20px; color: var(--navy); }
.player-meta p { color: var(--gray-500); font-size: 14px; margin-top: 4px; }

.empty { text-align: center; padding: 56px 20px; color: var(--gray-500); font-size: 15px; }
.empty .big { font-size: 44px; margin-bottom: 12px; }

/* ---------- QUIZ ---------- */
.quiz-q { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 17px; box-shadow: var(--shadow-sm); }
.quiz-q .qnum { font-family: var(--font-head); font-size: 13px; color: var(--orange); font-weight: 700; }
.quiz-q .qtext { font-family: var(--font-head); font-size: 16.5px; font-weight: 700; color: var(--navy); margin: 5px 0 15px; }
.quiz-opt { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); margin-bottom: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.quiz-opt:hover { border-color: var(--navy-600); background: var(--gray-50); }
.quiz-opt input { width: 18px; height: 18px; accent-color: var(--navy); }
.quiz-opt.correct { border-color: var(--green); background: var(--green-bg); }
.quiz-opt.wrong { border-color: var(--red); background: var(--red-bg); }
.quiz-q img.qimg { display: block; max-width: 100%; width: auto; height: auto; max-height: 50vh; object-fit: contain; border-radius: 12px; margin: 0 auto 13px; background: var(--navy-900); }

.result-hero { text-align: center; padding: 32px; }
.result-hero .score { font-family: var(--font-title); font-size: 58px; font-weight: 800; }
.result-hero .score.pass { color: var(--green); }
.result-hero .score.fail { color: var(--red); }

.flex { display: flex; gap: 11px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 11px; flex-wrap: wrap; }
.muted { color: var(--gray-500); font-size: 14px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 14.5px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--navy); }
textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.65; }

.toast {
  position: fixed; bottom: 24px; left: 24px; right: auto; background: var(--navy); color: #fff;
  padding: 14px 19px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-size: 14.5px; z-index: 100; opacity: 0; transform: translateY(10px); transition: all .2s;
  font-family: var(--font-head); font-weight: 600;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); }

.list-card { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:17px 19px; box-shadow:var(--shadow-sm); margin-bottom:13px; }
.pdf-row { display:flex; align-items:center; gap:15px; }
.pdf-ico { width:46px; height:46px; border-radius:12px; background:var(--red-bg); color:var(--red); display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }

@media (max-width: 880px) {
  .player-layout { grid-template-columns: 1fr; }
  .video-list { max-height: none; order: 2; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-right: 0; }
  .burger { display: block; }
  .content { padding: 16px; }
  .cards { grid-template-columns: 1fr 1fr; }
  th, td { padding: 11px 13px; }
}
.backdrop { position: fixed; inset: 0; background: rgba(14,29,57,.4); z-index: 25; }

/* ---------- PHASE EXAMEN — Banque ---------- */
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.qcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: box-shadow .2s, transform .1s; }
.qcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.qcard-img { aspect-ratio: 16/9; background: var(--navy-900); cursor: pointer; overflow: hidden; }
.qcard-img img { width: 100%; height: 100%; object-fit: cover; }
.qcard-img .noimg { color: #6b7da0; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 13px; }
.qcard-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.qcard-text { font-size: 14px; color: var(--text); min-height: 22px; line-height: 1.6; }
.qcard-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.qedit-img { text-align: center; margin-bottom: 6px; }
.qedit-img img { max-height: 260px; border-radius: 10px; border: 1px solid var(--line); }
.abadge { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: #e8eefb; color: var(--navy); font-family: var(--font-head); font-weight: 700; font-size: 13px; flex-shrink: 0; }

/* Contrôle segmenté */
.seg { display: inline-flex; background: var(--gray-100); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 7px 15px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--gray-500); font-family: var(--font-head); transition: all .15s; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

/* Options examen / entraînement */
.exam-layout { display: grid; grid-template-columns: 1fr 230px; gap: 18px; align-items: start; }
.exam-opt { display: flex; align-items: center; gap: 11px; padding: 13px 15px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); margin-bottom: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.exam-opt:hover { border-color: var(--navy-600); background: var(--gray-50); }
.exam-opt.selected { border-color: var(--navy); background: #eef3fb; }
.exam-opt.correct { border-color: var(--green); background: var(--green-bg); }
.exam-opt.wrong { border-color: var(--red); background: var(--red-bg); }

/* Navigateur de questions */
.qnav { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); }
.qnav-btn { aspect-ratio: 1; border: 1.5px solid var(--gray-200); background: #fff; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--gray-700); font-family: var(--font-head); }
.qnav-btn.done { background: var(--green-bg); color: #157a45; border-color: #c2e8cf; }
.qnav-btn.cur { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Entraînement */
.train-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.train-chip { border: 1.5px solid var(--gray-200); background: #fff; border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--navy); font-family: var(--font-head); box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; transition: all .12s; }
.train-chip:hover { border-color: var(--navy-600); background: var(--gray-50); }
.train-chip .cn { background: var(--navy); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.explain { background: var(--gray-50); border-inline-start: 3px solid var(--orange); padding: 11px 14px; border-radius: 10px; margin-top: 12px; font-size: 14px; line-height: 1.7; }
.explain.ok { border-color: var(--green); background: var(--green-bg); color: #14532d; }
.explain.no { border-color: var(--red); background: var(--red-bg); color: #7f1d1d; }

/* Résultats / recommandations */
.recs { list-style: none; padding: 0; }
.recs li { padding: 10px 13px; border-radius: 10px; background: var(--gray-50); border: 1px solid var(--line-2); margin-bottom: 7px; font-size: 14px; }
.missed-item { display: flex; gap: 13px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.missed-item img { width: 110px; height: 64px; object-fit: cover; border-radius: 9px; flex-shrink: 0; }

/* Simulation d'examen */
.exam-stage { max-width: 1000px; margin: 0 auto; }
.exam-img-wrap { width: 100%; background: var(--navy-900); border-radius: 16px; padding: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; box-shadow: var(--shadow); }
.exam-img { display: block; margin: 0 auto; max-width: 90%; width: auto; height: auto; max-height: 65vh; object-fit: contain; border-radius: 10px; }
.serie { font-family: var(--font-head); font-weight: 700; color: var(--orange); font-size: 13px; }
.btn-lg { padding: 14px 40px; font-size: 16px; border-radius: 12px; }
@media (max-width: 760px) {
  .exam-img-wrap { padding: 6px; border-radius: 12px; }
  .exam-img { max-width: 100%; width: 100%; max-height: 46vh; }
  .btn-lg { width: 100%; }
}

/* Timer + choix 1-4 */
.exam-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.exam-timer { font-family: var(--font-head); font-weight: 800; background: var(--navy); color: #fff; padding: 9px 20px; border-radius: 999px; font-size: 15px; box-shadow: var(--shadow-sm); }
.exam-timer strong { color: #ffd9bf; font-size: 18px; }
.exam-timer.low { background: var(--red-bg); color: var(--red); box-shadow: none; animation: pulse .6s infinite alternate; }
.exam-timer.low strong { color: var(--red); }
.exam-timer.waiting { background: var(--orange-bg); color: var(--orange-600); animation: waitpulse 1.1s infinite alternate; }
@keyframes waitpulse { from { opacity: 1; } to { opacity: .6; } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.06); } }
.exam-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 460px; margin: 6px auto 0; }
.choice-btn { aspect-ratio: 1; border: 2px solid var(--gray-200); background: #fff; border-radius: 16px; font-family: var(--font-title); font-weight: 800; font-size: 28px; color: var(--navy); transition: all .12s; box-shadow: var(--shadow-sm); }
.choice-btn:hover { border-color: var(--navy-600); background: var(--gray-50); }
.choice-btn.sel { border-color: var(--navy); background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(21,41,75,.25); }
.choice-btn.correct { border-color: var(--green); background: var(--green-bg); color: #157a45; }
.choice-btn.wrong { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.choice-btn:disabled { cursor: default; }
.answer-line { background: var(--gray-50); border: 1px solid var(--line-2); padding: 10px 13px; border-radius: 10px; margin-top: 10px; font-size: 14.5px; }
.answer-line .ok { color: var(--green); } .answer-line .no { color: var(--red); }
audio { width: 100%; max-width: 420px; height: 40px; margin-top: 4px; }

/* Modal de révision admin */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.rv-label { font-family: var(--font-head); font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: var(--navy); }
.rv-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; display: block; aspect-ratio: 16/9; object-fit: cover; }
.rv-audio { margin-top: 8px; }
.rv-audio .muted { display: block; font-size: 12.5px; margin-bottom: 3px; }
.ans-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 320px; }
.ans-pick { aspect-ratio: 1; border: 2px solid var(--gray-200); background: #fff; border-radius: 14px; font-family: var(--font-title); font-weight: 800; font-size: 22px; color: var(--navy); }
.ans-pick:hover { border-color: var(--navy-600); }
.ans-pick.on { border-color: var(--green); background: var(--green-bg); color: #157a45; }
.ans-pick.big { font-size: 26px; border-radius: 16px; }

/* Remplacement d'images */
.img-upload-box { margin-top: 10px; padding: 12px; border: 1.5px dashed var(--gray-300); border-radius: 12px; background: var(--gray-50); }
.img-upload-box .img-warn { font-size: 12.5px; color: var(--red); margin: 0 0 8px; line-height: 1.7; }
#cleanPreview, #corrPreview { aspect-ratio: auto; max-height: 240px; object-fit: contain; background: var(--navy-900); }

/* Onglets de filtre (candidats) */
.seg-tabs { flex-wrap: wrap; }
.seg-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 5px; border-radius: 20px; background: var(--gray-200); color: var(--gray-500); font-size: 12px; font-weight: 700; }
.seg button.on .seg-count { background: var(--navy); color: #fff; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
tr.row-deleted { opacity: 0.55; }

/* Mode تحقق سريع */
.fq-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.fq-grid { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.fq-main { background: var(--navy-900); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.fq-img { width: 100%; height: auto; max-height: 68vh; object-fit: contain; border-radius: 8px; display: block; margin: 0 auto; }
.fq-side { display: flex; flex-direction: column; gap: 10px; }
.fq-clean { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.fq-side .ans-picker { grid-template-columns: repeat(4, 1fr); }
.fq-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.fq-buttons .btn { width: 100%; }
@media (max-width: 880px) { .fq-grid { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .exam-layout { grid-template-columns: 1fr; }
  .qnav { order: -1; }
  .qgrid { grid-template-columns: 1fr 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .exam-choices { max-width: 100%; }
}

/* =========================================================================
   DASHBOARD CANDIDAT (espace étudiant) — classes préfixées « sd- ».
   Même direction artistique : bleu marine premium + accent orange.
   ========================================================================= */
/* Logo dans la barre latérale candidat */
.brand .blogo {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; background: #fff;
  object-fit: cover; border: 2px solid rgba(255,255,255,.25); box-shadow: 0 6px 16px rgba(0,0,0,.25);
}

/* Carte de bienvenue */
.sd-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-700) 60%, var(--navy-600) 100%);
  border-radius: var(--radius-lg); color: #fff; padding: 22px 24px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.sd-hero::after { content: ''; position: absolute; inset-inline-start: -60px; top: -60px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.05); pointer-events: none; }
.sd-hero-logo {
  width: 74px; height: 74px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #fff;
  border: 3px solid rgba(255,255,255,.85); box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.sd-hero .sh-body { flex: 1; min-width: 220px; }
.sd-hero .sh-hi { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: #cdd9ec; }
.sd-hero .sh-name { font-family: var(--font-title); font-weight: 800; font-size: 24px; line-height: 1.5; }
.sd-hero .sh-cat { margin-top: 6px; display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 6px 16px; font-family: var(--font-head); font-weight: 800; font-size: 14.5px; }
.sd-hero .sh-cat .code { background: var(--orange); color: #fff; border-radius: 8px; padding: 1px 10px; font-size: 15px; }
.sd-hero .sh-badges { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.sd-hero .sh-badges span { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.14); color: #e4ebf6; border-radius: 999px; padding: 4px 13px; font-size: 12.5px; font-weight: 700; font-family: var(--font-head); }
.sd-hero .sh-prog { min-width: 190px; text-align: center; }
.sd-hero .sh-prog .pv { font-family: var(--font-title); font-weight: 800; font-size: 34px; }
.sd-hero .sh-prog .pl { font-size: 12.5px; color: #cdd9ec; font-weight: 700; font-family: var(--font-head); margin-bottom: 6px; }
.sd-hero .sh-prog .progress { background: rgba(255,255,255,.16); }
.sd-hero .sh-prog .progress > span { background: linear-gradient(90deg, var(--orange), #f0a066); }

/* Bloc « خطوتك التالية » */
.sd-next {
  background: var(--orange-bg); border: 1.5px solid #f3d4b6; border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 18px; display: flex; align-items: center; gap: 15px; flex-wrap: wrap;
}
.sd-next .nx-ic { width: 46px; height: 46px; border-radius: 13px; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; box-shadow: 0 8px 18px rgba(232,132,58,.35); }
.sd-next .nx-body { flex: 1; min-width: 200px; }
.sd-next .nx-label { font-size: 12px; font-weight: 800; color: var(--orange-600); font-family: var(--font-head); letter-spacing: .3px; }
.sd-next .nx-text { font-family: var(--font-head); font-weight: 800; color: var(--navy); font-size: 16.5px; line-height: 1.7; }
.sd-next .nx-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Colonnes de suivi (vidéos / examens) */
.sd-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-bottom: 6px; }
.sd-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.sd-card .sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.sd-card .sc-head h3 { font-family: var(--font-head); font-size: 15.5px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.sd-card .sc-body { padding: 16px 18px; }
.sd-card .sc-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; }
.sd-card .sc-row b { color: var(--navy); font-family: var(--font-head); }

/* Accès rapide */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; }
.quick-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 17px 13px; text-align: center; display: block;
  color: var(--navy); font-family: var(--font-head); font-weight: 800; font-size: 14px;
  transition: box-shadow .18s, transform .12s, border-color .18s;
}
.quick-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--orange); }
.quick-card .qc-ic {
  width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 9px; font-size: 22px;
  background: var(--gray-100); display: flex; align-items: center; justify-content: center;
}
.quick-card span { display: block; font-size: 11.5px; color: var(--gray-500); font-weight: 600; margin-top: 3px; }

@media (max-width: 880px) { .sd-2col { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .sd-hero { padding: 18px 16px; }
  .sd-hero .sh-prog { min-width: 100%; }
  .sd-next .nx-actions { width: 100%; }
  .sd-next .nx-actions .btn { flex: 1; text-align: center; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
}
