/* =====================================================================
   Plateforme d'enseignement en ligne — feuille de style principale
   HTML5 / CSS3 — responsive, animations douces, optimisee bas debit
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Variables de theme
   --------------------------------------------------------------------- */
:root {
    --brand:            #4f6ef7;
    --brand-dark:       #3a55d9;
    --brand-light:      #eef1fe;
    --brand-glow:       rgba(79, 110, 247, .28);

    --accent:           #f2793d;
    --success:          #16a56f;
    --success-light:    #e6f7f0;
    --warning:          #e0a107;
    --warning-light:    #fdf5e3;
    --danger:           #e04a5f;
    --danger-light:     #fdeef0;
    --info:             #2b8fd0;
    --info-light:       #e8f4fc;

    --ink:              #1b2033;
    --ink-soft:         #4a5268;
    --ink-mute:         #838ca3;
    --line:             #e5e8f0;
    --line-soft:        #f0f2f7;
    --bg:               #f6f7fb;
    --surface:          #ffffff;
    --surface-alt:      #fafbfe;

    --sidebar-bg:       #171c2e;
    --sidebar-ink:      #a8b0c6;
    --sidebar-active:   #ffffff;

    --radius-sm:        8px;
    --radius:           14px;
    --radius-lg:        20px;

    --shadow-sm:        0 1px 2px rgba(23, 28, 46, .06);
    --shadow:           0 4px 16px rgba(23, 28, 46, .07);
    --shadow-lg:        0 12px 40px rgba(23, 28, 46, .12);

    --ease:             cubic-bezier(.4, 0, .2, 1);
    --speed:            .22s;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------------------------------------------------------------------
   2. Reinitialisation
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0 0 .6em; line-height: 1.25; font-weight: 700; color: var(--ink); }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: .98rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: none; transition: color var(--speed) var(--ease); }
a:hover { color: var(--brand-dark); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { margin: 0 0 1em; padding-left: 1.3em; }

hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

small { font-size: .82rem; }

code, pre { font-family: var(--mono); font-size: .86em; }

:focus-visible {
    outline: 3px solid var(--brand-glow);
    outline-offset: 2px;
    border-radius: 4px;
}

.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------------
   3. Animations
   --------------------------------------------------------------------- */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn  { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes pulse    { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes ring     { 0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow); } 50% { box-shadow: 0 0 0 8px transparent; } }

.animate-up { animation: fadeUp .4s var(--ease) both; }
.animate-in { animation: fadeIn .4s var(--ease) both; }

.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .1s; }
.delay-3 { animation-delay: .15s; }
.delay-4 { animation-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ---------------------------------------------------------------------
   4. Structure generale
   --------------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform var(--speed) var(--ease);
    z-index: 60;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 20px 16px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.2px;
}

.sidebar__logo {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand), #7c5cff);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: .95rem;
    flex: 0 0 auto;
    box-shadow: 0 4px 14px rgba(79, 110, 247, .45);
    overflow: hidden;
}
.sidebar__logo img { width: 100%; height: 100%; object-fit: cover; }

.sidebar__role {
    display: block;
    font-size: .72rem;
    font-weight: 500;
    color: var(--sidebar-ink);
    letter-spacing: .3px;
    text-transform: uppercase;
}

.sidebar__nav { flex: 1; padding: 8px 12px 20px; }

.sidebar__section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: #5d6684;
    padding: 18px 12px 7px;
    font-weight: 700;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 10px;
    color: var(--sidebar-ink);
    font-size: .9rem;
    font-weight: 500;
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.sidebar__link:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.sidebar__link.is-active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(79, 110, 247, .4); }
.sidebar__link .icon { opacity: .9; }

.sidebar__badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

.sidebar__footer {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar__user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 10px;
    color: #fff; font-size: .86rem;
    transition: background var(--speed) var(--ease);
}
.sidebar__user:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar__user small { color: var(--sidebar-ink); display: block; font-size: .74rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 12px 26px;
    display: flex; align-items: center; gap: 16px;
}

.topbar__title { font-size: 1.12rem; font-weight: 700; margin: 0; }
.topbar__spacer { flex: 1; }

.topbar__search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 14px;
    min-width: 240px;
    transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.topbar__search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-glow); }
