/* ============================================================
   Suivi Scolaire — feuille de style
   Design "fun" et lisible (les enfants le voient aussi).
   Aucune dépendance externe : fonctionne en ouvrant index.html
   directement (file://), hors-ligne.
   ============================================================ */

:root {
  --bg:        #0f1226;
  --bg-soft:   #181c3a;
  --card:      #1e2347;
  --card-2:    #242a55;
  --text:      #eef1ff;
  --muted:     #9aa3d4;
  --line:      #2d3470;
  --good:      #22c55e;
  --warn:      #f59e0b;
  --bad:       #ef4444;
  --accent:    #6366f1;
  --kid:       #6366f1;
  --radius:    20px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(236,72,153,.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: min(1680px, 94vw); margin: 0 auto; padding: 22px 24px 80px; }

/* ── En-tête : marque à gauche, enfants à droite ─────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px 24px; flex-wrap: wrap; margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  font-size: 30px; width: 54px; height: 54px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #ec4899); border-radius: 16px;
  box-shadow: var(--shadow);
}
.brand h1 { font-size: 22px; margin: 0; letter-spacing: .3px; }
.brand p  { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

/* Sélecteur d'enfant — compact, aligné à la même hauteur que la marque */
.kids { display: flex; gap: 10px; flex-wrap: wrap; }
.kid-btn {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--card); border: 2px solid transparent; border-radius: 14px;
  padding: 8px 14px; color: var(--text);
  transition: transform .12s, border-color .15s, background .15s;
}
.kid-btn:hover { transform: translateY(-2px); }
.kid-btn .av { font-size: 26px; }
.kid-btn .kb-txt { display: flex; flex-direction: column; line-height: 1.2; }
.kid-btn .nm { font-weight: 700; font-size: 14.5px; }
.kid-btn .cl { color: var(--muted); font-size: 11.5px; }
.kid-btn.active { border-color: var(--kb); background: var(--card-2); }

/* ── Barre de période GLOBALE (année + trimestre) ────────── */
.periodbar {
  display: flex; align-items: center; gap: 14px 26px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; margin: 2px 0 20px; box-shadow: var(--shadow);
}
.pb-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .6px; font-weight: 700; margin-right: 2px;
}
.pchip {
  cursor: pointer; border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--muted); padding: 6px 14px; border-radius: 999px; font-size: 13px;
  transition: all .15s;
}
.pchip:hover { color: var(--text); }
.pchip.active { background: var(--kid); color: #fff; border-color: var(--kid); font-weight: 700; }

/* ── Bandeau d'alertes ───────────────────────────────────── */
.alerts { display: grid; gap: 10px; margin-bottom: 18px; }
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-radius: 14px; font-size: 14px; line-height: 1.35; border: 1px solid var(--line);
}
.alert .ico { font-size: 18px; }
.alert.bad  { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.4); }
.alert.warn { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); }
.alert.good { background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.4); }
.alert b { font-weight: 700; }

/* ── Grille de cartes ────────────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.span-2 { grid-column: 1 / -1; }

#hero { margin-bottom: 16px; }

/* ── Onglets (un bloc à la fois) ──────────────────────────── */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.tab {
  cursor: pointer; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); padding: 9px 14px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; transition: transform .12s, color .15s, background .15s, border-color .15s;
}
.tab:hover { color: var(--text); transform: translateY(-1px); }
.tab.active {
  background: var(--kid); color: #fff; border-color: var(--kid);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--kid) 40%, transparent);
}

