/* =============================================================================
   TechForge — base.css
   Socle du thème global « NEON FORGE » (arcade sombre par défaut + variante claire)
   + chrome du site (topbar, catalogue, page cours, auth, 404, switch thème).

   Tout le site partage les mêmes "design tokens" ci-dessous : pour ajouter du
   contenu, plus besoin de réécrire du CSS — on réutilise les variables et les
   composants. base.css + mdj.css (composants gaming) + content.css (corps des
   cours) forment un seul système de design.
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   :root = thème SOMBRE (défaut, le plus "jeu vidéo").
   body.ifpa-light-mode = variante CLAIRE (togglée par darkmode.js).
   ────────────────────────────────────────────────────────────────────────── */
:root {
    color-scheme: dark;

    /* Surfaces */
    --bg:          #070b14;
    --bg-2:        #0a1020;
    --surface:     #101a2e;
    --surface-2:   #152138;
    --surface-3:   #1b2a47;
    --border:      #243352;
    --border-soft: #1a2640;

    /* Texte */
    --text:   #e9eefb;
    --muted:  #93a3c3;
    --faint:  #65769a;

    /* Néons */
    --primary:      #29e1ff;   /* cyan */
    --primary-deep: #0bb6dd;
    --violet:       #9a6bff;
    --magenta:      #ff5cae;
    --accent:       #ff5cae;   /* alias rose/magenta */
    --green:        #33f0a3;
    --amber:        #ffc44d;
    --red:          #ff6b81;
    --gold:         #ffd24a;    /* XP */
    --gold-soft:    rgba(255,210,74,.14);

    /* Néons translucides (fonds de badges / encadrés) */
    --primary-soft: rgba(41,225,255,.12);
    --violet-soft:  rgba(154,107,255,.14);
    --accent-soft:  rgba(255,92,174,.12);
    --green-soft:   rgba(51,240,163,.12);
    --amber-soft:   rgba(255,196,77,.13);
    --red-soft:     rgba(255,107,129,.12);

    /* Lueurs */
    --glow-cyan:  0 0 14px rgba(41,225,255,.40);
    --glow-pink:  0 0 14px rgba(255,92,174,.40);
    --glow-green: 0 0 14px rgba(51,240,163,.38);
    --glow-gold:  0 0 14px rgba(255,210,74,.40);

    /* Formes & ombres */
    --radius:    14px;
    --radius-sm: 9px;
    --radius-lg: 20px;
    --shadow:      0 10px 30px rgba(0,0,0,.45);
    --shadow-soft: 0 6px 18px rgba(0,0,0,.35);

    /* Typo */
    --font-display: 'Orbitron', system-ui, sans-serif;
    --font-body:    system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', 'Fira Code', monospace;

    /* Grille de fond façon HUD */
    --grid: rgba(41,225,255,.05);
}

body.ifpa-light-mode {
    color-scheme: light;

    --bg:          #eaeef7;
    --bg-2:        #e3e9f3;
    --surface:     #ffffff;
    --surface-2:   #f3f6fc;
    --surface-3:   #e8eef7;
    --border:      #d2dbeb;
    --border-soft: #e3e9f4;

    --text:   #16203a;
    --muted:  #51607c;
    --faint:  #8492ad;

    --primary:      #0e8fc7;
    --primary-deep: #0b6f9c;
    --violet:       #7c3aed;
    --magenta:      #db2777;
    --accent:       #db2777;
    --green:        #0d9b6c;
    --amber:        #b9790c;
    --red:          #e23d5a;
    --gold:         #c98a06;
    --gold-soft:    rgba(201,138,6,.12);

    --primary-soft: rgba(14,143,199,.10);
    --violet-soft:  rgba(124,58,237,.10);
    --accent-soft:  rgba(219,39,119,.10);
    --green-soft:   rgba(13,155,108,.10);
    --amber-soft:   rgba(185,121,12,.12);
    --red-soft:     rgba(226,61,90,.10);

    --glow-cyan:  0 0 0 1px rgba(14,143,199,.18);
    --glow-pink:  0 0 0 1px rgba(219,39,119,.18);
    --glow-green: 0 0 0 1px rgba(13,155,108,.18);
    --glow-gold:  0 0 0 1px rgba(201,138,6,.20);

    --shadow:      0 12px 30px rgba(31,45,80,.12);
    --shadow-soft: 0 6px 18px rgba(31,45,80,.08);

    --grid: rgba(14,143,199,.05);
}

