/* Espace formateur : accueil protégé et mode présentateur (diaporama + notes). */
[hidden] { display: none !important; }

.admin-link { color: inherit; opacity: 0.7; }
.admin-link:hover { opacity: 1; }

/* Formulaire du code */
.admin-gate {
  max-width: 440px;
  margin: 24px auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.admin-gate h2 { margin: 8px 0 6px; font-family: var(--font-head); }
.admin-gate p { color: var(--muted); margin: 0 0 18px; }
.admin-gate-icon .icon { width: 32px; height: 32px; color: var(--accent); }
.admin-gate-row { display: flex; gap: 8px; }
.admin-gate input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.admin-gate input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.admin-gate .admin-gate-error { color: #dc2626; margin: 12px 0 0; }
.pres-lock { padding-block: 10vh; }

/* Liste des chapitres */
.admin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.admin-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.admin-row > div { flex: 1; min-width: 0; }
.admin-row small { display: block; color: var(--muted); margin-top: 2px; }
.admin-row .card-num { position: static; font-size: 1.6rem; }
.admin-logout { margin-top: 20px; text-align: right; }
@media (max-width: 600px) {
  .admin-row { flex-wrap: wrap; }
  .admin-row .btn { width: 100%; justify-content: center; }
}

/* ---------------- Mode présentateur ---------------- */
body.pres-page { background: #05070d; color: #e8edf5; min-height: 100vh; }
.pres { display: flex; flex-direction: column; height: 100vh; }
.pres-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #0d1220;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}
.pres-back { display: flex; align-items: center; gap: 6px; color: #94a3b8; text-decoration: none; min-width: 0; flex: 1; }
.pres-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres-back:hover { color: #fff; }
.pres-tools, .pres-timer { display: flex; align-items: center; gap: 8px; }
.pres-counter { color: #94a3b8; font-variant-numeric: tabular-nums; margin-right: 4px; }
.pres-time { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.pres-clock { font-family: var(--font-mono); color: #94a3b8; margin-left: 6px; }
.pres .icon-btn { background: #161d30; color: #e8edf5; border-color: #2a3350; }
.pres .icon-btn:disabled { opacity: 0.35; }
.pres .btn-small:not(.btn-primary) { background: #161d30; color: #e8edf5; border-color: #2a3350; }

/* Éléments propres à une vue */
body[data-role='diapo'] [data-only='notes'],
body[data-role='notes'] [data-only='diapo'] { display: none !important; }

.pres-body { flex: 1; min-height: 0; display: flex; gap: 20px; padding: 20px; }
.pres-current { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.pres-frame { width: 100%; }
.pres-current .marpit { width: min(100%, calc((100vh - 100px) * 16 / 9)); margin-inline: auto; }
.pres .marpit > svg { display: block; width: 100%; height: auto; }
.pres-current .marpit > svg { display: none; cursor: pointer; box-shadow: 0 20px 60px -20px #000; }
.pres-current .marpit > svg.is-active { display: block; }

/* Diaporama : la diapositive occupe tout l'écran */
body[data-role='diapo'] .pres-bar { opacity: 0.25; transition: opacity 0.2s; }
body[data-role='diapo'] .pres-bar:hover { opacity: 1; }
body[data-role='diapo'] .pres-body { padding: 12px; }
#stage:fullscreen { background: #000; padding: 0; }
#stage:fullscreen .marpit { width: min(100vw, calc(100vh * 16 / 9)); }
#stage:fullscreen svg { box-shadow: none; }

/* Notes : diapositive actuelle à gauche, suivante + notes à droite */
body[data-role='notes'] .pres-current { flex: 1.35; align-items: flex-start; }
body[data-role='notes'] .pres-current .marpit { width: min(100%, calc((100vh - 120px) * 16 / 9)); }
.pres-side { flex: 0 0 var(--side-w, 42%); min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.pres-side h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; margin: 0 0 8px; font-weight: 600; }
.pres-next .marpit { width: var(--next-w, 80%); opacity: 0.85; }
.pres-side.no-next .pres-next .marpit, .pres-side.no-next .pres-end { display: none; }

/* Poignées de redimensionnement (glisser ; double-clic = taille par défaut) */
body[data-role='notes'] .pres-body { gap: 0; }
.pres-split { flex: 0 0 20px; display: flex; align-items: center; justify-content: center; cursor: col-resize; touch-action: none; border-radius: 6px; }
.pres-split span { width: 4px; height: 48px; border-radius: 4px; background: #2a3350; transition: background 0.15s; }
.pres-split-h { flex-basis: 20px; cursor: row-resize; }
.pres-split-h span { width: 48px; height: 4px; }
.pres-split:hover span, .pres-split:focus-visible span, .pres-split.is-dragging span { background: #a78bfa; }
.pres-split:focus-visible { outline: none; }
body.is-resizing { user-select: none; }
body.is-resizing { cursor: col-resize; }
body.is-resizing.is-resizing-h { cursor: row-resize; }
.pres-end { color: #94a3b8; font-style: italic; margin: 0; }
.pres-notes {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0d1220;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
}
.pres-notes-head { display: flex; justify-content: space-between; align-items: center; }
.pres-notes-head h2 { margin: 0; }
.pres-notes-head span { display: flex; gap: 6px; }
.pres-notes-text { flex: 1; overflow: auto; line-height: 1.5; padding-top: 8px; }
.pres-notes-text p { margin: 0 0 0.7em; }
.pres-notes-text ul, .pres-notes-text ol { margin: 0 0 0.7em; padding-left: 1.2em; }
.pres-notes-text strong { color: #fff; }
.pres-notes-text a { color: #7dd3fc; }
.pres-notes-text code { font-family: var(--font-mono); font-size: 0.9em; }
.pres-empty { color: #64748b; font-style: italic; }

@media (max-width: 900px) {
  .pres { height: auto; min-height: 100vh; }
  .pres-bar { flex-wrap: wrap; }
  .pres-body { flex-direction: column; }
  .pres-side { flex-basis: auto; }
  .pres-split[data-split='cols'] { display: none; }
  .pres-current .marpit, body[data-role='notes'] .pres-current .marpit { width: 100%; }
  .pres-notes { min-height: 40vh; }
}
