/* ═══════════════════════════════════════════════════════════
   Caly-Elec Classroom — styles partagés des pages formateur /
   stagiaire / vidéoprojecteur.

   ⚠ ALIGNEMENT SUR L'INTERFACE DE RÉFÉRENCE (app.caly-elec.com,
   refonte « artboard 4a » — voir css/accueil-refonte.css).
   Les jetons --cls-* ne portent PLUS de valeurs propres : ce sont
   des ALIAS de la palette « 4a ». On branche, on ne repeint pas —
   ainsi le jour où la Classroom sera intégrée dans la coquille du
   LMS, il n'y aura rien à redéfaire côté couleurs, et
   css/classroom-mode.css (qui n'existait que pour rattraper le
   choc sombre/clair) devient inutile.
   ═══════════════════════════════════════════════════════════ */

:root {
    /* ── Palette « 4a » — mêmes noms que accueil-refonte.css ──
       Redéclarée ici parce que les pages Classroom ne chargent pas
       accueil-refonte.css (qui est scopé sur #nfx-home-content). */
    --corail: #ff5a3c;
    --corail-clair: #ff9166;
    --corail-fonce: #ea580c;
    --corail-glow: rgba(255, 90, 60, .4);
    --encre: #17181c;           /* barres de chrome sombres */
    --encre-grad-2: #2b2d36;
    --creme: #faf9f7;           /* fond de page */
    --blanc: #fff;              /* surfaces / cartes */
    --ink: #17181c;             /* texte principal */
    --txt-mute-62: rgba(0, 0, 0, .62);
    --txt-mute-50: rgba(0, 0, 0, .5);
    --bord-carte: rgba(0, 0, 0, .09);

    /* ── Alias Classroom → palette « 4a » ── */
    --cls-bg: var(--creme);
    --cls-surface: var(--blanc);
    --cls-surface-light: rgba(0, 0, 0, .04);
    --cls-border: var(--bord-carte);
    --cls-text: var(--ink);
    --cls-text-muted: var(--txt-mute-62);
    --cls-primary: var(--corail);
    --cls-primary-hover: var(--corail-fonce);
    --cls-success: #22c55e;
    --cls-danger: #ef4444;

    /* Composantes RVB — pour les rgba() de voile/lueur. Permettent de
       changer l'accent ou l'encre à UN seul endroit au lieu de ~20. */
    --cls-primary-rgb: 255, 90, 60;
    --cls-encre-rgb: 23, 24, 28;

    /* ── Chrome sombre (barre formateur, barre d'état stagiaire) ──
       Reprend la barre supérieure du LMS : fond encre, texte blanc. */
    --cls-topbar: var(--encre);
    --cls-topbar-text: #fff;
    --cls-topbar-text-dim: rgba(255, 255, 255, .62);
    --cls-topbar-border: rgba(255, 255, 255, .12);
    --cls-topbar-hover: rgba(255, 255, 255, .1);
}

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

body.classroom-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cls-bg);
    color: var(--cls-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Forms (join + host creation) ────────────── */
.cls-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.cls-logo {
    text-align: center;
    margin-bottom: 32px;
}
.cls-logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.9rem;
    color: var(--cls-primary);
    margin-bottom: 4px;
}
.cls-logo p {
    color: var(--cls-text-muted);
    font-size: 0.9rem;
}

.cls-card {
    background: var(--cls-surface);
    border: 1px solid var(--cls-border);
    border-radius: 14px;
    padding: 32px 28px;
    /* Ombre allégée : 0.35 était calibré pour un fond ardoise, sur le
       crème du LMS ça faisait une tache grise autour de la carte. */
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.cls-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    color: var(--cls-text);
    margin-bottom: 20px;
    text-align: center;
}