/* ──────────────────────────────────────────────────────────────────────────
   2. RESET & BASE
   ────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background .3s, color .3s;
}

/* Grille / lueurs de fond (HUD arcade), fixe et non interactive */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(154,107,255,.16), transparent 60%),
        radial-gradient(800px 480px at 100% 0%, rgba(41,225,255,.12), transparent 55%),
        radial-gradient(700px 600px at 50% 120%, rgba(255,92,174,.10), transparent 60%),
        linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 44px 44px,
        var(--bg);
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--magenta); }

::selection { background: rgba(255,92,174,.32); color: #fff; }

/* Scrollbar gamer */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--surface-3), var(--surface-2));
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-deep); }

/* ──────────────────────────────────────────────────────────────────────────
   3. TOPBAR / NAV
   ────────────────────────────────────────────────────────────────────────── */
.tf-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: linear-gradient(180deg, rgba(16,26,46,.92), rgba(16,26,46,.78));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(41,225,255,.15), var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 9000;
}
/* Le HUD joueur (fixe, 48px de haut, au-dessus de tout) occupe le sommet : quand
   il est affiché, la barre de menu se colle JUSTE EN DESSOUS (top: 48px) au lieu
   de rester masquée derrière lui — elle reste ainsi visible au défilement. */
body.mdj-hud-visible .tf-topbar {
    top: 48px;
}
.tf-logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: .04em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tf-logo span { color: var(--primary); text-shadow: var(--glow-cyan); }

.tf-nav { display: flex; align-items: center; gap: 18px; }
.tf-nav a {
    color: var(--muted);
    font-weight: 600;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    position: relative;
    padding: 4px 2px;
}
.tf-nav a:hover { color: var(--primary); }
.tf-nav a:not(.tf-nav-logout)::after {
    content: '';
    position: absolute;
    left: 0; right: 100%; bottom: -3px;
    height: 2px;
    background: var(--primary);
    box-shadow: var(--glow-cyan);
    transition: right .2s ease;
}
.tf-nav a:not(.tf-nav-logout):hover::after { right: 0; }
.tf-nav-user {
    color: var(--text);
    font-weight: 700;
    font-size: .82rem;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-2);
}
.tf-nav-logout { color: var(--accent) !important; }
.tf-nav-logout:hover { color: var(--red) !important; }

/* ──────────────────────────────────────────────────────────────────────────
   4. LAYOUT
   ────────────────────────────────────────────────────────────────────────── */
.tf-main { max-width: 1100px; margin: 0 auto; padding: 32px 20px 80px; }

.tf-section-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin: 0 0 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tf-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* Accueil : message de bienvenue personnalisé, en grand et centré */
.tf-home {
    min-height: 62vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 18px;
    padding: 20px;
}
.tf-home-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: .01em;
    margin: 0;
}
.tf-home-title span { color: var(--primary); text-shadow: var(--glow-cyan); }
.tf-home-sub {
    color: var(--muted);
    font-size: 1.25rem;
    margin: 0;
    max-width: 620px;
}
.tf-home-cta {
    margin-top: 10px;
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--bg);
    font-weight: 700;
    font-size: .95rem;
    box-shadow: var(--glow-cyan);
    transition: transform .15s ease, box-shadow .15s ease;
}
.tf-home-cta:hover { transform: translateY(-2px); color: var(--bg); box-shadow: var(--glow-cyan), var(--shadow); }
@media (max-width: 560px) {
    .tf-home-title { font-size: 2.1rem; }
    .tf-home-sub { font-size: 1.05rem; }
}

