/* =========================================================
   DataGrade — interface élève (minimaliste, pensée fullscreen)
   ========================================================= */

body.eleve-app {
    background: var(--bg);
    overflow: visible;
    margin: 0;
    min-height: 100vh;
}
body.eleve-app .bg-decor { display: none; }

.eleve-topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 28px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}
.eleve-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
    margin-right: auto;
    color: inherit;            /* c'est un lien vers l'accueil élève : garder l'aspect du logo */
    text-decoration: none;
}
.eleve-topbar__brand .brand__mark { width: 28px; height: 28px; }
.eleve-topbar__who {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 24px;
    border-right: 1px solid var(--line);
}
.eleve-topbar__name {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.2;
}
.eleve-topbar__class {
    font-size: 12px;
    color: var(--ink-muted);
}

.eleve-topbar__clock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-right: 12px;
}
.eleve-topbar__clock-warn {
    color: var(--coral-500);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 11px;
    margin-left: 4px;
    padding: 2px 6px;
    background: var(--rose-50);
    border-radius: 4px;
}

.eleve-topbar__nav {
    display: flex;
    gap: 18px;
    align-items: center;
}
/* Liens nav : simple texte, la page courante est soulignée. */
.eleve-topbar__nav a {
    padding: 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.eleve-topbar__nav a:hover { color: var(--violet-700); }
.eleve-topbar__nav a.is-active {
    color: var(--violet-700);
    border-bottom-color: var(--violet-500);
}
.eleve-topbar__icon {
    font-size: 16px;
    line-height: 1;
}
.eleve-topbar__logout { color: var(--ink-muted) !important; }
.eleve-topbar__logout:hover { color: var(--coral-500) !important; }

/* Thème : un lien « Thème » qui ouvre un petit menu avec les choix. */
/* Menu « Thème » ouvert : la barre passe devant tout le contenu, quel que soit
   le thème (certains lui donnent le même z-index que la page). */
.eleve-topbar.is-menu-open { z-index: 200 !important; }
.theme-menu { position: relative; }
.theme-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}
.theme-menu > summary::-webkit-details-marker { display: none; }
.theme-menu > summary:hover,
.theme-menu[open] > summary { color: var(--violet-700); }
.theme-menu .theme-picker {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, 30px);
    gap: 4px;
    padding: 8px;
    background: var(--bg-elev, #fff);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 28px -10px rgba(15, 23, 42, 0.3);
}
.theme-menu .theme-picker__btn { width: 30px; height: 30px; border-radius: 8px; }
.theme-picker__btn img { width: 22px; height: 22px; display: block; }

.eleve-main {
    padding: 32px 28px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------- Layout 2 colonnes : contenu + side rules ---------- */

.eleve-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
}
@media (max-width: 900px) {
    .eleve-grid { grid-template-columns: 1fr; }
}

.eleve-rules {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 24px;
    position: sticky;
    top: 88px;
}
.eleve-rules h3 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    color: var(--ink);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.eleve-rules h3 img { width: 30px; height: 30px; flex-shrink: 0; }
.eleve-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.eleve-rules li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.5;
}
/* Icônes illustrées (public/assets/img/regles/) : un filet les sépare du texte. */
.eleve-rules .rule-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}
.eleve-rules li > div {
    border-left: 1px solid var(--line);
    padding-left: 14px;
}
.eleve-rules strong {
    color: var(--ink);
    font-weight: 600;
}

/* ---------- États (waiting, no results...) ---------- */

.eleve-state {
    text-align: center;
    padding: 48px 24px;
}
/* Liste d'activités : pas de marges latérales, pour que les cartes aient la même
   largeur que les briques du dessous (AxioMaths, cours, Mindlock…). */
