/* ============================================================
   GRADE — subjects.css
   Les matières sont des lignes sur une feuille blanche posée
   sur l'intercalaire menthe : nom à gauche, moyenne à droite.

   Signature : sous chaque ligne, la barre de moyenne court sur
   l'échelle 1–6 et porte un repère fixe au 4.0 (ligne de
   passage). On voit d'un coup d'œil qui est du bon côté.
   ============================================================ */

#subjects-container{
  display:flex;flex-direction:column;
  background:var(--glass-bg);border-radius:var(--r);overflow:hidden
}
.subject-card{border-bottom:1px solid var(--glass-border)}
#subjects-container .subject-card:last-child{border-bottom:none}
#subjects-container > .empty-state{background:transparent}

/* Échelle 1–6 : la barre est remplie jusqu'à la moyenne,
   le repère noir marque 4.0 = (4-1)/5 = 60 % */
.subject-progress{position:relative;height:4px;margin:0 20px;background:var(--sheet-2);border-radius:2px;order:2}
.subject-progress-fill{height:100%;width:var(--w);background:var(--c);border-radius:2px;transition:width .5s ease}
.subject-progress::after{
  content:'';position:absolute;left:60%;top:-4px;width:2px;height:12px;
  background:var(--tx);border-radius:1px;transform:translateX(-1px)
}
.subject-card{display:flex;flex-direction:column;padding-bottom:14px}
.subject-header{order:1}
.subject-body{order:3}

.subject-header{display:flex;align-items:center;gap:10px;padding:14px 14px 10px 20px;cursor:pointer}
.subject-header:hover .subject-name{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}
.subject-name{font-weight:600;font-size:1.05rem;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.subject-avg{font-family:var(--f-display);font-size:1.5rem;font-weight:700;letter-spacing:-.02em;min-width:52px;text-align:right}
.subject-badge{padding:4px 10px;border-radius:var(--rs);font-size:.8rem;font-weight:600;white-space:nowrap}
.badge-g{background:var(--gbg);color:var(--green)}
.badge-r{background:var(--rbg);color:var(--red)}
.badge-o{background:var(--obg);color:var(--orange)}
.badge-n{background:var(--sheet-2);color:var(--tx2)}
/* Clair : les verts/oranges/rouges sont vifs pour les chiffres et les barres ;
   dans les petites étiquettes teintées, on les fonce un peu pour rester lisible. */
html.light .badge-g{color:color-mix(in srgb,var(--green) 80%,var(--tx))}
html.light .badge-o{color:color-mix(in srgb,var(--orange) 80%,var(--tx))}
html.light .badge-r{color:color-mix(in srgb,var(--red) 80%,var(--tx))}
html.light .ww-err{color:color-mix(in srgb,var(--orange) 80%,var(--tx))}
html.light .ww-ok{color:color-mix(in srgb,var(--green) 80%,var(--tx))}
.chevron{color:var(--tx2);font-size:.75rem;transition:transform .2s;min-width:36px;height:36px;text-align:center;
  background:none;border:none;border-radius:var(--rs);cursor:pointer;font-family:inherit;padding:0;flex-shrink:0}
.chevron:hover{color:var(--tx);background:var(--sheet-2)}
.chevron.open{transform:rotate(180deg)}

.subject-body{margin:14px 12px 0;padding:18px;display:none;background:var(--sheet-2);border-radius:var(--r)}
.subject-body.open{display:block}
.sub-sections{display:grid;grid-template-columns:1fr 1fr;gap:20px}
@media(max-width:680px){.sub-sections{grid-template-columns:1fr}}
.sub-sec-title{font-size:.95rem;font-weight:700;color:var(--tx);margin-bottom:10px}

.mini-list{display:flex;flex-direction:column;margin-bottom:10px;background:var(--glass-bg);border-radius:var(--r);overflow:hidden}
.mini-item{display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--glass-border);padding:9px 12px}
.mini-list .mini-item:last-child{border-bottom:none}
.mi-name{flex:1;font-size:.92rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mi-weight{font-size:.8rem;color:var(--tx2);white-space:nowrap}
.mi-grade{font-family:var(--f-display);font-weight:700;font-size:1.05rem;min-width:34px;text-align:right}
.future-done{box-shadow:inset 3px 0 0 var(--green)}
.empty-mini{color:var(--tx2);font-size:.88rem;padding:10px 0}

.badge-pt{display:inline-block;font-size:.75rem;font-weight:600;background:var(--obg);color:var(--orange);border-radius:var(--rs);padding:1px 6px;margin-left:6px;vertical-align:middle}

/* ── Note minimale requise ── */
.min-grade-box{
  margin-top:16px;padding:16px 18px;border-radius:var(--r);grid-column:1/-1;
  background:var(--glass-bg);border-left:5px solid;display:grid;
  grid-template-columns:auto 1fr;grid-template-rows:auto auto;column-gap:16px;align-items:center
}
.mgb-value{grid-row:1/3;font-family:var(--f-display);font-size:2.4rem;font-weight:700;letter-spacing:-.03em;line-height:1}
.mgb-label{font-size:.9rem;font-weight:600;color:var(--tx)}
.mgb-sub{font-size:.85rem;color:var(--tx2)}
.mgb-green  {border-color:var(--green); color:var(--green)}
.mgb-red    {border-color:var(--red);   color:var(--red)}
.mgb-orange {border-color:var(--orange);color:var(--orange)}
.mgb-neutral{border-color:var(--glass-border);color:var(--tx2)}

/* ── Commentaire de note ── */
.grade-comment{display:block;font-size:.8rem;color:var(--tx2);font-style:italic;margin-top:2px;cursor:pointer;line-height:1.35;max-width:240px;word-break:break-word}
.grade-comment:hover{color:var(--acc)}
.grade-comment-empty{opacity:.45}
.grade-comment-empty:hover{opacity:.8}

/* ── Alerte de pondération ── */
.weight-warn{font-size:.82rem;font-weight:600;padding:6px 12px;border-radius:var(--rs);margin-top:6px}
.ww-ok {color:var(--green); background:var(--gbg)}
.ww-err{color:var(--orange);background:var(--obg)}

/* Téléphone : le nom de matière passe avant l'étiquette de statut
   (la couleur de la moyenne et la barre disent déjà la même chose). */
@media(max-width:600px){
  .subject-header{gap:4px;padding:12px 8px 8px 14px}
  .subject-header .subject-badge{display:none}
  .subject-header .btn-edit,.subject-header .btn-del-sub{min-width:26px;padding:0 4px}
  .subject-progress{margin:0 14px}
  .subject-avg{font-size:1.3rem;min-width:44px}
  .subject-body{margin:12px 8px 0;padding:14px}
}