/* En-tête de la section affichée */
.sec-head { margin-bottom: 14px; }
.sec-head h2 { margin: 0; font-size: 15px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.sec-head h2 .tag { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ── Carte héro (moyenne générale + niveau) ──────────────── */
.hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--kid) 32%, var(--card)), var(--card) 70%);
  border-color: color-mix(in srgb, var(--kid) 40%, var(--line));
}
.hero-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero .avatar {
  font-size: 46px; width: 78px; height: 78px; display: grid; place-items: center;
  border-radius: 22px; background: rgba(255,255,255,.06);
  border: 2px solid color-mix(in srgb, var(--kid) 60%, transparent);
}
.hero .who h3 { margin: 0; font-size: 20px; }
.hero .who p  { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.hero .avg { margin-left: auto; text-align: right; }
.hero .avg .big { font-size: 46px; font-weight: 800; line-height: 1; }
.hero .avg .big small { font-size: 18px; color: var(--muted); font-weight: 600; }
.hero .avg .cmp { font-size: 12.5px; margin-top: 4px; }
.trend-up   { color: var(--good); }
.trend-down { color: var(--bad); }
.trend-flat { color: var(--muted); }

.level { margin-top: 16px; }
.level .lvl-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.level .lvl-name { font-weight: 700; }
.xpbar { height: 12px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.xpbar > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--kid), color-mix(in srgb, var(--kid) 40%, #fff));
  transition: width .6s ease;
}

/* ── Graphique de progression ────────────────────────────── */
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: 220px; display: block; }
.chart-legend { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 16px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* ── Matières ────────────────────────────────────────────── */
.subj { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 13px 26px; }
.subj .row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.subj .row .nm { font-weight: 600; }
.subj .row .val { font-variant-numeric: tabular-nums; }
.subj .row .val b { font-size: 14px; }
.subj .row .val span { color: var(--muted); font-size: 12px; }
.bar { position: relative; height: 9px; border-radius: 999px; background: rgba(255,255,255,.07); }
.bar > .me { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; background: var(--kid); }
.bar > .cl { position: absolute; top: -3px; width: 2px; height: 15px; border-radius: 2px; background: #fff; opacity: .75; }

/* ── Notes récentes ──────────────────────────────────────── */
.grades { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px 16px; }
.gcard {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.gcard .react { font-size: 22px; }
.gcard .meta { flex: 1; min-width: 0; }
.gcard .meta .s { font-weight: 600; font-size: 13.5px; }
.gcard .meta .d { color: var(--muted); font-size: 11.5px; }
.gcard .meta .c { color: var(--muted); font-size: 11.5px; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .note {
  font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums;
  padding: 4px 10px; border-radius: 12px; min-width: 64px; text-align: center;
}
.gcard .note small { font-size: 11px; color: var(--muted); font-weight: 600; }
.note.n-good { background: rgba(34,197,94,.16);  color: #86efac; }
.note.n-mid  { background: rgba(245,158,11,.16); color: #fcd34d; }
.note.n-low  { background: rgba(239,68,68,.16);  color: #fca5a5; }

/* ── Devoirs ─────────────────────────────────────────────── */
.hw { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 9px 16px; }
.hwitem {
  display: flex; gap: 11px; align-items: flex-start; padding: 10px 12px; border-radius: 13px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.hwitem .chk { font-size: 17px; margin-top: 1px; }
.hwitem .body { flex: 1; min-width: 0; }
.hwitem .body .s { font-weight: 600; font-size: 13.5px; }
.hwitem .body .d { color: var(--muted); font-size: 12.5px; }
.hwitem .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hwitem.overdue { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.08); }
.hwitem.overdue .when { color: #fca5a5; font-weight: 700; }
.hwitem.done .body .s, .hwitem.done .body .d { opacity: .55; text-decoration: line-through; }

/* ── Assiduité ───────────────────────────────────────────── */
.assid { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  flex: 1 1 120px; text-align: center; padding: 14px 10px; border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.stat .n { font-size: 28px; font-weight: 800; line-height: 1; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat.ok .n { color: var(--good); }
.assid-list { margin-top: 12px; display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); }
.assid-list .it { display: flex; justify-content: space-between; gap: 10px; }

/* ── Bulletin ────────────────────────────────────────────── */
.bulletin { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 10px 18px; align-items: start; }
.bulletin .bgen { grid-column: 1 / -1; }
.brow { padding: 10px 13px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); }
.brow .bs { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.brow .bs .bavg { color: var(--muted); font-weight: 600; font-size: 12px; }
.brow .bapp { color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.45; }
.bgen {
  padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--kid) 12%, var(--bg-soft));
}
.bgen-t { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.bgen p { margin: 4px 0; font-size: 12.5px; color: var(--text); line-height: 1.45; }

/* ── Orientation & appétences ────────────────────────────── */
.orient { display: grid; gap: 16px; }
.portrait {
  background: linear-gradient(135deg, color-mix(in srgb, var(--kid) 18%, var(--card)), var(--card) 75%);
  border: 1px solid color-mix(in srgb, var(--kid) 38%, var(--line));
  border-radius: 16px; padding: 16px 18px;
}
.portrait-h { font-weight: 700; font-size: 14px; margin-bottom: 7px; }
.portrait p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.orient-note { color: var(--muted); font-size: 12.5px; margin: 0; }
.orient-h { margin: 6px 0 2px; font-size: 14px; letter-spacing: .2px; }
.orient-callout {
  background: color-mix(in srgb, var(--kid) 12%, var(--bg-soft));
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px;
  font-size: 13px; line-height: 1.5; color: var(--text);
}

/* Barres divergentes : penchant par rapport à sa propre moyenne (ligne centrale) */
.dbars { display: grid; gap: 13px; }
.dbar-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.dbar-row .nm { font-weight: 600; }
.dbar-row .nm .muted-s { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.dbar-row .dv { font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.dbar-row .dv.up { color: var(--kid); font-weight: 600; }
.dbar-row .dv.flat { color: var(--muted); }
.dbar { position: relative; height: 10px; border-radius: 999px; background: rgba(255,255,255,.07); }
.dbar .mid { position: absolute; left: 50%; transform: translateX(-50%); top: -3px; width: 2px; height: 16px; border-radius: 2px; background: var(--muted); opacity: .45; }
.dbar .fill { position: absolute; top: 0; height: 100%; border-radius: 999px; }
.dbar .fill.pos { left: 50%; background: var(--kid); }
.dbar .fill.neg { right: 50%; background: color-mix(in srgb, var(--muted) 65%, transparent); }
.orient-sig { display: flex; gap: 10px; flex-wrap: wrap; }
.sigchip {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; font-size: 13px;
}
.sigchip b { color: var(--good); }
.orient-pistes {
  background: color-mix(in srgb, var(--kid) 10%, var(--bg-soft));
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  font-size: 13.5px; line-height: 1.5;
}
.orient-pistes p { margin: 0 0 6px; }
.orient-pistes ul { margin: 6px 0 0; padding-left: 20px; }
.orient-pistes li { margin: 5px 0; }
.orient-warn { color: var(--muted); font-size: 12.5px; margin-top: 12px !important; }

/* ── Badges ──────────────────────────────────────────────── */
.badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  display: flex; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--line); font-size: 13px;
}
.badge .e { font-size: 20px; }
.badge .t b { display: block; font-weight: 700; font-size: 13px; }
.badge .t span { color: var(--muted); font-size: 11.5px; }
.badge.locked { opacity: .4; filter: grayscale(.6); }

/* ── Bloc Israël ─────────────────────────────────────────── */
.israel {
  background: linear-gradient(135deg, rgba(59,130,246,.14), rgba(255,255,255,.02));
  border-color: rgba(59,130,246,.35);
}
.israel .card-body p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }

.empty { color: var(--muted); font-size: 13px; font-style: italic; padding: 6px 0; }

footer { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 28px; }
.sample-flag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: rgba(245,158,11,.15); color: var(--warn); font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .hero .avg { margin-left: 0; text-align: left; width: 100%; }
  .kids { width: 100%; }
  .kid-btn { flex: 1 1 140px; }
}