.cls-form-group {
    margin-bottom: 18px;
}
.cls-form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--cls-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.cls-form-group input,
.cls-form-group select,
.cls-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--cls-bg);
    border: 1px solid var(--cls-border);
    border-radius: 8px;
    color: var(--cls-text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.cls-form-group input:focus,
.cls-form-group select:focus,
.cls-form-group textarea:focus {
    outline: none;
    border-color: var(--cls-primary);
}
.cls-form-group input.code-input {
    text-transform: uppercase;
    letter-spacing: 0.4em;
    font-family: 'Courier New', monospace;
    font-size: 1.6rem;
    text-align: center;
    font-weight: 700;
}

.cls-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    background: linear-gradient(135deg, var(--cls-primary), var(--cls-primary-hover));
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.cls-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(var(--cls-primary-rgb), 0.35); }
.cls-btn:active { transform: translateY(0); }
.cls-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cls-btn.block { width: 100%; }
.cls-btn.ghost {
    background: transparent;
    border: 1px solid var(--cls-border);
    color: var(--cls-text);
}
.cls-btn.ghost:hover { background: var(--cls-surface-light); box-shadow: none; }
.cls-btn.danger {
    background: linear-gradient(135deg, var(--cls-danger), #b91c1c);
}

/* Boutons posés SUR une barre de chrome sombre : il leur faut les
   jetons clairs, sinon --cls-text (encre) devient noir sur noir. */
.cls-host-header .cls-btn.ghost,
.cls-status-bar .cls-btn.ghost {
    border-color: var(--cls-topbar-border);
    color: var(--cls-topbar-text-dim);
}
.cls-host-header .cls-btn.ghost:hover,
.cls-status-bar .cls-btn.ghost:hover {
    background: var(--cls-topbar-hover);
    color: var(--cls-topbar-text);
}

.cls-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--cls-danger);
    /* rouge SOMBRE : #fca5a5 était lisible sur ardoise, illisible sur blanc */
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.87rem;
    margin-bottom: 16px;
    display: none;
}
.cls-error.visible { display: block; }

.cls-info {
    color: var(--cls-text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 18px;
}

/* ── Live viewer (trainee) ──────────────────── */

body.classroom-live {
    background: #000;
    overflow: hidden;
    height: 100vh;
}

/* Viewer wrapper — fills the area BELOW the 38px status bar. The
   image inside is absolutely positioned + translated so it is truly
   centered no matter what its intrinsic dimensions are. */
#classroom-viewer {
    position: fixed !important;
    top: 38px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1 !important;
    background: #000 !important;
    overflow: hidden !important;
    display: none;              /* toggled to block by JS */
}

#classroom-slide-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Slide relay image — centered via absolute + translate(-50%,-50%).
   max-width/max-height use PERCENT of the parent (#classroom-viewer),
   not viewport units, so the centering stays correct even if devtools
   or any panel is overlaying part of the viewport. */
#classroom-slide-image {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: calc(100% - 24px) !important;
    max-height: calc(100% - 24px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 !important;
    display: block !important;
}

/* ── Tool/Lab viewer (POC Phase B) ──
 * Shown when the formateur opens a lab/outil via the Ressources TOC.
 * Mutually exclusive with #classroom-viewer: when one is visible the
 * other is hidden. The iframe loads the lab URL directly — no relay. */
#classroom-tool-viewer {
    position: fixed !important;
    top: 38px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1 !important;
    background: var(--encre) !important;
    overflow: hidden !important;
    display: none;
}
#classroom-tool-viewer.visible {
    display: block;
}
#classroom-tool-frame {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    background: #fff !important;
    display: block !important;
}
#classroom-tool-title {
    position: fixed;
    top: 38px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    font-size: 0.95rem;
    padding: 4px 16px;
    background: rgba(var(--cls-primary-rgb), 0.9);
    z-index: 400;
    pointer-events: none;
    display: none;
}
#classroom-tool-title.has-text {
    display: block;
}
body.classroom-projector-mode #classroom-tool-viewer {
    top: 0 !important;
}
body.classroom-projector-mode #classroom-tool-title {
    display: none !important;
}

/* ── Projector mode (3rd screen / HDMI) ──
 * Applied via body.classroom-projector-mode when the host opens the
 * popup with ?view=projector. Strips the status bar, the trainee
 * name, the waiting-state hints and forces the slide to fill the
 * full window so it looks right on the HDMI output.
 */
body.classroom-projector-mode #classroom-status-bar {
    display: none !important;
}
body.classroom-projector-mode #classroom-viewer {
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
}
body.classroom-projector-mode #classroom-slide-image {
    max-width: calc(100% - 4px) !important;
    max-height: calc(100% - 4px) !important;
}
body.classroom-projector-mode #classroom-slide-title {
    display: none !important;
}
body.classroom-projector-mode #classroom-fullscreen-prompt {
    background: var(--encre) !important;
}
body.classroom-projector-mode #classroom-fullscreen-prompt h2 {
    color: var(--corail) !important;
    font-size: 2rem !important;
}
body.classroom-projector-mode #classroom-fullscreen-prompt p {
    color: rgba(255, 255, 255, 0.75) !important;
}
body.classroom-projector-mode #classroom-waiting {
    background: #000 !important;
}
body.classroom-projector-mode #classroom-waiting h2 {
    color: var(--corail) !important;
    font-size: 1.8rem !important;
}

