/* ============================================================
   ACADÉMIE HPO — academie.css
   Charte HPO LAB : Karla, noir & blanc strict, alternance
   sombre / clair. App responsive mobile-first.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Karla:wght@400;500;700&display=swap');

:root {
    --c-black: #000000;
    --c-white: #ffffff;
    --c-ink:   #111111;
    --c-soft:  #f5f5f5;
    --c-line:  rgba(255,255,255,0.10);
    --c-line-d: #e2e2e2;
    --c-mut:   rgba(255,255,255,0.62);
    --c-ok:    #2faa6a;
    --c-warn:  #d8a23a;
    --c-err:   #e55;
    --f: 'Karla', system-ui, sans-serif;
    --maxw: 680px;
    --maxw-wide: 1040px;
    --nav-h: 56px;
    --rad: 6px;
    --trans: 0.2s ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--f);
    background: var(--c-black);
    color: var(--c-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg, video { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; margin: 0 0 .6rem; }
p { margin: 0 0 1rem; }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--c-white); color: var(--c-black);
    padding: .5rem 1rem; z-index: 300; font-weight: 700;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--c-white); outline-offset: 2px; }

/* ── En-tête fixe ─────────────────────────────────────────── */
.app-header {
    position: fixed; inset: 0 0 auto 0; z-index: 100;
    height: var(--nav-h);
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--c-line);
}
.app-header .bar {
    max-width: var(--maxw-wide); margin: 0 auto; height: 100%;
    padding: 0 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: .5px; }
.brand .logo {
    width: 30px; height: 30px; border: 2px solid var(--c-white);
    display: grid; place-items: center; font-size: .8rem; font-weight: 700;
}
.brand small { display: block; font-size: .62rem; font-weight: 400; color: var(--c-mut); letter-spacing: 2px; text-transform: uppercase; }

.top-nav { display: flex; align-items: center; gap: 1.4rem; }
.top-nav a { font-size: .9rem; color: var(--c-mut); transition: color var(--trans); position: relative; padding: .2rem 0; }
.top-nav a:hover, .top-nav a.active { color: var(--c-white); }
.top-nav a.active::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--c-white);
}
.top-nav .who { font-size: .82rem; color: var(--c-mut); border-left: 1px solid var(--c-line); padding-left: 1.2rem; }
.btn-logout { font-size: .82rem; border: 1px solid var(--c-line); padding: .35rem .85rem; border-radius: var(--rad); color: var(--c-white); transition: all var(--trans); }
.btn-logout:hover { background: var(--c-white); color: var(--c-black); }

.nav-toggle { display: none; background: none; border: 1px solid var(--c-line); color: #fff; width: 40px; height: 36px; border-radius: var(--rad); cursor: pointer; font-size: 1.1rem; }

/* ── Conteneur principal ──────────────────────────────────── */
main { padding-top: calc(var(--nav-h) + 2rem); padding-bottom: 5rem; min-height: 100vh; }
.wrap { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

.page-head { margin-bottom: 2rem; }
.page-head .eyebrow {
    display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: 2px;
    color: var(--c-mut); border: 1px solid var(--c-line); padding: .25rem .8rem; border-radius: 20px; margin-bottom: .9rem;
}
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.page-head p { color: var(--c-mut); max-width: 60ch; }

/* ── Boutons ──────────────────────────────────────────────── */
.btn {
    display: inline-block; border: 1px solid var(--c-white);
    padding: .7rem 1.8rem; font-size: .98rem; font-weight: 700; letter-spacing: .4px;
    color: var(--c-white); background: none; font-family: inherit; cursor: pointer;
    transition: all var(--trans); border-radius: var(--rad);
}
.btn:hover { background: var(--c-white); color: var(--c-black); }
.btn-solid { background: var(--c-white); color: var(--c-black); }
.btn-solid:hover { background: transparent; color: var(--c-white); }
.btn-sm { padding: .45rem 1rem; font-size: .85rem; }
.btn-ghost { border-color: var(--c-line); font-weight: 500; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-danger { border-color: var(--c-err); color: #ffb4b4; }
.btn-danger:hover { background: var(--c-err); color: #fff; }

/* ── Cartes & grilles ─────────────────────────────────────── */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    border: 1px solid var(--c-line); border-radius: var(--rad);
    padding: 1.3rem; background: rgba(255,255,255,0.02);
    transition: border-color var(--trans), transform var(--trans);
}
.card:hover { border-color: rgba(255,255,255,0.28); }
.card h3 { font-size: 1.05rem; }
.card .meta { font-size: .8rem; color: var(--c-mut); }

/* Cartes statistiques */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 2.2rem; }
.stat { border: 1px solid var(--c-line); border-radius: var(--rad); padding: 1.1rem 1.2rem; }
.stat .num { font-size: 2rem; font-weight: 700; display: block; }
.stat .lab { font-size: .76rem; text-transform: uppercase; letter-spacing: 1.4px; color: var(--c-mut); }

/* ── Barre de progression ─────────────────────────────────── */
.progress { height: 8px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--c-white); border-radius: 99px; transition: width .5s ease; }

/* ── Badges ───────────────────────────────────────────────── */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .5px; padding: .2rem .6rem; border-radius: 99px; border: 1px solid var(--c-line); text-transform: uppercase; }
.badge-ok { color: var(--c-ok); border-color: rgba(47,170,106,.5); }
.badge-warn { color: var(--c-warn); border-color: rgba(216,162,58,.5); }
.badge-lock { color: var(--c-mut); }

/* ── Liste formations ─────────────────────────────────────── */
.formation-card { display: flex; flex-direction: column; }
.formation-card .thumb {
    aspect-ratio: 16/9; background: #0c0c0c center/cover no-repeat;
    border: 1px solid var(--c-line); border-radius: var(--rad);
    display: grid; place-items: center; margin-bottom: .9rem; position: relative;
}
.formation-card .thumb .play {
    width: 48px; height: 48px; border: 2px solid #fff; border-radius: 50%;
    display: grid; place-items: center; opacity: .85;
}
.formation-card .thumb .play::after { content: ''; border-left: 12px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 3px; }
.formation-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 1rem; }