/* Accueil : liste des discussions en cours de l'apprenant (par contenu concerné). */
.tf-home-disc {
    max-width: 760px;
    margin: 0 auto 48px;
    padding: 0 20px;
}
.tf-home-disc-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 4px;
}
.tf-home-disc-hint {
    color: var(--muted);
    font-size: .9rem;
    margin: 0 0 16px;
}
.tf-disc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tf-disc-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.tf-disc-item:hover { transform: translateY(-1px); border-color: var(--primary); box-shadow: var(--shadow); }
.tf-disc-item.is-new { border-color: var(--primary); box-shadow: var(--glow-cyan); }
.tf-disc-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
}
.tf-disc-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tf-disc-topic { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tf-disc-badge {
    font-family: var(--font-display);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--bg);
}
.tf-disc-preview {
    color: var(--muted);
    font-size: .88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.tf-disc-item.is-new .tf-disc-preview { color: var(--text); }
.tf-disc-when { color: var(--muted); font-size: .78rem; white-space: nowrap; flex-shrink: 0; }
@media (max-width: 560px) {
    .tf-disc-when { display: none; }
}

/* Barre de recherche du catalogue (filtrage des cartes en direct) */
.tf-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 0 30px;
}
.tf-search-icon {
    position: absolute;
    left: 16px;
    font-size: 1rem;
    opacity: .7;
    pointer-events: none;
}
.tf-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 44px 13px 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
}
.tf-search-input::placeholder { color: var(--faint); }
.tf-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-cyan);
}
/* Masque la croix native du <input type=search> (on gère la nôtre) */
.tf-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.tf-search-clear {
    position: absolute;
    right: 12px;
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    border: none;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--muted);
    font-size: .8rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tf-search-clear:hover { background: var(--accent-soft); color: var(--accent); }
.tf-search-empty {
    color: var(--muted);
    font-size: .95rem;
    padding: 8px 2px 24px;
}

/* Puces de filtre par type de contenu (sous la barre de recherche) */
.tf-typefilter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 26px;
}
.tf-type-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    border-radius: 20px;
    padding: 6px 14px;
    font-family: var(--font-body);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.tf-type-chip:hover { color: var(--text); border-color: var(--primary); }
.tf-type-chip.is-active {
    color: var(--bg);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--glow-cyan);
}

/* Sélecteur « Vue du groupe » (staff), à la suite des puces de masquage.
   margin-left: auto le pousse à droite de la rangée quand la place le permet ;
   il repasse à la ligne comme les puces sur petit écran (le conteneur wrap). */
.tf-groupview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.tf-groupview-label {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
}
.tf-groupview-select {
    max-width: 220px;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.tf-groupview-select:hover  { border-color: var(--primary); }
.tf-groupview-select:focus  { outline: none; border-color: var(--primary); box-shadow: var(--glow-cyan); }
/* Bandeau d'aperçu : rappelle CE QUI est filtré et comment revenir en arrière. */
.tf-groupview-note {
    margin: -14px 0 26px;
    padding: 10px 14px;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    background: var(--primary-soft, var(--surface));
    color: var(--muted);
    font-size: .85rem;
    line-height: 1.6;
}
.tf-groupview-note strong { color: var(--text); }
.tf-groupview-note a      { color: var(--primary); }

/* Élément masqué par le filtre de recherche */
.tf-hide { display: none !important; }

/* ──────────────────────────────────────────────────────────────────────────
   5. GRILLE CATALOGUE + CARTES
   ────────────────────────────────────────────────────────────────────────── */
.tf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}
.tf-card {
    position: relative;                /* ancre les overlays .mdj-* */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tf-card::before {                     /* liseré néon au survol */
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    border: 1px solid transparent;
    pointer-events: none;
    transition: border-color .2s, box-shadow .2s;
}
.tf-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow), 0 0 22px rgba(41,225,255,.18);
    border-color: var(--primary);
}
.tf-card:hover::before {
    border-color: rgba(41,225,255,.55);
    box-shadow: inset 0 0 18px rgba(41,225,255,.12);
}
.tf-card-link { display: block; color: inherit; }

