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

:root {
  --bg: #F3F4F6;
  --white: #FFFFFF;
  --primary: #6366F1;
  --primary-light: #EEF2FF;
  --primary-shadow: rgba(99,102,241,0.25);
  --border: #E5E7EB;
  --text: #111827;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ─── LAYOUT ───────────────────────────────── */
.app { display: flex; height: 100vh; }

/* ─── MAIN ───────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 62px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left  { display: flex; align-items: center; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; }

/* ─── TOPBAR WORDMARK ───────────────────────────────── */
.topbar-wordmark {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  letter-spacing: 0.01em;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 5px 12px;
}
.topbar-wordmark:hover { border-color: var(--primary); color: var(--primary); }
.topbar-wordmark span { color: var(--primary); }

/* ─── TOPBAR NAV ───────────────────────────────── */
.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.topnav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.topnav-btn:hover  { background: #F3F4F6; color: var(--text); }
.topnav-btn.active { background: var(--primary); color: #fff; }


.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 13px;
  max-width: 260px;
  width: 100%;
  transition: border-color 0.15s;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box svg { width: 15px; height: 15px; color: var(--text-light); flex-shrink: 0; }
.search-box input {
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  width: 100%;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-light); }

/* ─── CONTENT ───────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #D1D5DB transparent;
}

/* ─── COURSES VIEW ───────────────────────────────── */
#courses-view.hidden { display: none; }
#global-view.hidden  { display: none; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.course-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  border: 1px solid var(--border);
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.1);
  border-color: transparent;
}

.card-header {
  height: 138px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-emoji { font-size: 52px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)); }
.card-files-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(0,0,0,0.06);
}

/* Progress bar at bottom of course card */
.card-progress {
  height: 4px;
  background: var(--border);
}
.card-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.5s ease;
  border-radius: 0 4px 4px 0;
}

.card-body { padding: 15px 16px 16px; }

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: #F3F4F6;
  padding: 2px 7px;
  border-radius: 20px;
}

.card-title { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--text); margin-bottom: 12px; }