/* ── Lecteur vidéo ────────────────────────────────────────── */
.player-wrap { max-width: 920px; margin: 0 auto; }
.player-box { background: #000; border: 1px solid var(--c-line); border-radius: var(--rad); overflow: hidden; }
.player-box video { width: 100%; display: block; background: #000; }
.player-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* ── Agenda / calendrier ──────────────────────────────────── */
.agenda-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.5rem; }
.cal { border: 1px solid var(--c-line); border-radius: var(--rad); padding: 1rem; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-grid .dow { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--c-mut); text-align: center; padding: .3rem 0; }
.cal-cell { aspect-ratio: 1; border: 1px solid transparent; border-radius: 4px; padding: .35rem; font-size: .8rem; position: relative; }
.cal-cell.in { border-color: var(--c-line); }
.cal-cell.today { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.4); font-weight: 700; }
.cal-cell .dot { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.cal-cell .dot i { width: 5px; height: 5px; border-radius: 50%; background: #fff; display: block; }
.cal-cell .dot i.session { background: #fff; }
.cal-cell .dot i.echeance { background: var(--c-warn); }
.cal-cell .dot i.note { background: var(--c-ok); }

.timeline { display: flex; flex-direction: column; gap: .7rem; }
.tl-item { border: 1px solid var(--c-line); border-left-width: 3px; border-radius: var(--rad); padding: .8rem 1rem; }
.tl-item.session { border-left-color: #fff; }
.tl-item.echeance { border-left-color: var(--c-warn); }
.tl-item.echeance_ok { border-left-color: var(--c-ok); }
.tl-item.note { border-left-color: var(--c-ok); }
.tl-item .when { font-size: .78rem; color: var(--c-mut); text-transform: uppercase; letter-spacing: 1px; }
.tl-item h4 { margin: .2rem 0 .25rem; font-size: .98rem; }
.tl-item p { margin: 0; font-size: .88rem; color: var(--c-mut); }

/* ── Tableaux (admin) ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--rad); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
table.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--c-mut); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: rgba(255,255,255,0.03); }

/* ── Formulaires ──────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .82rem; color: var(--c-mut); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .8px; }
.input, select, textarea {
    width: 100%; padding: .7rem .9rem; font-family: inherit; font-size: 1rem;
    background: rgba(255,255,255,0.04); border: 1px solid var(--c-line); color: #fff; border-radius: var(--rad);
    transition: border-color var(--trans);
}
.input:focus, select:focus, textarea:focus { border-color: rgba(255,255,255,0.55); outline: none; }
textarea { resize: vertical; min-height: 90px; }
select option { background: #111; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Sections claires (alternance charte) ─────────────────── */
.section-light { background: var(--c-white); color: var(--c-ink); }
.section-light .card { border-color: var(--c-line-d); background: #fff; }
.section-light .btn { border-color: var(--c-ink); color: var(--c-ink); }
.section-light .btn:hover { background: var(--c-ink); color: #fff; }

/* ── Alertes ──────────────────────────────────────────────── */
.alert { padding: .8rem 1rem; border-radius: var(--rad); font-size: .9rem; margin-bottom: 1.2rem; border: 1px solid; }
.alert-ok { border-color: rgba(47,170,106,.5); color: #9fe3bf; background: rgba(47,170,106,.08); }
.alert-err { border-color: rgba(229,85,85,.5); color: #ffbcbc; background: rgba(229,85,85,.08); }

/* ── Connexion ────────────────────────────────────────────── */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-aside { background: #000; position: relative; display: flex; flex-direction: column; justify-content: center; padding: 3rem; border-right: 1px solid var(--c-line); overflow: hidden; }
.login-aside .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(var(--c-line) 1px, transparent 1px), linear-gradient(90deg, var(--c-line) 1px, transparent 1px); background-size: 40px 40px; opacity: .4; }
.login-aside .content { position: relative; z-index: 1; }
.login-aside .big { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; }
.login-aside .sub { color: var(--c-mut); letter-spacing: 2px; text-transform: uppercase; font-size: .8rem; }
.login-aside blockquote { border-left: 2px solid #fff; padding-left: 1rem; margin: 2rem 0 0; color: var(--c-mut); font-style: italic; }
.login-aside .typed { min-height: 1.4em; }
.login-aside .typed::after { content: '▋'; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.login-main { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 1.4rem; }
.login-card .muted { color: var(--c-mut); font-size: .9rem; margin-bottom: 2rem; }

/* ── Empty state ──────────────────────────────────────────── */
.empty { border: 1px dashed var(--c-line); border-radius: var(--rad); padding: 2.5rem 1rem; text-align: center; color: var(--c-mut); }

/* ── Pied de page ─────────────────────────────────────────── */
.app-footer { border-top: 1px solid var(--c-line); padding: 1.5rem 0; text-align: center; font-size: .78rem; color: var(--c-mut); }

/* ── Onglets admin ────────────────────────────────────────── */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; border-bottom: 1px solid var(--c-line); margin-bottom: 1.8rem; }
.tabs a { padding: .7rem 1.1rem; font-size: .9rem; color: var(--c-mut); border-bottom: 2px solid transparent; }
.tabs a.active, .tabs a:hover { color: #fff; border-bottom-color: #fff; }

.section-title { font-size: .75rem; text-transform: uppercase; letter-spacing: 3px; color: var(--c-mut); margin: 0 0 1.2rem; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2,1fr); }
    .stats { grid-template-columns: repeat(2,1fr); }
    .agenda-layout { grid-template-columns: 1fr; }
    .login-screen { grid-template-columns: 1fr; }
    .login-aside { display: none; }
}
@media (max-width: 640px) {
    .grid-3, .grid-2, .row-2 { grid-template-columns: 1fr; }
    .top-nav { position: fixed; inset: var(--nav-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: 0; background: #050505; border-bottom: 1px solid var(--c-line); padding: .5rem 1.25rem 1rem; display: none; }
    .top-nav.open { display: flex; }
    .top-nav a { padding: .8rem 0; border-bottom: 1px solid var(--c-line); }
    .top-nav .who { border-left: 0; padding-left: 0; padding-top: .6rem; }
    .nav-toggle { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* -- Accordeon contenu pedagogique -- */
.accordion { display:flex; flex-direction:column; gap:.5rem; }
.acc-item { border:1px solid var(--c-line); border-radius:var(--rad); overflow:hidden; background:rgba(255,255,255,0.02); }
.acc-item summary { list-style:none; cursor:pointer; padding:1rem 1.1rem; display:flex; justify-content:space-between; align-items:center; gap:1rem; font-weight:700; }
.acc-item summary::-webkit-details-marker { display:none; }
.acc-item summary:hover { background:rgba(255,255,255,0.04); }
.acc-q { flex:1; }
.acc-q::before { content:"? "; color:var(--c-mut); font-weight:400; }
.acc-mark { width:22px; height:22px; border:1px solid var(--c-line); border-radius:50%; display:grid; place-items:center; font-size:.8rem; color:var(--c-ok); flex:none; }
.acc-mark.ok { border-color:var(--c-ok); background:rgba(47,170,106,.12); }
.acc-item[open] summary { border-bottom:1px solid var(--c-line); }
.acc-body { padding:1.1rem; }
.acc-text { color:rgba(255,255,255,0.85); line-height:1.7; margin-bottom:1rem; }
.acc-links { display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1rem; }
.acc-valid { display:flex; gap:.6rem; align-items:center; font-size:.9rem; color:var(--c-mut); border-top:1px solid var(--c-line); padding-top:.9rem; }