.tf-card-thumb {
    height: 132px;
    overflow: hidden;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 30% 20%, rgba(41,225,255,.18), transparent 60%),
        linear-gradient(135deg, #16234a, #2a1d5e);
    border-bottom: 1px solid var(--border);
}
.tf-card-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    position: absolute; inset: 0;
    opacity: .92;
    transition: transform .35s ease, opacity .2s;
}
.tf-card:hover .tf-card-thumb img { transform: scale(1.06); opacity: 1; }
.tf-card-icon { font-size: 3rem; filter: drop-shadow(0 0 12px rgba(41,225,255,.5)); }

.tf-card-body { padding: 16px 18px 18px; }
.tf-card-cat {
    font-family: var(--font-mono);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--primary);
    font-weight: 600;
}
.tf-card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 8px 0 8px;
    color: var(--text);
}
.tf-card-excerpt {
    font-size: .86rem;
    color: var(--muted);
    margin: 0 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tf-card-foot { display: flex; align-items: center; justify-content: space-between; }
.tf-xp-badge {
    font-family: var(--font-mono);
    background: var(--gold-soft, rgba(255,210,74,.14));
    color: var(--gold);
    font-weight: 700;
    font-size: .8rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,210,74,.45);
    box-shadow: var(--glow-gold);
}
.tf-type-tag {
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
}

/* ── Catalogue par niveau : niveaux empilés, carrousel interne par niveau ── */
.tf-level-block { margin-bottom: 36px; }
.tf-level-block.is-locked { opacity: .85; }

.tf-level-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tf-level-num {
    font-family: var(--font-display); font-weight: 900; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--primary); background: var(--primary-soft);
    border: 1px solid var(--primary); border-radius: 20px; padding: 4px 12px;
}
.tf-level-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--text); margin: 0; }
.tf-level-lock { font-size: .78rem; color: var(--muted); }

/* Carrousel horizontal des cartes d'un niveau */
.tf-level-carousel { position: relative; }
.tf-level-track {
    display: flex;
    gap: 22px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    padding: 4px 2px;
    scrollbar-width: none;            /* Firefox */
    -ms-overflow-style: none;
}
.tf-level-track::-webkit-scrollbar { display: none; }
.tf-level-track .tf-card { flex: 0 0 260px; scroll-snap-align: start; }

.tf-carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); transition: all .15s ease; z-index: 3;
    box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.tf-carousel-arrow:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tf-carousel-arrow:disabled { opacity: .3; cursor: default; }
.tf-carousel-arrow[hidden] { display: none; }
.tf-carousel-prev { left: -10px; }
.tf-carousel-next { right: -10px; }

@media (max-width: 560px) {
    .tf-level-track .tf-card { flex: 0 0 78%; }
    .tf-carousel-arrow { width: 32px; height: 32px; font-size: 1.2rem; }
}

/* ──────────────────────────────────────────────────────────────────────────
   6. PAGE COURS (cadre ; le corps est dans content.css)
   ────────────────────────────────────────────────────────────────────────── */