/* Floating fullscreen toggle — shown ONLY in projector mode.
   Lives in the top-right corner, fades out when the mouse is
   idle so the projected image is not polluted. */
#classroom-fs-toggle {
    display: none;
    position: fixed;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(var(--cls-encre-rgb), 0.85);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #fff;
    cursor: pointer;
    z-index: 2500;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity 0.3s, background 0.15s, border-color 0.15s;
    opacity: 1;
}
#classroom-fs-toggle svg {
    width: 20px;
    height: 20px;
}
#classroom-fs-toggle:hover {
    background: rgba(var(--cls-primary-rgb), 0.4);
    border-color: var(--cls-primary);
}
body.classroom-projector-mode #classroom-fs-toggle {
    display: flex;
}
body.classroom-projector-mode #classroom-fs-toggle.dim {
    opacity: 0.12;
}
body.classroom-projector-mode #classroom-fs-toggle:hover,
body.classroom-projector-mode #classroom-fs-toggle:focus {
    opacity: 1 !important;
}

/* Slide title overlay — sits right under the status bar */
#classroom-slide-title {
    position: fixed;
    top: 38px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    font-size: 0.95rem;
    padding: 4px 16px;
    background: rgba(var(--cls-encre-rgb), 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 400;
    pointer-events: none;
    display: none;              /* shown by JS when a title is available */
}
#classroom-slide-title.has-text {
    display: block;
}

/* pen overlay canvas — absolute on top of the Reveal.js slides area */
#classroom-annotation-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

/* Pause overlay */
#classroom-pause-overlay {
    position: fixed;
    inset: 0;
    background: rgba(var(--cls-encre-rgb), 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
    color: #fff;
    text-align: center;
    padding: 20px;
}
#classroom-pause-overlay.visible { display: flex; }
#classroom-pause-overlay .cls-pause-icon {
    font-size: 4rem;
    color: var(--cls-primary);
}
#classroom-pause-overlay h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    color: var(--corail-clair);
}
#classroom-pause-overlay p {
    color: var(--cls-text-muted);
    font-size: 1rem;
    max-width: 440px;
}

/* Waiting state (session not yet live) */
#classroom-waiting {
    position: fixed;
    inset: 0;
    background: var(--cls-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 900;
    color: var(--cls-text);
    text-align: center;
    padding: 20px;
}
#classroom-waiting h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--cls-primary);
    font-size: 1.6rem;
}
#classroom-waiting .cls-spinner {
    border: 4px solid rgba(var(--cls-primary-rgb), 0.15);
    border-top-color: var(--cls-primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: cls-spin 0.9s linear infinite;
}
@keyframes cls-spin { to { transform: rotate(360deg); } }

/* Trainee status bar at top of live view */
#classroom-status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(var(--cls-encre-rgb), 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 14px;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    /* barre flottante SOMBRE au-dessus de la diapositive projetée :
       jetons de chrome, pas l'encre du corps de page */
    color: var(--cls-topbar-text-dim);
    border-bottom: 1px solid rgba(var(--cls-primary-rgb), 0.3);
}
#classroom-status-bar .cls-status-left { display: flex; gap: 12px; align-items: center; }
#classroom-status-bar .cls-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--cls-danger);
    transition: background 0.2s;
}
#classroom-status-bar .cls-status-dot.connected { background: var(--cls-success); }
#classroom-status-bar .cls-session-title { color: var(--cls-topbar-text); font-weight: 500; }

/* Activity modal (QCM Phase 1) */
#classroom-activity-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
#classroom-activity-modal.visible { display: flex; }
.cls-activity-card {
    background: var(--cls-surface);
    border: 1px solid var(--cls-primary);
    border-radius: 14px;
    padding: 28px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.cls-activity-card h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--cls-primary);
    font-size: 1.25rem;
    margin-bottom: 18px;
}
.cls-activity-choices { display: flex; flex-direction: column; gap: 10px; }
.cls-activity-choice {
    background: var(--cls-bg);
    border: 2px solid var(--cls-border);
    border-radius: 10px;
    padding: 14px 18px;
    color: var(--cls-text);
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.cls-activity-choice:hover { border-color: var(--cls-primary); }
.cls-activity-choice.selected { border-color: var(--cls-primary); background: rgba(var(--cls-primary-rgb), 0.1); }
.cls-activity-card .cls-btn { margin-top: 18px; }
.cls-activity-done {
    text-align: center;
    padding: 20px;
    color: var(--cls-success);
    font-size: 1rem;
}

/* ── Host dashboard ─────────────────────────── */

body.classroom-host {
    background: var(--cls-bg);
}

#classroom-host-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header"
        "stage"
        "toolbar";
    height: 100vh;
    gap: 0;
    position: relative;
}