.card-footer {
  padding-top: 11px;
  border-top: 1px solid #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-desc {
  font-size: 11.5px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.card-arrow {
  width: 26px;
  height: 26px;
  background: #F3F4F6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.course-card:hover .card-arrow { background: var(--primary); }
.course-card:hover .card-arrow svg { stroke: #fff; }
.card-arrow svg { width: 13px; height: 13px; stroke: var(--text-muted); transition: stroke 0.15s; }

/* ─── COURSE DETAIL ───────────────────────────────── */
#course-detail { display: none; }
#course-detail.active { display: block; }

.breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: 20px; font-size: 13.5px; }
.bc-back {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
  transition: color 0.15s;
}
.bc-back:hover   { color: var(--primary); }
.bc-back svg     { width: 15px; height: 15px; }
.bc-sep          { color: var(--border); font-size: 16px; }
.bc-current      { font-weight: 600; color: var(--text); }

.detail-hero {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.hero-icon {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}

.hero-info  { flex: 1; min-width: 0; }
.hero-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.hero-desc  { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.hero-tags  { display: flex; gap: 6px; flex-wrap: wrap; }

.hero-stats { display: flex; gap: 20px; flex-shrink: 0; }
.stat {
  text-align: center;
  padding: 12px 16px;
  background: #FAFAFA;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 72px;
}
.stat-val { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.stat-lbl { font-size: 11px; color: var(--text-light); font-weight: 500; }

/* ─── TABS ───────────────────────────────── */
.tabs-row {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px;
  width: fit-content;
  margin-bottom: 22px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.tab-btn:hover { background: #F3F4F6; color: var(--text); }
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-shadow);
}

.tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,0.22);
  min-width: 18px;
  text-align: center;
}
.tab-btn:not(.active) .tab-count { background: #F3F4F6; color: var(--text-light); }

/* ─── FILES GRID ───────────────────────────────── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.file-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.file-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px var(--primary-shadow);
}
.file-card-read { border-color: #86EFAC; }

.file-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #FEF2F2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.file-name { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; flex: 1; }
.file-ext  { font-size: 10.5px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }

.file-actions { display: flex; gap: 6px; }

.file-open {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  background: #F3F4F6;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.file-open:hover { background: var(--primary); color: #fff; }
.file-open svg { width: 13px; height: 13px; flex-shrink: 0; }

.file-read-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.file-read-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.file-read-btn.read  { background: #DCFCE7; color: #16A34A; border-color: #86EFAC; }
.file-read-btn.read:hover { background: #FEE2E2; color: #DC2626; border-color: #FCA5A5; }

/* ─── EMPTY STATE ───────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
  text-align: center;
  color: var(--text-light);
}
.empty-emoji { font-size: 44px; margin-bottom: 16px; opacity: 0.45; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.empty-text  { font-size: 13px; max-width: 280px; }

/* ─── NO RESULTS ───────────────────────────────── */
.no-results {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  color: var(--text-light);
  text-align: center;
}
.no-results-icon  { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.no-results-title { font-size: 15px; font-weight: 600; color: var(--text-muted); }

/* ─── VIDEO LAYOUT ───────────────────────────────── */
.video-layout { display: flex; gap: 20px; align-items: flex-start; }
.video-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.video-main-player {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}
.video-main-player video { display: block; width: 100%; max-height: 460px; background: #000; }
.video-main-info  { display: flex; align-items: baseline; gap: 10px; }
.video-main-title { font-size: 15.5px; font-weight: 700; color: var(--text); flex: 1; }
.video-main-count { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.video-playlist {
  width: 290px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 540px;
}
.playlist-header {
  padding: 13px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--white);
  letter-spacing: 0.02em;
}
.playlist-body  { overflow-y: auto; flex: 1; }
.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.playlist-item:last-child { border-bottom: none; }
.playlist-item:hover  { background: var(--bg); }
.playlist-item.active { background: var(--primary-light); }
.playlist-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.playlist-item.active .playlist-num         { background: var(--primary); color: #fff; }
.playlist-item-title                        { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; }
.playlist-item.active .playlist-item-title  { color: var(--primary); font-weight: 600; }

.video-solo { background: var(--white); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.video-solo-title {
  padding: 16px 20px 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.video-solo video { display: block; width: 100%; max-height: 520px; background: #000; }

/* ─── QUIZ ───────────────────────────────── */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.quiz-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-card:hover    { border-color: var(--primary); box-shadow: 0 4px 20px var(--primary-shadow); }
.quiz-card-icon     { font-size: 26px; }
.quiz-card-title    { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; flex: 1; }
.quiz-card-meta     { font-size: 11.5px; color: var(--text-light); }
.quiz-score-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; width: fit-content;
}
.quiz-score-badge.good { background: #DCFCE7; color: #16A34A; }
.quiz-score-badge.mid  { background: #FEF9C3; color: #A16207; }
.quiz-score-badge.bad  { background: #FEE2E2; color: #DC2626; }

.quiz-view-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.quiz-back-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px; background: #F3F4F6; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer;
  font-family: inherit; transition: background 0.15s, color 0.15s;
}
.quiz-back-btn:hover  { background: var(--primary-light); color: var(--primary); }
.quiz-view-title      { font-size: 16px; font-weight: 700; }
.quiz-view-count      { font-size: 12px; color: var(--text-light); margin-left: auto; }

.quiz-questions { display: flex; flex-direction: column; gap: 14px; }
.quiz-q-card    { background: var(--white); border: 1px solid var(--border); border-radius: 13px; padding: 20px; }
.quiz-q-num     { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.quiz-q-text    { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 14px; line-height: 1.5; }
.quiz-choices   { display: flex; flex-direction: column; gap: 8px; }
.quiz-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 9px; border: 1.5px solid var(--border);
  cursor: pointer; font-size: 13.5px; color: var(--text);
  transition: border-color 0.15s, background 0.15s; user-select: none;
}
.quiz-choice:hover        { border-color: var(--primary); background: var(--primary-light); }
.quiz-choice.selected     { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 500; }
.quiz-choice.correct      { border-color: #16A34A; background: #DCFCE7; color: #15803D; font-weight: 500; cursor: default; }
.quiz-choice.wrong        { border-color: #DC2626; background: #FEE2E2; color: #B91C1C; font-weight: 500; cursor: default; }
.quiz-choice.show-correct { border-color: #16A34A; background: #DCFCE7; color: #15803D; cursor: default; }
.quiz-choice.neutral-done { cursor: default; }
.choice-letter {
  width: 24px; height: 24px; border-radius: 50%; background: #F3F4F6;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.quiz-choice.selected .choice-letter     { background: var(--primary); color: #fff; }
.quiz-choice.correct .choice-letter      { background: #16A34A; color: #fff; }
.quiz-choice.wrong .choice-letter        { background: #DC2626; color: #fff; }
.quiz-choice.show-correct .choice-letter { background: #16A34A; color: #fff; }

.quiz-result-banner {
  background: var(--white); border: 1px solid var(--border); border-radius: 13px;
  padding: 20px 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px;
}
.quiz-result-score      { font-size: 36px; font-weight: 800; line-height: 1; }
.quiz-result-score.good { color: #16A34A; }
.quiz-result-score.mid  { color: #CA8A04; }
.quiz-result-score.bad  { color: #DC2626; }
.quiz-result-label      { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.quiz-result-text       { font-size: 13px; color: var(--text-muted); }

.quiz-footer { margin-top: 20px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.quiz-submit-btn {
  padding: 10px 24px; background: var(--primary); color: #fff; border: none;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: opacity 0.15s;
}
.quiz-submit-btn:hover    { opacity: 0.9; }
.quiz-submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.quiz-retry-btn {
  padding: 10px 20px; background: #F3F4F6; color: var(--text); border: none;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.15s;
}
.quiz-retry-btn:hover { background: #E5E7EB; }

/* ─── SCROLLBAR ───────────────────────────────── */
.content::-webkit-scrollbar       { width: 5px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }


/* ─── FICHE DE COURS ─────────────────────────── */
.fiche-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
}

.fiche-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 26px;
}

.fiche-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 14px;
}

.fiche-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fiche-meta-chip {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
}

.fiche-meta-chip-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 3px;
}

.fiche-meta-chip-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.fiche-ue-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
  background: var(--primary-light);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
}

.fiche-ue-badge strong {
  color: var(--primary);
  font-weight: 700;
}

.fiche-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fiche-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.fiche-list li::before {
  content: '→';
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.fiche-prog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fiche-prog-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.fiche-prog-num {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.fiche-prog-content { flex: 1; }

.fiche-prog-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.fiche-prog-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.fiche-eval-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fiche-eval-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 10px;
}

.fiche-eval-pct {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  width: 52px;
  flex-shrink: 0;
  text-align: center;
}

.fiche-eval-info { flex: 1; }

.fiche-eval-nature {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.fiche-eval-periode {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.fiche-pdf-viewer {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
}

.fiche-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.fiche-pdf-viewer iframe {
  width: 100%;
  height: 75vh;
  border: none;
  display: block;
}

.fiche-pdf-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.fiche-pdf-open:hover { opacity: 0.85; }

.fiche-pdf-open svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
}

.fiche-pdf-link-row {
  display: flex;
  justify-content: flex-end;
}


/* ─── MODULES ───────────────────────────────── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.module-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.module-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-shadow);
  transform: translateY(-2px);
}

.module-card-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.module-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.module-card-arrow {
  width: 26px;
  height: 26px;
  background: #F3F4F6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.module-card-arrow svg { width: 13px; height: 13px; }
.module-card:hover .module-card-arrow { background: var(--primary); color: #fff; }

/* ─── MODULE DETAIL ───────────────────────────────── */
.module-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.module-back-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: #F3F4F6;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.module-back-btn:hover { background: var(--primary-light); color: var(--primary); }

.module-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.module-empty {
  padding: 20px 16px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
}


/* ─── RESPONSIVE MOBILE ≤700px ───────────────────────────────── */
@media (max-width: 700px) {

  /* Topbar : logo + search sur ligne 1, nav sur ligne 2 */
  .topbar {
    height: auto;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .topbar-left  { flex: 0 0 auto; }
  .topbar-right { display: flex; justify-content: flex-end; }
  .topbar-logo  { height: 28px; }
  .search-box   { max-width: none; }

  /* Nav : scroll horizontal sur mobile */
  .topbar-nav {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topnav-btn { flex-shrink: 0; padding: 6px 14px; font-size: 13px; }

  /* Content padding */
  .content { padding: 16px; }

  /* Courses grid : 1 colonne */
  .courses-grid { grid-template-columns: 1fr; }

  /* Tabs : scroll horizontal */
  .tabs-row {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .tabs-row::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }

  /* Files grid : 1 colonne */
  .files-grid { grid-template-columns: 1fr; }

  /* Hero détail : empilé */
  .detail-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 14px;
  }
  .hero-stats {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
  }
  .stat { min-width: 64px; padding: 10px 12px; }

  /* Video layout : empilé */
  .video-layout { flex-direction: column; }
  .video-playlist {
    width: 100%;
    max-height: 260px;
  }

  /* Modules grid : 1 colonne */
  .modules-grid { grid-template-columns: 1fr; }

  /* Quiz grid : 1 colonne */
  .quiz-grid { grid-template-columns: 1fr; }

  /* Fiche */
  .fiche-meta-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── AUTH OVERLAY ──────────────────────────────────── */
#auth-overlay {
  display: none; /* DÉSACTIVÉ — retirer cette ligne pour réactiver */
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 4px 32px rgba(0,0,0,0.08);
}

.auth-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
  display: inline-block;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px 14px;
  margin-bottom: 20px;
}
.auth-logo span { color: var(--primary); }

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 8px;
}
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}
.auth-input--error {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2) !important;
  animation: auth-shake 0.4s ease;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.auth-error {
  font-size: 12px;
  color: #EF4444;
  min-height: 18px;
  margin-bottom: 12px;
  text-align: left;
}

.auth-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.auth-btn:hover  { opacity: 0.88; }
.auth-btn:active { transform: scale(0.98); }

/* Dark mode support for auth overlay */
[data-theme="dark"] #auth-overlay { background: var(--bg); }
[data-theme="dark"] .auth-card    { background: var(--white); border-color: var(--border); }
[data-theme="dark"] .auth-input   { background: var(--bg); color: var(--text); border-color: var(--border); }