.eleve-state--list { padding: 32px 0 6px; }
.eleve-state__img {
    max-width: 280px;
    width: 100%;
    height: auto;
    margin: 0 auto 20px;
    filter: drop-shadow(0 12px 24px rgba(124, 58, 237, 0.18));
    animation: float-y 5s ease-in-out infinite;
}
@keyframes float-y {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
/* Liu en avatar rond (public/assets/img/liu/*.webp, découpés de la planche) */
.eleve-liu {
    display: block;
    width: 112px;
    height: 112px;
    margin: 0 auto 12px;
    padding: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, #f3edff 70%, #ebe3ff 100%);
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.18), 0 0 0 4px #fff, 0 0 0 5px var(--line, #ECE7F2);
    user-select: none;
}
.eleve-liu--hello { animation: liu-hello 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.eleve-liu--sleep { animation: liu-breathe 4.5s ease-in-out infinite; }
@keyframes liu-hello {
    0%, 70%, 100% { transform: rotate(0); }
    78% { transform: rotate(-5deg); }
    86% { transform: rotate(5deg); }
    94% { transform: rotate(-3deg); }
}
@keyframes liu-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.035) translateY(2px); }
}
@media (prefers-reduced-motion: reduce) {
    .eleve-liu--hello, .eleve-liu--sleep, .eleve-state__img { animation: none; }
}
.eleve-state__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    color: var(--ink);
    margin-bottom: 8px;
}
.eleve-state__lead {
    color: var(--ink-soft);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.55;
}
/* Mention d'état (« En attente d'une activité »…) : simple texte avec un point. */
.eleve-state__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-muted);
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 16px;
}
.eleve-state__badge .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--violet-500);
    animation: pulse-soft 1.6s ease-in-out infinite;
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}

/* ---------- Liste résultats ---------- */

.result-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    color: inherit;
    margin-bottom: 12px;
    transition: all .2s;
}
.result-card:hover {
    border-color: var(--violet-200);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.result-card__score {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 28px;
    color: var(--violet-600);
    width: 84px;
    flex-shrink: 0;
    text-align: center;
}
.result-card__score small {
    font-size: 14px;
    color: var(--ink-muted);
    font-weight: 500;
}
.result-card__body {
    flex: 1;
    min-width: 0;
}
.result-card__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
}
.result-card__meta {
    font-size: 13px;
    color: var(--ink-muted);
    margin-top: 2px;
}
.result-card__pending {
    color: var(--amber-500);
    font-weight: 600;
    font-size: 13.5px;
}