/* Barre formateur = barre supérieure du LMS : fond encre, texte blanc. */
.cls-host-header {
    grid-area: header;
    background: var(--cls-topbar);
    border-bottom: 1px solid var(--cls-topbar-border);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 4px 12px;
    gap: 6px;
    min-height: 38px;
}
.cls-host-header .cls-host-title {
    font-family: 'Outfit', sans-serif;
    color: var(--cls-topbar-text);
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cls-host-header .cls-state-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}
.cls-state-badge.draft   { background: #334155; color: #cbd5e1; }
.cls-state-badge.open    { background: #1e40af; color: #93c5fd; }
.cls-state-badge.live    { background: #166534; color: #86efac; }
.cls-state-badge.paused  { background: #713f12; color: #fde047; }
.cls-state-badge.ended   { background: #7f1d1d; color: #fca5a5; }
.cls-state-badge.expired { background: #1f2937; color: #6b7280; }

.cls-host-header .cls-host-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}
.cls-host-header .cls-host-lifecycle {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: 4px;
    padding-left: 10px;
    border-left: 1px solid var(--cls-topbar-border);
}
.cls-host-header .cls-btn { padding: 5px 10px; font-size: 0.78rem; }

/* ═══ Onglets de la barre formateur ═══════════════════════════
   Calqués sur `#nfx-home-content .nfx-topnav .nfx-tab` du LMS
   (css/accueil-refonte.css) : pas d'icône, 13 px, poids 500, blanc
   à 62 %, actif = blanc gras 700 souligné 2 px corail. */
.cls-tabs {
    display: flex;
    align-items: center;
    gap: 22px;
    margin: 0 6px 0 10px;
    padding-left: 12px;
    border-left: 1px solid var(--cls-topbar-border);
    min-width: 0;
}
.cls-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 4px 0;
    margin: 0;
    color: var(--cls-topbar-text-dim);
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.cls-tab:hover { color: var(--cls-topbar-text); }
.cls-tab-active {
    color: var(--cls-topbar-text);
    font-weight: 700;
    border-bottom-color: var(--corail);
}
/* « Revenir au cours » : même forme d'onglet, mais teinté accent pour
   qu'on le repère immédiatement quand on est sorti du cours. */
.cls-tab-return {
    color: var(--corail-clair);
    font-weight: 600;
    border-bottom-color: rgba(var(--cls-primary-rgb), 0.55);
}
.cls-tab-return:hover { color: var(--corail); border-bottom-color: var(--corail); }

/* ═══ Boutons en icône seule ══════════════════════════════════ */
.cls-ico {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--cls-topbar-text-dim);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.cls-ico:hover { background: var(--cls-topbar-hover); color: var(--cls-topbar-text); }
.cls-ico-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 15px;
    padding: 0 4px;
    background: var(--cls-success);
    color: #fff;
    border-radius: 9px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
}

/* ═══ Menu « ⋯ » des réglages rares ═══════════════════════════ */
.cls-more { position: relative; display: inline-flex; }
.cls-more-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 900;
    min-width: 190px;
    padding: 5px;
    background: var(--cls-surface);
    border: 1px solid var(--cls-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
}
.cls-more.open .cls-more-menu { display: block; }
.cls-more-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 7px;
    color: var(--cls-text);
    font-family: inherit;
    font-size: 0.82rem;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.cls-more-item:hover { background: var(--cls-surface-light); }

/* Sous 1100 px la barre déborderait : on masque les libellés d'onglets
   les moins critiques plutôt que d'ouvrir une barre de défilement. */
@media (max-width: 1100px) {
    .cls-tabs { gap: 14px; }
    .cls-host-header .cls-host-title { font-size: 0.82rem; }
}

.cls-host-stage {
    grid-area: stage;
    background: #000;
    position: relative;
    overflow: hidden;
}
.cls-host-stage iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* Sidebar is now a SLIDE-OVER panel that overlays the stage from the
   right. Hidden by default; opened via the "📋 Infos séance" header
   button. This gives the course viewer 100% width at all times. */
.cls-host-sidebar {
    position: fixed;
    top: 42px;                 /* below the compact header */
    right: 0;
    width: 320px;
    max-width: 90vw;
    height: calc(100vh - 56px);
    background: var(--cls-surface);
    border-left: 1px solid var(--cls-border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
    padding: 20px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
}
.cls-host-sidebar.open {
    transform: translateX(0);
}

/* Plan sidebar — slides in from the LEFT instead of the right */
#host-plan-sidebar {
    right: auto !important;
    left: 0;
    border-left: 0;
    border-right: 1px solid var(--cls-border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    transform: translateX(-100%);
}
#host-plan-sidebar.open {
    transform: translateX(0);
}

/* Plan items inside the plan sidebar */
.cls-plan-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--cls-bg);
    border: 1px solid var(--cls-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.cls-plan-item:hover {
    border-color: var(--cls-primary);
    background: rgba(var(--cls-primary-rgb), 0.05);
}
.cls-plan-item.current {
    background: rgba(var(--cls-primary-rgb), 0.18);
    border-color: var(--cls-primary);
    box-shadow: 0 0 0 2px rgba(var(--cls-primary-rgb), 0.25);
}
.cls-plan-item.done {
    opacity: 0.55;
}
.cls-plan-item.done .cls-plan-item-num::before {
    content: '✓';
    color: var(--cls-success);
}
.cls-plan-item-num {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cls-surface);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--cls-primary);
    flex-shrink: 0;
}
.cls-plan-item-body {
    flex: 1;
    min-width: 0;
}
.cls-plan-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cls-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cls-plan-item-type {
    display: inline-block;
    padding: 1px 5px;
    margin-right: 5px;
    border-radius: 3px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cls-plan-item-type.course { background: #1e40af; color: #93c5fd; }
.cls-plan-item-type.tool { background: #0f766e; color: #5eead4; }
.cls-plan-item-meta {
    font-size: 0.65rem;
    color: var(--cls-text-muted);
    margin-top: 1px;
}
/* Backdrop behind the slide-over panel */
.cls-host-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 150;
}
.cls-host-sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}
/* Close button inside the sidebar */
.cls-sidebar-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--cls-text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.cls-sidebar-close:hover { background: var(--cls-surface-light); color: var(--cls-text); }
.cls-sidebar-block h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--cls-text-muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--cls-border);
}
.cls-trainee-list {
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
}
.cls-trainee-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    font-size: 0.85rem;
    color: var(--cls-text);
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}
.cls-trainee-item:last-child { border-bottom: none; }
.cls-trainee-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--cls-success);
}
.cls-code-display {
    background: var(--cls-bg);
    border: 1px solid var(--cls-primary);
    border-radius: 8px;
    padding: 10px 14px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 1.6rem;
    color: var(--cls-primary);
    font-weight: 700;
    letter-spacing: 0.4em;
}

