/* =====================================================================
   grades.css — "Students by grade" card in the Admin Console (pairs with js/grades.js). Load it after smooth.css.
   Dark + light, phones / iPads / PCs. Only transform / opacity / grid-rows animate.
   ===================================================================== */
.gl-card {
    --gl-line: rgba(255, 255, 255, .09); --gl-soft: rgba(255, 255, 255, .05); --gl-ink: #e8ecf6; --gl-mute: #98a4bb; --gl-acc: #818cf8;
    position: relative; box-sizing: border-box; width: 100%; padding: 20px 22px 18px; border-radius: 22px; color: var(--gl-ink);
    background: linear-gradient(180deg, rgba(28, 34, 66, .78), rgba(13, 17, 36, .86)); border: 1px solid var(--gl-line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 22px 44px -26px rgba(0, 0, 0, .8);
}
html.light-theme .gl-card {
    --gl-line: rgba(109, 94, 252, .16); --gl-soft: rgba(109, 94, 252, .06); --gl-ink: #1e1b4b; --gl-mute: #5b5f87; --gl-acc: #6d5efc;
    background: #fff; box-shadow: 0 1px 0 #fff inset, 0 16px 34px -20px rgba(109, 94, 252, .35);
}

.gl-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 14px; }
.gl-head h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.01em; color: var(--gl-ink); }
.gl-sub { margin: 3px 0 0; font-size: 12px; color: var(--gl-mute); }
.gl-head-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* buttons */
.gl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 13px; border-radius: 11px; cursor: pointer;
    font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap;
    color: var(--gl-ink); background: var(--gl-soft); border: 1px solid var(--gl-line);
}
.gl-btn:hover:not(:disabled) { border-color: var(--gl-acc); }
.gl-btn:disabled { opacity: .4; cursor: not-allowed; }
.gl-primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 10px 22px -12px rgba(99, 102, 241, .9); }
.gl-wa { color: #34d399; border-color: rgba(52, 211, 153, .4); background: rgba(16, 185, 129, .12); }
html.light-theme .gl-wa { color: #047857; background: #ecfdf5; border-color: #6ee7b7; }
.gl-btn.is-good { color: #34d399; border-color: rgba(52, 211, 153, .4); }
.gl-btn.is-bad { color: #fb7185; border-color: rgba(251, 113, 133, .4); }
.gl-btn.is-warn { color: #fbbf24; border-color: rgba(251, 191, 36, .45); }
.gl-btn.is-on { color: var(--gl-acc); border-color: var(--gl-acc); }
.gl-ico { width: 36px; padding: 0; font-size: 18px; letter-spacing: 1px; }

/* grade tabs: one row, swipe sideways on a phone */
.gl-tabs { display: flex; gap: 8px; margin: 16px -4px 12px; padding: 2px 4px 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
.gl-tabs::-webkit-scrollbar { display: none; }
.gl-tab {
    flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 15px; border-radius: 999px; cursor: pointer; scroll-snap-align: start;
    font-family: inherit; font-size: 12.5px; font-weight: 800; color: var(--gl-mute); background: var(--gl-soft); border: 1px solid var(--gl-line);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.gl-tab b { min-width: 20px; padding: 2px 6px; border-radius: 999px; font-size: 11px; text-align: center; background: rgba(255, 255, 255, .08); }
html.light-theme .gl-tab b { background: rgba(109, 94, 252, .1); }
.gl-tab:hover { color: var(--gl-ink); }
.gl-tab.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 10px 22px -12px rgba(99, 102, 241, .95); }
.gl-tab.on b { background: rgba(255, 255, 255, .22); }

/* message editor (slides open) */
.gl-tpl { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s cubic-bezier(.22, 1, .36, 1); }
.gl-tpl > div { overflow: hidden; min-height: 0; }
.gl-tpl.on { grid-template-rows: 1fr; margin-bottom: 12px; }
.gl-tpl label { display: block; margin: 2px 0 6px; font-size: 11.5px; font-weight: 700; color: var(--gl-mute); }
.gl-tpl textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; resize: vertical; font: 500 13px/1.5 inherit; font-family: inherit; color: var(--gl-ink); background: rgba(2, 6, 23, .45); border: 1px solid var(--gl-line); }
html.light-theme .gl-tpl textarea { background: #f8f7ff; }
.gl-tpl small { display: block; margin-top: 5px; font-size: 11px; color: var(--gl-mute); }

/* search / sort / copy */
.gl-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.gl-tools input { flex: 1 1 200px; min-width: 0; min-height: 40px; padding: 0 14px; border-radius: 12px; font: 500 13px/1 inherit; font-family: inherit; color: var(--gl-ink); background: rgba(2, 6, 23, .45); border: 1px solid var(--gl-line); }
.gl-tools select { flex: 0 1 190px; min-height: 40px; padding: 0 12px; border-radius: 12px; font: 600 12.5px/1 inherit; font-family: inherit; color: var(--gl-ink); background: rgba(2, 6, 23, .45); border: 1px solid var(--gl-line); }
html.light-theme .gl-tools input, html.light-theme .gl-tools select { background: #f8f7ff; }
.gl-tools .gl-btn { min-height: 40px; }

/* student rows */
.gl-list { display: flex; flex-direction: column; gap: 10px; }
.gl-empty { margin: 14px 0; text-align: center; font-size: 13px; color: var(--gl-mute); }
.gl-row {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; padding: 12px 14px; border-radius: 16px;
    background: var(--gl-soft); border: 1px solid var(--gl-line); overflow-wrap: anywhere;
    transition: border-color .2s ease, background-color .2s ease;
}
.gl-row:hover { border-color: rgba(129, 140, 248, .45); }
.gl-row.gl-open { border-color: var(--gl-acc); }
.gl-av { width: 46px; height: 46px; border-radius: 14px; object-fit: cover; border: 1px solid var(--gl-line); background: var(--gl-soft); }
.gl-main { min-width: 0; }
.gl-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; }
.gl-name b { font-size: 14px; font-weight: 800; color: var(--gl-ink); }
.gl-chip { padding: 1px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 700; border: 1px solid; }
.gl-chip.is-title { color: #c7d2fe; background: rgba(99, 102, 241, .2); border-color: rgba(129, 140, 248, .4); }
.gl-chip.is-admin { color: #fca5a5; background: rgba(239, 68, 68, .16); border-color: rgba(248, 113, 113, .4); }
.gl-chip.is-teacher { color: #fcd34d; background: rgba(245, 158, 11, .16); border-color: rgba(251, 191, 36, .4); }
html.light-theme .gl-chip.is-title { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
html.light-theme .gl-chip.is-admin { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
html.light-theme .gl-chip.is-teacher { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.gl-meta { margin-top: 2px; font-size: 11.5px; color: var(--gl-mute); }
.gl-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--gl-mute); }
.gl-stats small { font-size: 11px; font-weight: 700; }
.gl-prog { position: relative; display: inline-block; width: 90px; height: 6px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .1); }
html.light-theme .gl-prog { background: rgba(109, 94, 252, .14); }
.gl-prog i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #22d3ee); }
.gl-acts { display: flex; gap: 8px; }

/* the "More" drawer opens smoothly with no JS height maths */
.gl-drawer { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .38s cubic-bezier(.22, 1, .36, 1); }
.gl-drawer-in { min-height: 0; overflow: hidden; display: flex; flex-wrap: wrap; gap: 8px; }
.gl-open .gl-drawer { grid-template-rows: 1fr; }
.gl-open .gl-drawer-in { padding-top: 12px; margin-top: 10px; border-top: 1px dashed var(--gl-line); }

.gl-morewrap { margin-top: 12px; text-align: center; }
.gl-morewrap .gl-btn[hidden] { display: none; }

/* phones: the buttons drop under the name and share the width */
@media (max-width: 640px) {
    .gl-card { padding: 16px 14px 14px; border-radius: 20px; }
    .gl-row { grid-template-columns: auto minmax(0, 1fr); padding: 12px; }
    .gl-acts { grid-column: 1 / -1; margin-top: 8px; }
    .gl-acts .gl-btn { flex: 1; min-height: 42px; }
    .gl-acts .gl-ico { flex: 0 0 46px; }
    .gl-drawer-in .gl-btn { flex: 1 1 calc(50% - 8px); min-height: 42px; }
    .gl-head-btns { width: 100%; }
    .gl-head-btns .gl-btn { flex: 1; min-height: 40px; }
    .gl-tools input, .gl-tools select, .gl-tpl textarea { font-size: 16px; }   /* stops iOS zooming in */
    .gl-tools select, .gl-tools .gl-btn { flex: 1 1 calc(50% - 8px); }
}
@media (prefers-reduced-motion: reduce) { .gl-tpl, .gl-drawer, .gl-tab, .gl-row { transition: none; } }

/* ---------- per-student session progress ("Sessions" button) ---------- */
.gl-sbtn.is-open, .gl-sessopen .gl-sbtn { color: var(--gl-acc); border-color: var(--gl-acc); }
.gl-row.gl-sessopen { border-color: var(--gl-acc); }
.gl-sess { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .38s cubic-bezier(.22, 1, .36, 1); }
.gl-sess-in { min-height: 0; overflow: hidden; }
.gl-sessopen .gl-sess { grid-template-rows: 1fr; }
.gl-sessopen .gl-sess-in { padding-top: 12px; margin-top: 10px; border-top: 1px dashed var(--gl-line); }
.gl-sess-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.gl-sess-sum { font-size: 13px; font-weight: 700; color: var(--gl-ink); }
.gl-sess-sum b { font-weight: 900; }
.gl-sess-sum small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--gl-mute); }
.gl-sess-top .gl-btn { min-height: 32px; padding: 0 11px; }
.gl-si-bar { position: relative; height: 7px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .1); }
html.light-theme .gl-si-bar { background: rgba(109, 94, 252, .14); }
.gl-si-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #22d3ee); transition: width .5s cubic-bezier(.22, 1, .36, 1); }
.gl-sess-all { margin: 10px 0 12px; height: 8px; }
.gl-sfs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gl-sfs::-webkit-scrollbar { display: none; }
.gl-sf {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer;
    font-family: inherit; font-size: 11.5px; font-weight: 800; color: var(--gl-mute); background: var(--gl-soft); border: 1px solid var(--gl-line);
}
.gl-sf b { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); }
html.light-theme .gl-sf b { background: rgba(109, 94, 252, .1); }
.gl-sf.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.gl-sf.on b { background: rgba(255, 255, 255, .22); }
.gl-sess-list { display: grid; gap: 8px; max-height: 430px; overflow-y: auto; padding-right: 2px; overscroll-behavior: contain; }
.gl-si { padding: 10px 12px; border-radius: 13px; background: rgba(2, 6, 23, .3); border: 1px solid var(--gl-line); border-left-width: 3px; }
html.light-theme .gl-si { background: #faf9ff; }
.gl-si.is-done { border-left-color: #34d399; }
.gl-si.is-prog { border-left-color: #fbbf24; }
.gl-si.is-new { border-left-color: #64748b; }
.gl-si-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.gl-si-name b { display: block; font-size: 13px; font-weight: 800; color: var(--gl-ink); }
.gl-si-name small { display: block; margin-top: 1px; font-size: 10.5px; font-weight: 600; color: var(--gl-mute); }
.gl-st { flex: none; padding: 3px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 800; white-space: nowrap; color: var(--gl-mute); background: var(--gl-soft); border: 1px solid var(--gl-line); }
.is-done .gl-st { color: #34d399; background: rgba(16, 185, 129, .12); border-color: rgba(52, 211, 153, .4); }
.is-prog .gl-st { color: #fbbf24; background: rgba(245, 158, 11, .12); border-color: rgba(251, 191, 36, .4); }
html.light-theme .is-done .gl-st { color: #047857; background: #ecfdf5; }
html.light-theme .is-prog .gl-st { color: #b45309; background: #fffbeb; }
.is-done .gl-si-bar i { background: linear-gradient(90deg, #10b981, #34d399); }
.is-prog .gl-si-bar i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.gl-si-meta { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 8px; font-size: 11.5px; font-weight: 600; color: var(--gl-mute); }
.gl-si-meta b { color: var(--gl-ink); font-variant-numeric: tabular-nums; }
.gl-si-meta .gl-pct { color: var(--gl-ink); font-weight: 800; }
.gl-sess-retry { display: flex; justify-content: center; margin-bottom: 4px; }
@media (max-width: 640px) {
    .gl-sess-list { max-height: 60vh; }
    .gl-si-top { flex-direction: column-reverse; gap: 6px; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .gl-sess, .gl-si-bar i { transition: none; } }

/* Student analytics window -> "Per-Session Breakdown": session names are .text-white, which vanished on the light rows in light mode */
html.light-theme #stats-lectures-breakdown .text-white,
html.light-theme #stats-lectures-breakdown span.font-extrabold { color: #1e1b4b !important; }
html.light-theme #stats-lectures-breakdown .text-gray-500 { color: #5b5f87 !important; }