.tf-course {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    box-shadow: var(--shadow-soft);
}
.tf-back {
    font-family: var(--font-mono);
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tf-back:hover { color: var(--primary); }
.tf-course-head {
    margin: 16px 0 22px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.tf-course-head h1 {
    font-family: var(--font-display);
    margin: 10px 0 14px;
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.15;
}
/* Conteneur du contenu importé : voir content.css pour le détail des composants. */
.tf-course-content { position: relative; border-radius: 10px; }
.tf-course-content img { max-width: 100%; height: auto; }

/* ──────────────────────────────────────────────────────────────────────────
   7. QUIZ (formulaire pré-rendu)
   ────────────────────────────────────────────────────────────────────────── */
.mdj-quiz-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0 0 16px;
    color: var(--text);
}
.mdj-quiz-q {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 0 0 14px;
    background: var(--surface-2);
}
.mdj-quiz-q-text { font-weight: 700; font-size: .92rem; padding: 0 4px; color: var(--text); }
.mdj-quiz-choice {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px; cursor: pointer; border-radius: 8px;
    transition: background .15s;
}
.mdj-quiz-choice:hover { background: var(--primary-soft); }
.mdj-quiz-choice input { accent-color: var(--primary); }
.mdj-quiz-submit { width: 100%; justify-content: center; margin-top: 6px; }

/* ──────────────────────────────────────────────────────────────────────────
   8. AVATAR + LIGNES PARCOURS
   ────────────────────────────────────────────────────────────────────────── */
.tf-avatar-letter {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: 2rem; font-weight: 900; color: #fff;
    background: linear-gradient(135deg, var(--primary-deep), var(--violet));
    box-shadow: 0 0 22px rgba(41,225,255,.35);
}
.tf-prog-list { display: flex; flex-direction: column; gap: 8px; }
.tf-prog-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color .15s, transform .15s;
}
.tf-prog-row:hover { border-color: var(--primary); transform: translateX(3px); }
.tf-prog-row-icon { font-size: 1.1rem; }
.tf-prog-row-title { font-weight: 700; flex: 1; color: var(--text); }
.tf-prog-row-date { color: var(--faint); font-size: .8rem; font-family: var(--font-mono); }

/* ──────────────────────────────────────────────────────────────────────────
   9. AUTH (login)
   ────────────────────────────────────────────────────────────────────────── */
.tf-auth { min-height: 72vh; display: flex; align-items: center; justify-content: center; }
.tf-auth-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 40px;
    width: 100%; max-width: 390px;
    box-shadow: var(--shadow), 0 0 40px rgba(41,225,255,.12);
    text-align: center;
    overflow: hidden;
}
.tf-auth-card::before {
    content: '';
    position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--violet), var(--magenta));
    box-shadow: var(--glow-cyan);
}
.tf-auth-logo {
    font-family: var(--font-display);
    font-size: 1.7rem; font-weight: 900; margin: 0 0 4px;
    text-transform: uppercase; letter-spacing: .04em;
}
.tf-auth-logo span { color: var(--primary); text-shadow: var(--glow-cyan); }
.tf-auth-sub { color: var(--muted); margin: 0 0 24px; font-size: .9rem; }
.tf-auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.tf-auth-form label {
    font-family: var(--font-mono);
    font-size: .74rem; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em;
    display: flex; flex-direction: column; gap: 6px;
}
.tf-auth-form input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    font-size: .95rem;
    font-family: var(--font-body);
    background: var(--surface-2);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.tf-auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.tf-auth-btn { justify-content: center; margin-top: 6px; width: 100%; }
.tf-auth-error {
    background: var(--red-soft); color: var(--red);
    border: 1px solid rgba(255,107,129,.4);
    border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: .85rem; margin-bottom: 18px;
}
.tf-auth-success {
    background: var(--green-soft); color: var(--green);
    border: 1px solid rgba(51,240,163,.4);
    border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: .88rem; line-height: 1.5; margin-bottom: 18px;
}
.tf-auth-hint { color: var(--faint); font-size: .78rem; margin-top: 22px; }
.tf-auth-hint code {
    font-family: var(--font-mono);
    background: var(--surface-2); color: var(--primary);
    padding: 2px 6px; border-radius: 5px;
    border: 1px solid var(--border);
}

/* ──────────────────────────────────────────────────────────────────────────
   10. 404
   ────────────────────────────────────────────────────────────────────────── */