/* Barre basse : même encre que la barre haute, pour que la scène noire
   (la diapositive) soit encadrée par deux bandeaux identiques. */
.cls-host-toolbar {
    grid-area: toolbar;
    background: var(--cls-topbar);
    border-top: 1px solid var(--cls-topbar-border);
    color: var(--cls-topbar-text-dim);
    padding: 8px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 34px;
    padding: 2px 12px;
}

/* External navbar (prev/next/zoom) inside the host footer.
   Lives OUTSIDE the iframe so it never appears in the captured slide. */
.cls-host-navbar {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--cls-topbar-hover);
    border: 1px solid var(--cls-topbar-border);
    border-radius: 999px;
    padding: 4px 10px;
}
.cls-nav-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--cls-topbar-text-dim);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0;
    transition: background 0.15s;
}
.cls-nav-btn svg {
    width: 15px;
    height: 15px;
}
.cls-nav-btn:hover {
    background: rgba(var(--cls-primary-rgb), 0.18);
    border-color: var(--cls-primary);
    color: var(--cls-primary);
}
.cls-nav-sep {
    width: 1px;
    height: 20px;
    background: var(--cls-topbar-border);
    margin: 0 3px;
}
.cls-nav-zoom {
    min-width: 40px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--cls-topbar-text-dim);
}
.cls-nav-counter {
    font-size: 0.75rem;
    color: var(--cls-topbar-text-dim);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    padding: 0 4px;
}
/* ── Generic modal (host quiz composer + others) ── */
.cls-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cls-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(var(--cls-encre-rgb), 0.7);
    backdrop-filter: blur(6px);
}
.cls-modal-card {
    position: relative;
    background: var(--cls-surface);
    border: 1px solid var(--cls-border);
    border-radius: 14px;
    padding: 28px 26px 22px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.cls-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--cls-text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    line-height: 1;
}
.cls-modal-close:hover { background: var(--cls-surface-light); color: var(--cls-text); }