.topbar__search input { border: 0; background: transparent; outline: 0; width: 100%; font-size: .88rem; font-family: inherit; }
.topbar__search .icon { color: var(--ink-mute); }

.topbar__action {
    position: relative;
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    color: var(--ink-soft);
    background: var(--surface-alt);
    border: 1px solid var(--line);
    transition: all var(--speed) var(--ease);
}
.topbar__action:hover { background: var(--brand-light); color: var(--brand); border-color: transparent; }

.topbar__dot {
    position: absolute; top: 6px; right: 6px;
    min-width: 17px; height: 17px; padding: 0 4px;
    background: var(--danger); color: #fff;
    font-size: .64rem; font-weight: 700;
    border-radius: 999px;
    display: grid; place-items: center;
    border: 2px solid #fff;
}

.menu-toggle { display: none; background: none; border: 0; padding: 6px; color: var(--ink); cursor: pointer; }

.content { padding: 26px; flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; }

.page-head {
    display: flex; align-items: flex-start; gap: 16px;
    flex-wrap: wrap; margin-bottom: 22px;
}
.page-head__text { flex: 1; min-width: 240px; }
.page-head h1 { margin-bottom: 4px; }
.page-head__sub { color: var(--ink-mute); font-size: .92rem; margin: 0; }
.page-head__actions { display: flex; gap: 9px; flex-wrap: wrap; }

.breadcrumb {
    display: flex; align-items: center; gap: 7px;
    font-size: .82rem; color: var(--ink-mute); margin-bottom: 10px;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--ink-mute); }
.breadcrumb a:hover { color: var(--brand); }

/* ---------------------------------------------------------------------
   5. Grilles
   --------------------------------------------------------------------- */
.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }

@media (max-width: 1100px) {
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 660px) {
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   6. Cartes
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.card--hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.card__head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: center; gap: 12px;
}
.card__head h2, .card__head h3 { margin: 0; font-size: 1rem; }
.card__head .spacer { flex: 1; }

.card__body { padding: 18px; }
.card__body--tight { padding: 12px 18px; }
.card__foot { padding: 13px 18px; border-top: 1px solid var(--line-soft); background: var(--surface-alt); }

/* Statistiques */
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px 18px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat__icon {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center;
    background: var(--brand-light); color: var(--brand);
    flex: 0 0 auto;
}
.stat__icon--success { background: var(--success-light); color: var(--success); }
.stat__icon--warning { background: var(--warning-light); color: var(--warning); }
.stat__icon--danger  { background: var(--danger-light);  color: var(--danger); }
.stat__icon--info    { background: var(--info-light);    color: var(--info); }

.stat__value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.stat__label { font-size: .8rem; color: var(--ink-mute); }
.stat__extra { font-size: .74rem; color: var(--ink-mute); margin-top: 2px; }

/* ---------------------------------------------------------------------
   7. Boutons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 17px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--brand); color: #fff;
    font-size: .89rem; font-weight: 600; font-family: inherit;
    cursor: pointer; text-align: center;
    transition: all var(--speed) var(--ease);
    white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px var(--brand-glow); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-alt); color: var(--brand); border-color: var(--brand); box-shadow: none; }

.btn--soft { background: var(--brand-light); color: var(--brand); }
.btn--soft:hover { background: #e2e7fd; color: var(--brand-dark); box-shadow: none; }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #c93c50; box-shadow: 0 6px 18px rgba(224, 74, 95, .3); }

.btn--success { background: var(--success); }
.btn--success:hover { background: #128f5e; box-shadow: 0 6px 18px rgba(22, 165, 111, .3); }

.btn--warning { background: var(--warning); color: #3d2c00; }
.btn--warning:hover { background: #cd9106; color: #3d2c00; }

.btn--sm { padding: 7px 12px; font-size: .81rem; border-radius: 8px; }
.btn--lg { padding: 13px 24px; font-size: .96rem; border-radius: 12px; }
.btn--block { display: flex; width: 100%; }
.btn--icon { padding: 8px; width: 36px; height: 36px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   8. Formulaires
   --------------------------------------------------------------------- */
.field { margin-bottom: 16px; }

.label {
    display: block;
    font-size: .84rem; font-weight: 600;
    margin-bottom: 6px; color: var(--ink-soft);
}
.label .req { color: var(--danger); }