.tf-404 { text-align: center; padding: 90px 20px; }
.tf-404 h1 {
    font-family: var(--font-display);
    font-size: 5rem; margin: 0 0 8px;
    color: var(--primary);
    text-shadow: var(--glow-cyan);
    letter-spacing: .08em;
}
.tf-404 p { color: var(--muted); margin-bottom: 24px; }

/* ──────────────────────────────────────────────────────────────────────────
   11. SWITCH DE THÈME (créé par darkmode.js — était sans style)
   ────────────────────────────────────────────────────────────────────────── */
#ifpa-dark-switch {
    position: fixed;
    bottom: 22px; left: 22px;
    z-index: 99990;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 40px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    user-select: none;
    transition: border-color .2s, box-shadow .2s, transform .15s;
}
#ifpa-dark-switch:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-soft), var(--glow-cyan);
    transform: translateY(-2px);
}
#ifpa-dark-switch-track {
    width: 38px; height: 20px;
    border-radius: 20px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    position: relative;
    transition: background .2s;
}
#ifpa-dark-switch-thumb {
    position: absolute; top: 1px; left: 1px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: var(--glow-cyan);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
body:not(.ifpa-light-mode) #ifpa-dark-switch-thumb { transform: translateX(18px); }
#ifpa-dark-switch-icon { font-size: 1rem; line-height: 1; }

/* ──────────────────────────────────────────────────────────────────────────
   12. RESPONSIVE
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 860px) { .tf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
    .tf-grid { grid-template-columns: 1fr; }
    .tf-nav { gap: 12px; }
    .tf-nav-user { display: none; }
    .tf-main { padding: 24px 14px 70px; }
}

/* Accessibilité : coupe les animations si demandé */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    html { scroll-behavior: auto; }
}

/* Bouton « remonter en haut » (pages cours/TP) — apparaît au défilement */
.tf-backtotop {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9000;
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--primary);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--primary);
    font-size: 1.3rem; font-weight: 700; line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow), var(--glow-cyan);
    opacity: 0; transform: translateY(14px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, background .15s, color .15s;
}
.tf-backtotop.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.tf-backtotop:hover { background: var(--primary); color: var(--bg); }
.tf-backtotop:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 560px) {
    .tf-backtotop { bottom: 16px; right: 16px; width: 42px; height: 42px; }
}

/* Bandeau « aperçu formateur » (route /preview/<slug>) */
.tf-preview-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 20px; padding: 12px 18px;
    border: 1px solid var(--violet); border-radius: var(--radius);
    background: var(--violet-soft); color: var(--text); font-size: .9rem;
}
.tf-preview-draft { color: var(--amber); font-weight: 700; margin-left: 6px; }

/* Barre d'actions d'un cours (ex. bouton « Télécharger en PDF ») */
.tf-course-actions {
    margin: 0 0 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Deuxième rangée de filtres du catalogue (état : validé / verrouillé) : on la
   resserre sous la rangée « type » (ou sous la barre de recherche si le filtre
   par type est absent). */
.tf-statusfilter { margin-top: -16px; }

/* ===== Ressources d'un contenu (apprenant) — rendues dans la modale latérale ===== */
.tf-attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* On fixe la couleur AUSSI au survol : la règle globale « a:hover » (plus
   spécifique qu'une simple classe) ferait sinon virer tout le texte au magenta. */
.tf-attach-link, .tf-attach-link:hover, .tf-attach-link:focus {
    display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 14px; transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.tf-attach-link:hover { border-color: var(--primary); background: var(--surface-3); transform: translateX(2px); }
.tf-attach-link:hover .tf-attach-name { color: var(--primary); }
.tf-attach-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tf-attach-icon { font-size: 1.35rem; flex: 0 0 auto; line-height: 1; }
.tf-attach-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tf-attach-name { font-weight: 600; word-break: break-word; }
.tf-attach-meta { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); }
.tf-attach-cta { flex: 0 0 auto; color: var(--primary); font-size: 1.05rem; }
