/* =========================================================
   Page "Détail d'un cours" — suivi des présences
   (audience enseignant / bureau). Tokens : assets/styles/tokens.css
   ========================================================= */

.back-link { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1rem; }
.back-link:hover { color: var(--gold-strong); }
.back-link svg { display: block; }

/* ---------------- En-tête du cours ---------------- */
.course-head {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: radial-gradient(700px 200px at 12% -30%, rgba(230, 201, 138, 0.10), transparent 60%), var(--surface-2);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.25rem;
}
.ch-eyebrow { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.ch-title { font-size: 1.5rem; font-weight: 600; margin: 0.15rem 0 0.5rem; }
.ch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; color: var(--text-muted); font-size: 0.9rem; }
.ch-time { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; color: var(--gold-strong); }
.ch-time svg { display: block; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ch-chips .chip { font-size: 0.74rem; color: var(--text); background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.12rem 0.65rem; }

/* ---------------- Panneau présences ---------------- */
.presence-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.presence-head { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* Compteur de présents */
.meter { min-width: 220px; flex: 1 1 240px; }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.meter-num { font-weight: 700; font-size: 1.05rem; }
.meter-num b { font-size: 1.5rem; color: var(--gold-strong); }
.meter-num .sep { color: var(--text-faint); margin: 0 0.15rem; }
.meter-num .lbl { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; margin-left: 0.35rem; }
.meter-pct { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }
.meter-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--border); }
.meter-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-strong)); border-radius: 999px; transition: width 0.25s ease; }

/* Actions */
.head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cd-action {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 0.85rem; border-radius: var(--radius-sm);
    font-family: inherit; font-weight: 600; font-size: 0.82rem;
    border: 1px solid var(--border-strong); background: transparent; color: var(--text);
    cursor: pointer; white-space: nowrap;
}
.cd-action:hover { background: var(--hover); color: var(--gold-strong); }
.cd-action svg { display: block; }

/* ---------------- Liste des adhérents ---------------- */
.member-list { padding: 0.4rem 0.5rem 0.6rem; }
.subhead { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); font-weight: 600; padding: 0.9rem 0rem 0.4rem; }
.member-empty { text-align: center; color: var(--text-faint); padding: 1.5rem; }

.member-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); cursor: pointer; user-select: none; }
.member-row:hover { background: var(--surface-3); }
.member-row.is-present { background: var(--gold-soft); }
.member-row.is-present:hover { background: rgba(230, 201, 138, 0.20); }

.mini-av {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-strong);
    font-size: 0.72rem; font-weight: 700;
}
.member-row.is-present .mini-av { background: var(--gold-soft); color: var(--gold-strong); border-color: var(--gold); }

.m-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.m-fullname { font-weight: 500; }
.m-fullname .tag-ext { font-size: 0.68rem; color: var(--text-faint); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 0.45rem; margin-left: 0.35rem; vertical-align: middle; }
.m-grade { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--text-muted); }

/* Ceinture en petit (composant Belt redimensionné) */
.belt-xs { display: inline-flex; align-items: center; flex: 0 0 auto; }
.belt-xs .belt { width: 38px; height: 9px; margin: 0; }

.m-state { font-size: 0.78rem; color: var(--text-faint); width: 64px; text-align: right; flex: 0 0 auto; }
.member-row.is-present .m-state { color: var(--gold-strong); font-weight: 600; }

/* Switch */
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px; transition: 0.15s; pointer-events: none; }
.switch .track::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: var(--text-muted); transition: 0.15s; }
.switch input:checked + .track { background: var(--gold-soft); border-color: var(--gold); }
.switch input:checked + .track::before { transform: translateX(20px); background: var(--gold-strong); }

@media (max-width: 560px) {
    .m-state { display: none; }
    .presence-head { gap: 0.85rem; }
}

/* ---------- Senpai : élèves d'un autre cours venus aider ----------
   Accent vert distinct du doré (encadrement) pour bien marquer que ce ne sont
   ni des professeurs ni des assistants. */