.input, .select, .textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    font-size: .9rem; font-family: inherit; color: var(--ink);
    transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
    outline: 0;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}
.input::placeholder, .textarea::placeholder { color: #aeb5c7; }

.textarea { resize: vertical; min-height: 110px; line-height: 1.6; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23838ca3' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 17px;
    padding-right: 36px;
}

.input.is-error, .select.is-error, .textarea.is-error { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .8rem; margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.field__hint  { color: var(--ink-mute); font-size: .79rem; margin-top: 5px; }

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 660px) { .field-row { grid-template-columns: 1fr; } }

.check {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    background: var(--surface);
}
.check:hover { border-color: var(--brand); background: var(--brand-light); }
.check input { margin-top: 2px; accent-color: var(--brand); width: 17px; height: 17px; flex: 0 0 auto; }
.check__text { font-size: .87rem; }
.check__text strong { display: block; font-weight: 600; }
.check__text small { color: var(--ink-mute); }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }

.check-list {
    display: grid; gap: 8px;
    max-height: 280px; overflow-y: auto;
    padding: 3px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.radio-card {
    position: relative;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    background: var(--surface);
}
.radio-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-light); box-shadow: 0 4px 16px var(--brand-glow); }
.radio-card__icon { color: var(--brand); margin-bottom: 8px; }
.radio-card__title { font-weight: 700; font-size: .95rem; margin-bottom: 3px; }
.radio-card__desc { font-size: .81rem; color: var(--ink-mute); line-height: 1.5; }

.switch { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch__track {
    width: 44px; height: 25px; border-radius: 999px;
    background: #cfd4e2; position: relative;
    transition: background var(--speed) var(--ease);
    flex: 0 0 auto;
}
.switch__track::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 19px; height: 19px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm);
    transition: transform var(--speed) var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(19px); }

.file-drop {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 26px;
    text-align: center;
    background: var(--surface-alt);
    transition: all var(--speed) var(--ease);
    cursor: pointer;
}
.file-drop:hover, .file-drop.is-over { border-color: var(--brand); background: var(--brand-light); }
.file-drop input[type=file] { display: block; margin: 12px auto 0; font-size: .85rem; max-width: 100%; }
.file-drop__icon { color: var(--brand); margin-bottom: 8px; }
.file-drop__title { font-weight: 600; font-size: .93rem; }
.file-drop__hint { font-size: .79rem; color: var(--ink-mute); margin-top: 4px; }

.filters {
    display: flex; gap: 10px; flex-wrap: wrap;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 18px;
}
.filters .field { margin: 0; min-width: 150px; flex: 1; }
.filters .field--grow { flex: 2; min-width: 200px; }

/* ---------------------------------------------------------------------
   9. Tableaux
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
    text-align: left; padding: 11px 14px;
    font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--ink-mute);
    border-bottom: 1px solid var(--line);
    background: var(--surface-alt);
    white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background var(--speed) var(--ease); }
.table tbody tr:hover { background: var(--surface-alt); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

/* ---------------------------------------------------------------------
   10. Badges, pastilles, avatars
   --------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .74rem; font-weight: 600;
    background: var(--line-soft); color: var(--ink-soft);
    white-space: nowrap;
}
.badge--brand   { background: var(--brand-light);   color: var(--brand); }
.badge--success { background: var(--success-light); color: var(--success); }
.badge--warning { background: var(--warning-light); color: #a37504; }
.badge--danger  { background: var(--danger-light);  color: var(--danger); }
.badge--info    { background: var(--info-light);    color: var(--info); }
.badge--live    { background: var(--danger); color: #fff; animation: pulse 1.8s infinite; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand-light); color: var(--brand);
    font-weight: 700; font-size: .82rem;
    flex: 0 0 auto; overflow: hidden;
    text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar--lg { width: 62px; height: 62px; font-size: 1.25rem; }
.avatar--xl { width: 92px; height: 92px; font-size: 1.9rem; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell__name { font-weight: 600; line-height: 1.3; }
.user-cell__meta { font-size: .78rem; color: var(--ink-mute); }

/* ---------------------------------------------------------------------
   11. Messages flash et alertes
   --------------------------------------------------------------------- */
.flash-stack { position: relative; margin-bottom: 18px; display: grid; gap: 10px; }