/* ============== Choix entre plusieurs quiz disponibles ============== */
.eleve-state__badge--ready { color: #065F46; }
.dot--ready { background: var(--emerald-500); }

.quiz-choices {
    list-style: none;
    padding: 0;
    margin: 22px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.quiz-choice {
    /* Fond du thème, pas blanc en dur : les textes de la carte suivent les
       couleurs du thème et devenaient illisibles sur blanc dans les thèmes sombres. */
    background: var(--bg-elev, #fff);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    transition: all .15s var(--ease-out);
}
.quiz-choice:hover {
    border-color: var(--violet-500);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px -8px rgba(124, 58, 237, .25);
}

/* 🛡️ Carte ÉVALUATION (anti-triche actif) : couleur vive rouge/rose +
   léger pulse pour signaler que c'est l'activité prioritaire. */
.quiz-choice--exam {
    border-color: #f43f5e;
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
    box-shadow: 0 4px 18px -6px rgba(244, 63, 94, .40);
    animation: examPulse 2.4s ease-in-out infinite;
}
.quiz-choice--exam:hover {
    border-color: #e11d48;
    box-shadow: 0 10px 28px -8px rgba(244, 63, 94, .55);
}
@keyframes examPulse {
    0%, 100% { box-shadow: 0 4px 18px -6px rgba(244, 63, 94, .40); }
    50%      { box-shadow: 0 4px 26px -4px rgba(244, 63, 94, .70); }
}
.quiz-choice__exam-flag {
    display: inline-block;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    font-weight: 800;
    font-size: 11.5px;
    letter-spacing: 0.03em;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(225, 29, 72, .35);
}
.quiz-choice--exam .quiz-choice__title { color: #9f1239; }
.quiz-choice--exam .quiz-choice__cta { color: #e11d48; }
@media (prefers-reduced-motion: reduce) {
    .quiz-choice--exam { animation: none; }
}
/* Les cartes d'activité portent la classe .quiz-choice, qui désigne aussi une réponse
   de quiz dans landing.css (flex, marges, survol) : on annule ici ce qui déborde,
   sinon le lien se réduit à son contenu et Liu comme « Démarrer » changent de place
   d'une carte à l'autre. */
.quiz-choices > .quiz-choice { display: block; padding: 0; width: auto; gap: 0; }
.quiz-choices > .quiz-choice:hover { background: var(--bg-elev, #fff); transform: translateY(-1px); }
.quiz-choices > .quiz-choice--exam:hover { background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%); }

/* Corps de la carte à gauche ; à droite, toujours au même endroit, Liu (défis de
   code) et le bouton d'action. */
.quiz-choice__link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 20px;
    padding: 18px 22px;
    text-decoration: none;
    color: inherit;
}
.quiz-choice__body { min-width: 0; }
.quiz-choice__side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 104px; }
.quiz-choice__liu {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(91, 33, 182, 0.25));
    transition: transform .15s var(--ease-out);
}
.quiz-choice:hover .quiz-choice__liu { transform: scale(1.06); }
@media (max-width: 560px) {
    .quiz-choice__link { grid-template-columns: 1fr; row-gap: 8px; }
    .quiz-choice__side { align-items: flex-end; min-width: 0; }
    .quiz-choice__liu { display: none; }
}
.quiz-choice__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    color: var(--ink);
    margin-bottom: 6px;
}
.quiz-choice__desc {
    font-size: 13.5px;
    color: var(--ink-soft);
    margin-bottom: 10px;
    line-height: 1.4;
}
.quiz-choice__meta {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    font-size: 12.5px; color: var(--ink-muted);
}
.quiz-choice__time, .quiz-choice__close {
    color: var(--ink-muted);
}
/* Lien « Voir le leaderboard » du tableau de bord (remplace la barre de niveau). */
.eleve-leaderboard-link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 8px 18px 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--line, #e5e7eb);
    background: var(--bg-elev, #fff);
    color: var(--violet-700, #5b21b6);
    font-weight: 700;
    font-size: 14.5px;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.eleve-leaderboard-link img { width: 26px; height: 26px; flex-shrink: 0; }
.eleve-leaderboard-link:hover {
    transform: translateY(-1px);
    border-color: var(--violet-500, #7c3aed);
    box-shadow: 0 6px 18px -8px rgba(124, 58, 237, .35);
}

/* Pilules illustrées des cartes d'activité (icônes : public/assets/img/pilules/). */
.q-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px 3px 5px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.q-pill img { width: 20px; height: 20px; flex-shrink: 0; }
.q-pill--violet { background: #EFE9FF; color: #5B2FC4; border-color: #DDD0FF; }
.q-pill--coral  { background: #FFE8EC; color: #C22A4C; border-color: #FFCDD6; }
.q-pill--mint   { background: #E8F5F0; color: #14795B; border-color: #C5EBDD; }
.q-pill--amber  { background: #FFF4D6; color: #92400E; border-color: #FFE4A0; }
.q-pill--red    { background: #FEE2E2; color: #B91C1C; border-color: #FCA5A5; font-weight: 700; }
.q-pill--plain  { background: transparent; color: var(--ink-soft, #4b5563); border-color: var(--line, #e5e7eb); font-weight: 500; }
/* La carte d'évaluation garde son fond rose clair dans tous les thèmes : ses textes restent sombres. */
.quiz-choice--exam .quiz-choice__desc { color: #6b2130; }
.quiz-choice--exam .q-pill--plain { color: #6b2130; border-color: #fda4af; }
.quiz-choice__retake {
    color: #B45309;
    background: #FEF3C7;
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
}
.quiz-choice__cta {
    white-space: nowrap;
    font-weight: 600;
    color: var(--violet-700);
    font-size: 13.5px;
    transition: transform .15s;
}
.quiz-choice:hover .quiz-choice__cta { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
    .eleve-state__img, .eleve-state__badge .dot { animation: none; }
}

/* ======================== Mobile (≤ 720px) ======================== */
@media (max-width: 720px) {
    .eleve-topbar {
        flex-wrap: wrap;
        gap: 10px 14px;
        padding: 10px 14px;
    }
    .eleve-topbar__brand { font-size: 15px; margin-right: auto; }
    .eleve-topbar__who {
        padding-right: 0;
        border-right: none;
        gap: 8px;
    }
    .eleve-topbar__class { display: none; } /* gain de place */
    .eleve-topbar__clock { font-size: 12px; margin-right: 0; }
    .eleve-topbar__nav {
        order: 99;        /* passe sous le reste */
        width: 100%;
        justify-content: flex-end;
    }
    .eleve-topbar__nav { gap: 14px; }
    .eleve-topbar__nav a { font-size: 13px; }

    .eleve-main { padding: 20px 14px; }
    .eleve-grid { grid-template-columns: 1fr; gap: 18px; }

    .eleve-state {
        padding: 24px 18px;
    }
    .eleve-state__img { max-width: 180px; }
    .eleve-state__title { font-size: 22px; }
    .eleve-rules ul li { font-size: 13.5px; }
}