.cd-action-senpai { color: var(--success); border-color: rgba(79, 174, 139, 0.4); }
.cd-action-senpai:hover { background: var(--success-soft); color: var(--success); }

.subhead-senpai { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; color: var(--success); }
.subhead-note { letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--text-faint); font-size: 0.74rem; }

.member-row.senpai { background: var(--success-soft); cursor: default; }
.member-row.senpai:hover { background: rgba(79, 174, 139, 0.2); }
.member-row.senpai .mini-av { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.m-fullname .tag-senpai {
    font-size: 0.68rem; color: var(--success); text-transform: uppercase; letter-spacing: 0.04em;
    border: 1px solid rgba(79, 174, 139, 0.45); background: var(--success-soft);
    border-radius: 999px; padding: 0 0.45rem; margin-left: 0.35rem; vertical-align: middle;
}
.m-state-senpai { color: var(--success); font-weight: 600; }

.senpai-remove-form { margin: 0; flex: 0 0 auto; line-height: 0; }
.senpai-remove {
    width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
    border: 1px solid var(--border-strong); background: transparent;
    color: var(--text-faint); border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1;
}
.senpai-remove:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* Tiroir « Ajouter un senpai » : liseré vert pour le distinguer de l'ajout rapide. */
.cv-drawer-senpai { border-left-color: var(--success); }
.cv-drawer-senpai .cv-search input:focus { border-color: var(--success); }

/* ---------------- Note de séance (bloc inline) ----------------
   Remplace l'ancienne modale. Lecture ⇄ édition en place (session_note_controller.js). */
.note-card {
    position: relative; margin-bottom: 1.25rem; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.note-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--gold-strong), var(--gold)); }
.note-card.is-empty::before { background: var(--border-strong); }

.note-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.1rem; }
.note-ico {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--gold-soft); border: 1px solid rgba(230, 201, 138, 0.3); color: var(--gold-strong);
}
.note-ico svg { display: block; }
.note-head-txt { flex: 1 1 auto; min-width: 0; }
.note-title { font-size: 0.95rem; font-weight: 600; }
.note-meta { font-size: 0.76rem; color: var(--text-faint); margin-top: 0.05rem; }
.note-meta .dot { margin: 0 0.35rem; }
.note-head-actions { flex: 0 0 auto; }

/* Corps — lecture */
.note-body { padding: 0 1.1rem 1.1rem; }
.note-text {
    white-space: pre-wrap; color: var(--text); font-size: 0.92rem; line-height: 1.6;
    background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

/* Corps — édition en place */
.note-edit { padding: 0 1.1rem 1rem; }
.note-area {
    display: block; width: 100%; resize: none; min-height: 120px; overflow: hidden;
    font-family: inherit; font-size: 0.92rem; line-height: 1.6; color: var(--text);
    background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}
.note-area::placeholder { color: var(--text-faint); }
.note-area:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.note-edit-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.6rem; }
.note-count { font-size: 0.76rem; color: var(--text-faint); }
.note-count.is-max { color: var(--danger); }
.note-count b { color: var(--text-muted); font-weight: 600; }
.note-edit-actions { display: flex; align-items: center; gap: 0.5rem; }
.note-hint { font-size: 0.74rem; color: var(--text-faint); margin-right: 0.25rem; }

/* État vide — invite discrète */
.note-empty {
    display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left; cursor: pointer;
    padding: 0.9rem 1.1rem; background: transparent; border: 0;
    font-family: inherit; font-size: 0.9rem; color: var(--text-muted);
}
.note-empty:hover { color: var(--gold-strong); }
.note-empty .plus {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
    border: 1px dashed var(--border-strong); color: var(--text-muted);
}
.note-empty:hover .plus { border-color: var(--gold); color: var(--gold-strong); }
.note-empty .plus svg { display: block; }