.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: .88rem;
    animation: fadeUp .35s var(--ease) both;
}
.alert__close {
    margin-left: auto; background: none; border: 0; cursor: pointer;
    color: inherit; opacity: .55; padding: 2px; line-height: 0;
}
.alert__close:hover { opacity: 1; }

.alert--success { background: var(--success-light); border-color: #b9e8d5; color: #0d6b47; }
.alert--error   { background: var(--danger-light);  border-color: #f6c9d0; color: #a32a3d; }
.alert--warning { background: var(--warning-light); border-color: #f2debb; color: #8a6304; }
.alert--info    { background: var(--info-light);    border-color: #bfe0f4; color: #1b6a9c; }

/* ---------------------------------------------------------------------
   12. Etat vide
   --------------------------------------------------------------------- */
.empty {
    text-align: center;
    padding: 44px 24px;
    color: var(--ink-mute);
}
.empty__icon {
    width: 64px; height: 64px; margin: 0 auto 14px;
    border-radius: 20px;
    background: var(--surface-alt);
    display: grid; place-items: center;
    color: var(--ink-mute);
    border: 1px solid var(--line);
}
.empty__title { font-weight: 700; color: var(--ink); font-size: 1rem; margin-bottom: 5px; }
.empty__text { font-size: .88rem; max-width: 420px; margin: 0 auto 16px; }

/* ---------------------------------------------------------------------
   13. Barres de progression
   --------------------------------------------------------------------- */
.progress {
    height: 8px; border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
}
.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #7c5cff);
    border-radius: 999px;
    transition: width .6s var(--ease);
}
.progress--success .progress__bar { background: linear-gradient(90deg, var(--success), #4ec99a); }
.progress--warning .progress__bar { background: linear-gradient(90deg, var(--warning), #f5c451); }
.progress--danger .progress__bar  { background: linear-gradient(90deg, var(--danger), #f0808f); }
.progress--sm { height: 5px; }
.progress--lg { height: 12px; }

.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row__value { font-size: .8rem; font-weight: 700; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* Anneau de progression */
.ring { position: relative; width: 96px; height: 96px; }
.ring svg { transform: rotate(-90deg); }
.ring__bg { fill: none; stroke: var(--line-soft); stroke-width: 9; }
.ring__fg { fill: none; stroke: var(--brand); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring__label {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-size: 1.15rem; font-weight: 800;
}

/* ---------------------------------------------------------------------
   14. Cartes de cours
   --------------------------------------------------------------------- */
.course-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.course-card__cover {
    height: 84px;
    background: linear-gradient(135deg, var(--brand), #7c5cff);
    position: relative;
    display: flex; align-items: flex-end;
    padding: 11px 14px;
}
.course-card__cover::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 82% 18%, rgba(255,255,255,.28), transparent 55%);
}
.course-card__type {
    position: relative; z-index: 1;
    background: rgba(255, 255, 255, .95);
    color: var(--ink);
    font-size: .71rem; font-weight: 700;
    padding: 3px 9px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px;
}
.course-card__new {
    position: absolute; top: 11px; right: 12px; z-index: 1;
    background: var(--accent); color: #fff;
    font-size: .68rem; font-weight: 700;
    padding: 3px 8px; border-radius: 999px;
}
.course-card__body { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.course-card__title { font-size: .98rem; font-weight: 700; margin-bottom: 6px; line-height: 1.35; }
.course-card__title a { color: var(--ink); }
.course-card__title a:hover { color: var(--brand); }
.course-card__desc { font-size: .84rem; color: var(--ink-mute); margin-bottom: 12px; flex: 1; }
.course-card__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .77rem; color: var(--ink-mute); }
.course-card__foot { padding: 11px 15px; border-top: 1px solid var(--line-soft); background: var(--surface-alt); display: flex; align-items: center; gap: 9px; }

/* ---------------------------------------------------------------------
   15. Listes d'elements
   --------------------------------------------------------------------- */
.item-list { display: grid; gap: 1px; background: var(--line-soft); }
.item {
    background: var(--surface);
    padding: 13px 16px;
    display: flex; align-items: center; gap: 13px;
    transition: background var(--speed) var(--ease);
}
.item:hover { background: var(--surface-alt); }
.item__icon {
    width: 38px; height: 38px; border-radius: 11px;
    background: var(--brand-light); color: var(--brand);
    display: grid; place-items: center; flex: 0 0 auto;
}
.item__body { flex: 1; min-width: 0; }
.item__title { font-weight: 600; font-size: .91rem; line-height: 1.35; }
.item__title a { color: var(--ink); }
.item__title a:hover { color: var(--brand); }
.item__meta { font-size: .79rem; color: var(--ink-mute); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item__action { flex: 0 0 auto; }

.item--unread { background: var(--brand-light); }
.item--unread:hover { background: #e5eafd; }

/* Structure pedagogique */
.chapter {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--surface);
}
.chapter__head {
    padding: 13px 16px;
    background: var(--surface-alt);
    display: flex; align-items: center; gap: 11px;
    border-bottom: 1px solid var(--line-soft);
}
.chapter__num {
    width: 27px; height: 27px; border-radius: 9px;
    background: var(--brand); color: #fff;
    display: grid; place-items: center;
    font-size: .78rem; font-weight: 700; flex: 0 0 auto;
}
.chapter__title { font-weight: 700; font-size: .95rem; flex: 1; }
.chapter__body { padding: 6px 0; }

.lesson { padding: 10px 16px 10px 54px; position: relative; }
.lesson::before {
    content: ''; position: absolute; left: 30px; top: 18px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--brand); opacity: .5;
}
.lesson__title { font-weight: 600; font-size: .89rem; }
.lesson__content { font-size: .85rem; color: var(--ink-soft); margin-top: 4px; }

.resource-line {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-radius: 9px;
    background: var(--surface-alt);
    margin-top: 7px;
    font-size: .85rem;
    transition: background var(--speed) var(--ease);
}
.resource-line:hover { background: var(--brand-light); }
.resource-line__icon { color: var(--brand); }
.resource-line__name { flex: 1; min-width: 0; font-weight: 500; }
.resource-line__size { color: var(--ink-mute); font-size: .77rem; }

/* ---------------------------------------------------------------------
   16. Onglets
   --------------------------------------------------------------------- */
.tabs {
    display: flex; gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tabs__link {
    padding: 10px 15px;
    font-size: .88rem; font-weight: 600;
    color: var(--ink-mute);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: all var(--speed) var(--ease);
}
.tabs__link:hover { color: var(--brand); }
.tabs__link.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* Puces de filtre */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: .82rem; font-weight: 500;
    color: var(--ink-soft);
    transition: all var(--speed) var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------------------------------------------------------------------
   17. Pagination
   --------------------------------------------------------------------- */
.pagination { display: flex; gap: 5px; justify-content: center; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.pagination__link {
    min-width: 36px; height: 36px; padding: 0 11px;
    display: grid; place-items: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: .85rem; font-weight: 500;
    transition: all var(--speed) var(--ease);
}
.pagination__link:hover { border-color: var(--brand); color: var(--brand); }
.pagination__link.is-current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination__gap { color: var(--ink-mute); padding: 0 4px; }

/* ---------------------------------------------------------------------
   18. Pages d'authentification
   --------------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 480px;
    background: var(--surface);
}
.auth__aside {
    background: linear-gradient(150deg, #171c2e 0%, #2b3358 55%, var(--brand) 130%);
    color: #fff;
    padding: 52px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.auth__aside::before {
    content: ''; position: absolute;
    width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 92, 255, .35), transparent 65%);
    top: -160px; right: -160px;
}
.auth__aside::after {
    content: ''; position: absolute;
    width: 400px; height: 400px; border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 110, 247, .28), transparent 65%);
    bottom: -140px; left: -110px;
}
.auth__brand { display: flex; align-items: center; gap: 13px; font-size: 1.2rem; font-weight: 700; position: relative; z-index: 1; }
.auth__pitch { position: relative; z-index: 1; max-width: 460px; }
.auth__pitch h1 { color: #fff; font-size: 2.05rem; line-height: 1.2; margin-bottom: 14px; }
.auth__pitch p { color: rgba(255, 255, 255, .82); font-size: 1rem; }
.auth__features { display: grid; gap: 13px; margin-top: 28px; }
.auth__feature { display: flex; align-items: flex-start; gap: 11px; color: rgba(255, 255, 255, .9); font-size: .9rem; }
.auth__feature .icon { color: #8fe3bd; margin-top: 2px; }
.auth__legal { position: relative; z-index: 1; font-size: .8rem; color: rgba(255, 255, 255, .55); }

.auth__panel {
    padding: 44px;
    display: flex; flex-direction: column; justify-content: center;
    overflow-y: auto;
}
.auth__form { width: 100%; max-width: 380px; margin: 0 auto; animation: fadeUp .45s var(--ease) both; }
.auth__form h2 { font-size: 1.55rem; margin-bottom: 6px; }
.auth__form .sub { color: var(--ink-mute); font-size: .9rem; margin-bottom: 26px; }
.auth__mobile-brand { display: none; align-items: center; gap: 11px; margin-bottom: 26px; font-weight: 700; font-size: 1.05rem; }

.code-input {
    display: flex; gap: 9px; justify-content: center; margin: 8px 0 18px;
}
.code-input input {
    width: 46px; height: 56px;
    text-align: center;
    font-size: 1.4rem; font-weight: 700;
    border: 1px solid var(--line); border-radius: 11px;
    font-family: var(--mono);
    transition: all var(--speed) var(--ease);
}
.code-input input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-glow); }

@media (max-width: 980px) {
    .auth { grid-template-columns: 1fr; }
    .auth__aside { display: none; }
    .auth__mobile-brand { display: flex; }
    .auth__panel { padding: 30px 22px; min-height: 100vh; }
}

/* ---------------------------------------------------------------------
   19. Salle de classe virtuelle
   --------------------------------------------------------------------- */
/* Hauteur *definie* (et non min-height) : sans cela le height:100% de
   l'iframe Jitsi ne peut pas se resoudre et retombe a 150px. */
.live {
    height: 100vh; height: 100dvh;
    background: #0f1320; color: #e9ecf5;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.live__bar {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 14px;
    padding: 11px 20px;
    background: #171c2e;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.live__bar form { margin: 0; }
.live__title { font-weight: 700; font-size: .98rem; color: #fff; }
.live__meta { font-size: .8rem; color: #98a1ba; }
.live__spacer { flex: 1; }
.live__stage {
    flex: 1 1 auto;
    min-height: 0;          /* autorise l'element flex a retrecir */
    position: relative;
    background: #0b0e18;
    overflow: auto;
}
/* La visio occupe toute la scene, quelle que soit la hauteur du bandeau */
.live__frame { position: absolute; inset: 0; }
.live__stage iframe { width: 100% !important; height: 100% !important; border: 0; display: block; }
.live__notice {
    position: relative; z-index: 2;
    max-width: 520px; margin: 60px auto; padding: 32px;
    background: #171c2e; border-radius: var(--radius-lg); text-align: center;
    border: 1px solid rgba(255, 255, 255, .08);
}
.live__notice h2 { color: #fff; }
.live__notice p { color: #98a1ba; }

/* Ecran de lancement du professeur : la salle s'ouvre dans un onglet dedie
   quand le serveur exige une connexion (cas de meet.jit.si) */
.live__launch {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; overflow: auto;
}
.live__launch .live__notice { margin: 0; max-width: 560px; }
.live__launch code { font-size: .78rem; color: #98a1ba; }

/* Message de secours quand la salle ne s'ouvre pas (serveur qui exige
   une connexion, autorisation camera refusee, page non securisee...) */
.live__fallback {
    position: absolute; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(11, 14, 24, .92);
}
.live__fallback .live__notice { margin: 0; }
.live__fallback .btn + .btn { margin-left: 8px; }

@media (max-width: 640px) {
    .live__bar { flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
    .live__meta { font-size: .74rem; }
}

/* ---------------------------------------------------------------------
   20. Lecteur de ressources
   --------------------------------------------------------------------- */
.player { background: #0b0e18; border-radius: var(--radius); overflow: hidden; }
.player video, .player audio { width: 100%; display: block; background: #000; }
.player iframe { width: 100%; height: 78vh; border: 0; display: block; }
.player__doc { height: 78vh; }

.viewer-note {
    display: flex; align-items: center; gap: 9px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    background: var(--info-light); color: #1b6a9c;
    font-size: .85rem; margin-bottom: 14px;
}

/* ---------------------------------------------------------------------
   21. Calendrier
   --------------------------------------------------------------------- */
.calendar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar__head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-alt); border-bottom: 1px solid var(--line); }
.calendar__day-name { padding: 10px; text-align: center; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-mute); }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar__cell {
    min-height: 108px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    padding: 7px;
    transition: background var(--speed) var(--ease);
}
.calendar__cell:nth-child(7n) { border-right: 0; }
.calendar__cell:hover { background: var(--surface-alt); }
.calendar__cell.is-empty { background: var(--surface-alt); }
.calendar__cell.is-today { background: var(--brand-light); }
.calendar__num { font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.calendar__cell.is-today .calendar__num { color: var(--brand); }
.calendar__event {
    display: block;
    font-size: .74rem;
    padding: 4px 7px;
    border-radius: 6px;
    margin-bottom: 3px;
    background: var(--brand-light);
    color: var(--ink);
    border-left: 3px solid var(--brand);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: transform var(--speed) var(--ease);
}
.calendar__event:hover { transform: translateX(2px); color: var(--ink); }

@media (max-width: 800px) {
    .calendar__cell { min-height: 74px; padding: 4px; font-size: .8rem; }
    .calendar__event { font-size: .66rem; padding: 2px 4px; }
}

/* ---------------------------------------------------------------------
   22. Messagerie
   --------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: 14px; max-height: 62vh; overflow-y: auto; padding: 4px; }
.bubble { display: flex; gap: 10px; max-width: 78%; animation: fadeUp .3s var(--ease) both; }
.bubble--mine { margin-left: auto; flex-direction: row-reverse; }
.bubble__content {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 14px 14px 14px 4px;
    padding: 10px 14px;
    font-size: .89rem;
}
.bubble--mine .bubble__content {
    background: var(--brand); color: #fff; border-color: transparent;
    border-radius: 14px 14px 4px 14px;
}
.bubble__meta { font-size: .72rem; color: var(--ink-mute); margin-top: 4px; }
.bubble--mine .bubble__meta { text-align: right; }

/* ---------------------------------------------------------------------
   23. Histogramme simple (statistiques)
   --------------------------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 168px; padding-top: 12px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bars__stack { width: 100%; display: flex; flex-direction: column-reverse; gap: 2px; justify-content: flex-end; flex: 1; }
.bars__seg { border-radius: 4px 4px 0 0; min-height: 2px; transition: height .6s var(--ease); }
.bars__label { font-size: .68rem; color: var(--ink-mute); white-space: nowrap; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-soft); }
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__swatch { width: 11px; height: 11px; border-radius: 3px; }

/* ---------------------------------------------------------------------
   24. Utilitaires
   --------------------------------------------------------------------- */
.stack   { display: grid; gap: 16px; }
.stack--sm { gap: 9px; }
.stack--lg { gap: 24px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--tight { gap: 6px; }

.text-mute   { color: var(--ink-mute); }
.text-soft   { color: var(--ink-soft); }
.text-sm     { font-size: .84rem; }
.text-xs     { font-size: .76rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-bold   { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: #a37504; }
.text-brand   { color: var(--brand); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-0 { margin-top: 0; }  .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; } .mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; } .mb-3 { margin-bottom: 24px; }

.w-full { width: 100%; }
.hidden { display: none !important; }

.prose { font-size: .92rem; line-height: 1.75; color: var(--ink-soft); }
.prose p { margin-bottom: .9em; }
.prose strong { color: var(--ink); }

.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---------------------------------------------------------------------
   25. Responsive
   --------------------------------------------------------------------- */
.backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 19, 32, .5);
    z-index: 55;
    animation: fadeIn .2s var(--ease);
}
.backdrop.is-visible { display: block; }

@media (max-width: 900px) {
    .sidebar {
        position: fixed; left: 0; top: 0;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.is-open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .topbar { padding: 11px 16px; }
    .topbar__search { display: none; }
    .content { padding: 18px 15px; }
    .topbar__title { font-size: 1rem; }
}

@media (max-width: 560px) {
    body { font-size: 14.5px; }
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1; }
    .card__body { padding: 15px; }
    .stat { padding: 14px; }
    .stat__value { font-size: 1.32rem; }
}

/* ---------------------------------------------------------------------
   26. Impression
   --------------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .page-head__actions, .btn, .filters, .pagination { display: none !important; }
    .content { padding: 0; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}
