/* =====================================================
   PROFAYCEL — Tableau d'honneur hebdomadaire (.hn-)
   et « رسائلي » (.msg-)
   Utilisé par index.html, parcours/index.html et eleve.html.
   Les couleurs reprennent celles du site (avec valeurs par défaut).
   ===================================================== */

.hn-section {
    background: var(--primary-soft, #eff6ff);
}

.hn {
    --hn-bleu: var(--primary, var(--bleu, #2563eb));
    --hn-texte: var(--dark, var(--texte, #0f172a));
    --hn-gris: var(--text-light, var(--gris, #64748b));
    --hn-bord: var(--border, var(--bord, #e2e8f0));
    --hn-vert: #16a34a;
    --hn-or: #f59e0b;
    max-width: 760px;
    margin: 0 auto;
}

/* Onglets des niveaux */
.hn-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0 16px;
}

.hn-tab {
    flex: 1 1 120px;
    border: 1px solid var(--hn-bord);
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-weight: 700;
    color: var(--hn-texte);
    cursor: pointer;
}

.hn-tab[aria-pressed="true"] {
    background: var(--hn-bleu);
    border-color: var(--hn-bleu);
    color: #fff;
}

/* Une ligne par élève */
.hn-carte {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--hn-bord);
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.06);
    text-align: start;
}

.hn-carte.hn-premier {
    border: 2px solid var(--hn-or);
    padding: 18px 16px;
    background: linear-gradient(180deg, #fffbeb, #fff);
}

.hn-medaille {
    font-size: 34px;
    line-height: 1;
}

.hn-premier .hn-medaille {
    font-size: 44px;
}

.hn-info {
    flex: 1;
    min-width: 0;
}

.hn-nom {
    font-weight: 800;
    color: var(--hn-texte);
    font-size: 19px;
    overflow-wrap: anywhere;
}

.hn-premier .hn-nom {
    font-size: 22px;
}

.hn-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 14px;
    color: var(--hn-gris);
    margin-top: 2px;
}

.hn-barre {
    height: 8px;
    background: var(--hn-bord);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 8px;
}

.hn-barre i {
    display: block;
    height: 100%;
    background: var(--hn-vert);
    border-radius: 99px;
}

.hn-pct {
    font-weight: 800;
    font-size: 22px;
    color: var(--hn-texte);
    min-width: 64px;
    text-align: center;
    direction: ltr;
}

.hn-premier .hn-pct {
    font-size: 26px;
}

.hn-vide,
.hn-note {
    color: var(--hn-gris);
    text-align: center;
    font-size: 14px;
    margin: 14px 0 0;
}

.hn-vide {
    background: #fff;
    border: 1px dashed var(--hn-bord);
    border-radius: 16px;
    padding: 18px 14px;
    font-size: 16px;
}

@media (max-width: 480px) {
    .hn-carte {
        gap: 10px;
        padding: 12px;
    }

    .hn-medaille {
        font-size: 30px;
    }

    .hn-premier .hn-medaille {
        font-size: 38px;
    }

    .hn-nom,
    .hn-premier .hn-nom {
        font-size: 18px;
    }

    .hn-pct,
    .hn-premier .hn-pct {
        font-size: 20px;
        min-width: 54px;
    }
}

/* =====================================================
   « رسائلي » — boîte de messages de l'élève (eleve.html)
   ===================================================== */

.msg-carte {
    border: 2px solid #fde68a;
    background: linear-gradient(180deg, #fffbeb, #fff);
}

.msg-tete {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    cursor: pointer;
    text-align: start;
}

.msg-tete .msg-titre {
    flex: 1;
}

.msg-badge {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    padding: 0 10px;
    white-space: nowrap;
    vertical-align: middle;
}

.msg-fleche {
    color: #64748b;
    transition: transform 0.2s;
}

.msg-tete[aria-expanded="true"] .msg-fleche {
    transform: rotate(180deg);
}

.msg-corps {
    margin-top: 12px;
}

.msg-item {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.msg-item.msg-nouveau {
    border-color: #fbbf24;
    background: #fffbeb;
}

.msg-item h3 {
    margin: 0 0 6px;
    font-size: 17px;
    color: #0f172a;
}

.msg-item p {
    margin: 0;
    white-space: pre-line;
    line-height: 1.8;
    color: #334155;
}

.msg-date {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
}

.msg-vide {
    color: #64748b;
    margin: 0;
    line-height: 1.8;
}


/* =====================================================
   Espace élève (eleve.html) : salutation, 3 entrées, icône « رسائلي »
   ===================================================== */

.eleve-accueil {
    padding: 26px 0 70px;
}

.eleve-accueil .container {
    max-width: 860px;
}

.eleve-accueil .student-welcome-card {
    margin-bottom: 22px;
}

.eleve-salut {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 20px;
}

.eleve-salut h1 {
    margin: 0;
    font-size: clamp(1.35rem, 5vw, 1.9rem);
    line-height: 1.3;
    letter-spacing: 0;
    color: #0f172a;
}

.eleve-salut h1 span {
    font-weight: 600;
    color: #64748b;
    margin-inline-end: 6px;
}

.eleve-salut h1 strong {
    font-weight: 800;
}

.eleve-niveau {
    padding: 4px 14px;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.92rem;
    font-weight: 800;
}

.eleve-menu {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 26px;
}

.eleve-tuile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
    transition: transform 0.15s;
}

.eleve-tuile:active {
    transform: scale(0.99);
}

.eleve-tuile::-webkit-details-marker {
    display: none;
}

.eleve-tuile-cours {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.eleve-tuile-qcm {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.eleve-tuile-devoirs {
    background: linear-gradient(135deg, #059669, #047857);
}

.eleve-tuile-ic {
    flex: none;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 28px;
}

.eleve-tuile-texte {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.eleve-tuile-texte strong {
    font-size: 1.2rem;
    line-height: 1.3;
}

.eleve-tuile-texte small {
    font-size: 0.88rem;
    line-height: 1.5;
    opacity: 0.92;
}

.eleve-fleche {
    font-size: 2rem;
    line-height: 1;
    opacity: 0.9;
    transition: transform 0.2s;
}

html[dir="rtl"] .eleve-fleche {
    transform: scaleX(-1);
}

.eleve-devoirs[open] .eleve-fleche,
html[dir="rtl"] .eleve-devoirs[open] .eleve-fleche {
    transform: rotate(90deg);
}

.eleve-devoirs > summary {
    list-style: none;
}

.eleve-devoirs-corps {
    margin-top: 12px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.eleve-devoirs-corps > p {
    margin: 0 0 14px;
    color: #64748b;
}

/* icône des messages dans l'en-tête */
.msg-zone {
    display: flex;
    align-items: center;
}

.msg-icone {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #1e3a8a;
    cursor: pointer;
}

.msg-pastille {
    position: absolute;
    top: -7px;
    inset-inline-end: -7px;
    display: grid;
    place-items: center;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.msg-pastille[hidden] {
    display: none;
}

.msg-panneau {
    position: fixed;
    z-index: 1100;
    inset-inline: 4vw;
    max-width: 420px;
    margin-inline: auto;
    max-height: 70vh;
    overflow-y: auto;
    padding: 14px;
    border: 2px solid #fde68a;
    border-radius: 18px;
    background: linear-gradient(180deg, #fffbeb, #fff);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.msg-panneau[hidden] {
    display: none;
}

.msg-panneau-tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 18px;
    color: #0f172a;
}

.msg-fermer {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

@media (min-width: 801px) {
    .msg-panneau {
        inset-inline-start: auto;
        inset-inline-end: max(20px, calc((100vw - 1200px) / 2));
        margin-inline: 0;
        width: 400px;
    }
}

@media (max-width: 800px) {
    .header-container > .msg-zone {
        order: 2;
        margin-inline-start: auto;
    }

    .header-container > .mobile-menu-button {
        order: 3;
        margin-left: 0;
    }

    .header-container {
        gap: 12px;
    }

    .eleve-tuile {
        padding: 16px;
        gap: 14px;
    }

    .eleve-tuile-ic {
        width: 48px;
        height: 48px;
        font-size: 25px;
    }

    .eleve-devoirs-corps {
        padding: 14px;
    }
}

/* choix de la matière : Mathématiques / Français */
.matieres-choix {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.matiere-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 10px;
    border: 3px solid transparent;
    border-radius: 20px;
    color: #fff;
    font: inherit;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
    transition: transform 0.15s, border-color 0.15s;
}

.matiere-btn:active {
    transform: scale(0.98);
}

.matiere-btn strong {
    font-size: 1.15rem;
}

.matiere-ic {
    font-size: 30px;
    line-height: 1;
}

.matiere-maths {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.matiere-francais {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.matiere-btn.is-active {
    border-color: #0f172a;
}

.eleve-tuile-fr {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    cursor: default;
}

.eleve-bientot {
    flex: none;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.8rem;
    font-weight: 700;
}

.eleve-menu[hidden] {
    display: none;
}