.cls-quiz-choice-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.cls-quiz-choice-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: var(--cls-bg);
    border: 1px solid var(--cls-border);
    border-radius: 6px;
    color: var(--cls-text);
    font-size: 0.85rem;
}
.cls-quiz-choice-row .cls-quiz-correct {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--cls-text-muted);
    cursor: pointer;
}
.cls-quiz-choice-row .cls-quiz-remove {
    background: transparent;
    border: 1px solid var(--cls-border);
    color: var(--cls-danger);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.cls-quiz-choice-row .cls-quiz-remove:hover { background: rgba(239, 68, 68, 0.15); }

/* Live results bars */
.cls-result-bar {
    margin-bottom: 8px;
}
.cls-result-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--cls-text);
    margin-bottom: 3px;
}
.cls-result-bar-track {
    height: 18px;
    background: var(--cls-bg);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--cls-border);
}
.cls-result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cls-primary), var(--cls-primary-hover));
    transition: width 0.3s ease-out;
}
.cls-result-bar.correct .cls-result-bar-fill {
    background: linear-gradient(90deg, var(--cls-success), #16a34a);
}

/* ── Presentation mode (host-only, in-app fullscreen alternative) ──
 * Hides the dashboard chrome (header + footer) so the slide iframe
 * fills the full host window. A floating toolbar stays visible at
 * the bottom so the formateur can still navigate, open the sidebar,
 * launch a quiz, toggle projector, and exit the mode.
 * The user can combine this with browser F11 for true fullscreen. */

#host-present-toolbar {
    display: none;    /* toggled to flex by the .classroom-presentation-mode class */
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: rgba(var(--cls-encre-rgb), 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    padding: 6px 10px;
    gap: 5px;
    align-items: center;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    font-family: inherit;
    opacity: 1;
    transition: opacity 0.3s;
}
.cls-pt-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-family: inherit;
    padding: 0;
    transition: all 0.15s;
}
.cls-pt-btn svg { width: 17px; height: 17px; }
.cls-pt-btn:hover {
    background: rgba(var(--cls-primary-rgb), 0.3);
    border-color: var(--cls-primary);
    color: var(--cls-primary);
}
.cls-pt-btn.cls-pt-exit {
    width: auto;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fca5a5;
}
.cls-pt-btn.cls-pt-exit:hover {
    background: rgba(239, 68, 68, 0.5);
    color: #fff;
}
.cls-pt-btn.cls-pt-return {
    width: auto;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(var(--cls-primary-rgb), 0.22);
    border-color: rgba(var(--cls-primary-rgb), 0.6);
    color: var(--corail-clair);
}
.cls-pt-btn.cls-pt-return:hover {
    background: rgba(var(--cls-primary-rgb), 0.5);
    color: #fff;
}
.cls-pt-counter {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    padding: 0 8px;
    letter-spacing: 0.5px;
}
.cls-pt-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.18);
}

/* When presentation mode is ON, hide the chrome and let the stage
   iframe + the floating toolbar take over the screen. */
body.classroom-presentation-mode .cls-host-header {
    display: none !important;
}
body.classroom-presentation-mode .cls-host-toolbar {
    display: none !important;
}
body.classroom-presentation-mode #classroom-host-layout {
    grid-template-rows: 0 1fr 0 !important;
}
body.classroom-presentation-mode .cls-host-stage {
    height: 100vh !important;
}
body.classroom-presentation-mode #host-present-toolbar {
    display: flex;
}
/* Fade-out toolbar on inactivity (toggled by JS via .dim class) */
#host-present-toolbar.dim {
    opacity: 0.12;
}
#host-present-toolbar:hover,
#host-present-toolbar:focus-within {
    opacity: 1 !important;
}

.cls-pen-picker { display: flex; gap: 6px; }
.cls-pen-color {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s;
}
.cls-pen-color.selected { border-color: #fff; transform: scale(1.15); }

@media (max-width: 900px) {
    .cls-host-sidebar {
        width: 100vw;
        border-left: none;
    }
}
