/* ============================================================
   LEARNER PORTAL — learner/css/learner.css
   Student-facing UI
   ============================================================ */

.learner-body { background: var(--surface); min-height: 100vh; }

/* ── NAV ─────────────────────────────────────────────────── */
.learner-nav__links{min-width:0;overflow-x:auto;scrollbar-width:thin}
.learner-nav__links a{flex-shrink:0;min-height:44px}
.learner-nav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center;
  height: 56px; padding: 0 20px;
  background: var(--white); border-bottom: 1px solid var(--border);
  gap: 12px;
}
.learner-nav__logo {
  font-family: 'Fraunces', serif; font-size: 1.2rem; font-weight: 900; color: var(--ink);
  flex-shrink: 0; margin-right: 8px;
}
.learner-nav__logo span { color: var(--brand,#1A3A5C); }
.learner-nav__links { display: flex; align-items: center; gap: 2px; flex: 1; }
.learner-nav__links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm);
  font-size: .82rem; font-weight: 500; color: var(--muted);
  transition: var(--ease); text-decoration: none;
}
.learner-nav__links a:hover,
.learner-nav__links a.active { background: var(--surface); color: var(--ink); }
.learner-nav__links a.active { font-weight: 600; }
.learner-nav__links span     { display: none; }
.learner-nav__user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.learner-nav__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand,#1A3A5C); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.learner-nav__logout { color: var(--muted); font-size: .9rem; padding: 4px; transition: var(--ease); }
.learner-nav__logout:hover { color: var(--err); }

/* ── LIVE ALERT ──────────────────────────────────────────── */
.learner-live-alert {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--ok-bg); border-bottom: 1px solid var(--ok);
  padding: 10px 20px; font-size: .88rem; font-weight: 500;
}

/* ── BODY INNER ──────────────────────────────────────────── */
.learner-body-inner { padding: 20px; max-width: 1200px; margin: 0 auto; }

.learner-greeting { margin-bottom: 20px; }
.learner-greeting h2 { font-size: clamp(1.3rem,3vw,1.9rem); margin-bottom: 3px; }
.learner-greeting p  { font-size: .88rem; color: var(--muted); }

/* ── DASH GRID ───────────────────────────────────────────── */
.learner-dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.learner-panel--full { grid-column: 1 / -1; }

/* ── PANELS ──────────────────────────────────────────────── */
.learner-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.learner-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.learner-panel__head h4 { font-size: .88rem; display: flex; align-items: center; gap: 7px; }
.learner-panel__head h4 i { color: var(--brand,#1A3A5C); font-size: .8rem; }
.learner-empty { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 24px 16px; text-align: center; font-size: .82rem; color: var(--muted); }
.learner-empty i { font-size: 1.3rem; color: var(--border); }

/* sessions */
.learner-session-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.learner-session-row:last-child { border-bottom: none; }
.learner-session-time { font-size: .72rem; font-weight: 600; color: var(--muted); min-width: 72px; line-height: 1.4; }
.learner-session-time span { display: block; font-weight: 400; }
.learner-session-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.learner-session-body { flex: 1; min-width: 0; }
.learner-session-title { font-size: .85rem; font-weight: 600; }
.learner-session-sub   { font-size: .74rem; color: var(--muted); }
.learner-session-action { flex-shrink: 0; }

/* assignments */
.learner-asgn-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; transition: var(--ease);
}
.learner-asgn-row:hover { background: var(--surface); }
.learner-asgn-row:last-child { border-bottom: none; }
.learner-asgn-row--overdue { background: var(--err-bg); }
.learner-asgn-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.learner-asgn-body { flex: 1; min-width: 0; }
.learner-asgn-title { font-size: .85rem; font-weight: 600; }
.learner-asgn-meta  { font-size: .74rem; color: var(--muted); }

/* grades */
.learner-grade-row  { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.learner-grade-row:last-child { border-bottom: none; }
.learner-grade-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.learner-grade-body { flex: 1; min-width: 0; }
.learner-grade-label{ font-size: .84rem; font-weight: 600; }
.learner-grade-sub  { font-size: .74rem; color: var(--muted); }
.learner-grade-score{ text-align: right; }
.learner-grade-pct  { font-size: .92rem; font-weight: 700; }
.learner-grade-raw  { font-size: .72rem; color: var(--muted); }

/* subjects grid */
.learner-subjects-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(130px,1fr)); gap: 10px; padding: 14px; }
.learner-subject-card  {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 10px; text-align: center; text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--r);
  transition: var(--ease); background: var(--white);
}
.learner-subject-card:hover { border-color: var(--brand,#1A3A5C); box-shadow: var(--sh); }
.learner-subject-icon  { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.learner-subject-name  { font-size: .82rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.learner-subject-tutor { font-size: .72rem; color: var(--muted); }
.learner-subject-lessons { font-size: .7rem; color: var(--muted); }

/* announcements */
.learner-ann-row { padding: 14px 16px; border-bottom: 1px solid var(--border); position: relative; }
.learner-ann-row:last-child { border-bottom: none; }
.learner-ann-row--pinned { background: #fffbf0; }
.learner-ann-pin  { color: var(--warn); font-size: .72rem; position: absolute; top: 14px; right: 16px; }
.learner-ann-title{ font-size: .88rem; font-weight: 700; margin-bottom: 4px; }
.learner-ann-body { font-size: .82rem; color: var(--muted); line-height: 1.55; }
.learner-ann-date { font-size: .72rem; color: var(--muted); margin-top: 6px; }

/* ── AI FAB ──────────────────────────────────────────────── */
.learner-ai-fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand,#1A3A5C); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; box-shadow: var(--sh-lg); z-index: 500;
  transition: var(--ease); text-decoration: none;
}
.learner-ai-fab:hover { transform: scale(1.1); }

/* ── LOGIN ───────────────────────────────────────────────── */
.learner-login-body  { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--surface); }
.learner-login-wrap  { width: 100%; max-width: 380px; padding: 20px; }
.learner-login-brand { text-align: center; margin-bottom: 20px; }
.learner-login-logo  { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 900; color: var(--ink); display: block; text-decoration: none; }
.learner-login-logo span { color: var(--brand,#1A3A5C); }
.learner-login-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: 4px; }
.learner-login-card  { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); padding: 26px; }
.learner-login-card h3 { margin-bottom: 4px; }
.learner-login-card p  { font-size: .84rem; color: var(--muted); margin-bottom: 18px; }
.learner-login-foot  { text-align: center; margin-top: 16px; font-size: .8rem; color: var(--muted); }

/* ── AI PAGE ─────────────────────────────────────────────── */
.learner-body--ai { overflow: hidden; }
.ai-layout { display: grid; grid-template-columns: 240px 1fr; height: calc(100vh - 56px); overflow: hidden; }
.ai-sidebar {
  background: var(--white); border-right: 1px solid var(--border);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
}
.ai-sidebar__head { text-align: center; }
.ai-robot-icon { font-size: 2rem; margin-bottom: 8px; }
.ai-sidebar__head h4 { margin-bottom: 4px; }
.ai-sidebar__head p  { font-size: .82rem; color: var(--muted); }
.ai-subject-select label { margin-bottom: 6px; }
.ai-suggestions { display: flex; flex-direction: column; gap: 6px; }
.ai-suggestions__label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.ai-chip {
  text-align: left; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: .8rem; cursor: pointer; transition: var(--ease);
}
.ai-chip:hover { border-color: var(--ink); background: var(--white); }

.ai-chat-wrap { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
.ai-chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ai-msg       { display: flex; align-items: flex-start; gap: 10px; max-width: 75%; }
.ai-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg__avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand,#1A3A5C); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700;
}
.ai-msg__avatar--user { background: var(--accent,#e9c46a); color: var(--ink); }
.ai-msg__bubble {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  font-size: .88rem; line-height: 1.6; color: var(--ink);
}
.ai-msg--user .ai-msg__bubble { background: var(--brand,#1A3A5C); color: #fff; border-color: transparent; }
.ai-typing-indicator { display: flex; gap: 4px; align-items: center; padding: 14px; }
.ai-typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce .9s ease infinite; }
.ai-typing-indicator span:nth-child(2) { animation-delay: .15s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0);} 40%{transform:translateY(-7px);} }

.ai-welcome { text-align: center; padding: 40px 20px; }
.ai-welcome__icon { font-size: 2.5rem; margin-bottom: 12px; }
.ai-welcome h4    { margin-bottom: 8px; }
.ai-welcome p     { font-size: .88rem; color: var(--muted); max-width: 360px; margin: 0 auto; }

.ai-input-area { padding: 14px 16px; background: var(--white); border-top: 1px solid var(--border); }
.ai-input-wrap { display: flex; gap: 8px; margin-bottom: 6px; }
.ai-input {
  flex: 1; resize: none; overflow: hidden;
  padding: 10px 14px; font-size: .88rem; font-family: inherit;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--white); color: var(--ink); transition: var(--ease);
}
.ai-input:focus { outline: none; border-color: var(--ink); }
.ai-input-hint { font-size: .72rem; color: var(--muted); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (min-width: 640px) { .learner-nav__links span { display: inline; } }
@media (max-width: 860px) { .learner-dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .learner-body-inner { padding: 12px; }
  .ai-layout { grid-template-columns: 1fr; }
  .ai-sidebar { display: none; }
  .ai-msg { max-width: 90%; }
}

/* ── GRADES PAGE ─────────────────────────────────────────── */
.grades-summary {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px; margin-bottom: 20px;
}
.grades-summary__overall { text-align: center; min-width: 100px; }
.grades-summary__label   { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.grades-summary__pct     { font-family: 'Fraunces',serif; font-size: 2.4rem; font-weight: 900; line-height: 1; }
.grades-summary__raw     { font-size: .74rem; color: var(--muted); margin-top: 4px; }
.grades-summary__subjects{ flex: 1; display: flex; flex-direction: column; gap: 10px; }
.grade-subject-chip      { display: flex; align-items: center; gap: 10px; }
.grade-subject-chip__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.grade-subject-chip__name{ flex: 1; font-size: .84rem; font-weight: 500; }
.grade-subject-chip__pct { font-size: .84rem; font-weight: 700; min-width: 44px; text-align: right; }
.grade-subject-chip__bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; max-width: 120px; }
.grade-subject-chip__fill{ height: 100%; border-radius: 2px; transition: width .4s ease; }
.learner-grade-result    { font-size: .88rem; font-weight: 700; margin-bottom: 3px; }
.grades-bar              { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; max-width: 80px; }
.grades-bar__fill        { height: 100%; border-radius: 2px; }

/* ── SUBJECTS PAGE ───────────────────────────────────────── */
.subjects-layout { display: grid; grid-template-columns: 220px 1fr; height: calc(100vh - 56px); overflow: hidden; }
.subjects-sidebar { background: var(--white); border-right: 1px solid var(--border); overflow-y: auto; }
.subjects-sidebar__head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.subjects-sidebar__item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-left: 3px solid transparent;
  text-decoration: none; color: inherit; transition: var(--ease);
  border-bottom: 1px solid var(--border);
}
.subjects-sidebar__item:hover { background: var(--surface); }
.subjects-sidebar__item.active { background: var(--surface); font-weight: 600; }
.subjects-sidebar__icon { font-size: 1.1rem; flex-shrink: 0; }
.subjects-sidebar__name { font-size: .84rem; font-weight: 500; }
.subjects-sidebar__count{ font-size: .72rem; color: var(--muted); }
.subjects-content { overflow-y: auto; }
.subject-content-head {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px; background: var(--white);
  border-bottom: 1px solid var(--border);
}
.subject-content-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.subject-lessons-list { display: flex; flex-direction: column; gap: 6px; }
.subject-lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; transition: var(--ease);
}
.subject-lesson-row:hover { border-color: var(--brand,#1A3A5C); box-shadow: var(--sh); }
.subject-lesson-row__icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.subject-lesson-row__body { flex: 1; min-width: 0; }
.subject-lesson-row__title{ font-size: .88rem; font-weight: 600; }
.subject-lesson-row__desc { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.subject-lesson-row__type { flex-shrink: 0; }
.subject-lesson-row__arrow{ color: var(--muted); font-size: .72rem; }

/* ── LIVE CLASS (student) ────────────────────────────────── */
.learner-waiting { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: rgba(255,255,255,.7); text-align: center; gap: 12px; }
.learner-waiting__icon { font-size: 3rem; opacity: .4; }
.learner-waiting h3 { color: rgba(255,255,255,.8); font-size: 1.4rem; }
.learner-waiting p  { color: rgba(255,255,255,.4); font-size: .9rem; }
.learner-wb-badge {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.45); color: rgba(255,255,255,.7);
  font-size: .72rem; padding: 4px 12px; border-radius: 20px; pointer-events: none;
}

@media (max-width: 640px) {
  .subjects-layout { grid-template-columns: 1fr; }
  .subjects-sidebar { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .grades-summary { flex-direction: column; }
}

/* Keep navigation labelled and touch-friendly on narrow devices. */
@media(max-width:640px){
  .learner-nav{height:auto;min-height:56px;flex-wrap:wrap;padding:8px 12px;gap:8px}
  .learner-nav__logo{flex:1}.learner-nav__user{margin-left:0}
  .learner-nav__links{order:3;flex-basis:100%;width:100%}
  .learner-nav__links span{display:inline}
  .learner-nav__links a{padding:10px 12px;white-space:nowrap}
  .subjects-layout{height:auto;min-height:calc(100dvh - 110px);overflow:visible}
  .subjects-content{min-width:0;overflow:visible}
  .learner-body input,.learner-body select,.learner-body textarea{font-size:16px}
}
.lesson-file-frame{display:block;width:100%;height:min(65dvh,600px);border:0;margin-top:12px}.subject-lesson-row:focus-visible{outline:3px solid var(--brand,#1a3a5c);outline-offset:3px}@media(max-width:640px){#resource-modal .modal-box{width:calc(100vw - 24px);padding:16px;max-height:90dvh;overflow-y:auto}}
/* Shared student workspace */
.learning-header{background:#fff;border-bottom:1px solid #dce5ee;box-shadow:0 3px 16px #173d5705;color:#203b4d}.learning-header__identity{max-width:1240px;margin:auto;padding:18px 30px;display:flex;align-items:center;gap:24px}.learning-brand{display:flex;align-items:center;flex-shrink:0}.learning-brand img{object-fit:contain;width:154px;height:52px}.learning-space{border-left:1px solid #dce5ee;padding-left:24px;color:#6d7f91;font:500 14px system-ui}.learning-account{margin-left:auto;display:flex;align-items:center;gap:18px;font:600 14px system-ui}.learning-account a{color:#61758b;font-weight:500;min-height:44px;display:flex;align-items:center}.learning-nav{max-width:1240px;margin:auto;padding:0 22px;display:flex;gap:6px;overflow-x:auto;scrollbar-width:thin}.learning-nav a{white-space:nowrap;min-height:48px;padding:14px 14px;display:flex;align-items:center;font:550 14px system-ui;color:#627184;border-bottom:3px solid transparent;text-decoration:none}.learning-nav a:hover{background:#f5f8fc;color:#174b89}.learning-nav a[aria-current=page]{border-bottom-color:var(--brand,#174b89);color:var(--brand,#174b89);font-weight:750}.learning-nav :focus-visible,.learning-header :focus-visible{outline:3px solid #d8af49;outline-offset:-3px}.learner-body{background:#f3f6fa}.learner-body-inner{max-width:1180px;padding:30px 24px;width:100%;box-sizing:border-box}.learner-greeting h2{font-family:system-ui;font-weight:750}.learner-panel{border-color:#e0e7ef;border-radius:14px;box-shadow:0 4px 16px #173d5704}.learner-panel__head{padding:20px}.learner-panel__head h4{font-size:16px}.learner-empty{padding:34px 20px;font-size:14px}.learner-session-row,.learner-assignment-row{padding:16px 20px}.learner-body .billing-settings article{background:#fff;border:1px solid #dce5ee;padding:24px;border-radius:14px;margin:20px 0}.learner-body .billing-settings code{overflow-wrap:anywhere}.learner-body .billing-settings .bank{white-space:pre-wrap;overflow-wrap:anywhere}.learner-body .billing-settings h2{font:700 20px system-ui}.learner-body .billing-settings form{margin-top:18px}.learner-body .billing-settings article>p{color:#627184}
@media(max-width:640px){.learning-header__identity{padding:14px 16px;gap:12px}.learning-brand img{width:126px;height:44px}.learning-space{display:none}.learning-account{font-size:12px;gap:10px}.learning-account>span{max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.learning-nav{padding:0 8px;gap:0}.learning-nav a{font-size:13px;padding:12px;min-height:48px}.learner-body-inner{padding:22px 16px}.learner-panel__head{padding:16px}.learner-dash-grid{gap:18px}}
