/* Student portal styles. Colours and type follow the screen designs. */
:root {
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --ink: #15181C;
  --ink-2: #2A2F36;
  --muted: #5B616B;
  --line: #E3DFD4;
  --line-strong: #8F8A7B;
  --teal: #17615B;
  --teal-dark: #0F4944;
  --teal-soft: #E3EFEC;
  --amber-soft: #FBEBD7;
  --amber-ink: #7A3F08;
  --grey-soft: #EDEAE0;
  --danger: #A12D2D;
  --danger-soft: #F8E4E2;
  --radius: 14px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--teal); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-48 { gap: 48px; }
.grow { flex: 1 1 0; min-width: 0; }
.spacer { flex: 1 1 0; }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar.dark { background: var(--ink); color: #fff; border-bottom: 0; }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 24px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--teal);
  display: flex; align-items: center; justify-content: center;
}
.topbar.dark .brand-mark { background: #fff; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  display: flex; align-items: center; height: 44px; padding: 0 14px; border-radius: 8px;
  font-size: 15px; font-weight: 500; color: #3C424A; text-decoration: none;
}
.nav a:hover { background: var(--grey-soft); }
.nav a.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 600; }
.topbar.dark .nav a { color: rgba(255,255,255,.86); }
.topbar.dark .nav a:hover, .topbar.dark .nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.who { display: flex; align-items: center; gap: 14px; }
.who-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.who-name { font-size: 14px; font-weight: 600; }
.who-id { font-size: 13px; color: var(--muted); }
.topbar.dark .who-id { color: rgba(255,255,255,.8); }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 36px 24px 64px; }
.page-title { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 4vw, 42px); line-height: 1.1; }
.section-title { font-family: var(--serif); font-weight: 600; font-size: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 24px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 20px; }
.split { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; }
.split-side { flex: 1 1 300px; min-width: 0; }

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1.5px solid transparent;
  font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--grey-soft); }
.btn-ghost { background: transparent; color: var(--teal); padding: 0 10px; }
.btn-ghost:hover:not(:disabled) { background: var(--teal-soft); }
.btn-danger { background: transparent; color: var(--danger); padding: 0 10px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--grey-soft); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 3px solid #4F9C94; outline-offset: 2px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line-strong);
  border-radius: 10px; background: #fff; font-size: 16px;
}
.textarea { padding: 12px 14px; min-height: 120px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.input::placeholder, .textarea::placeholder { color: #6B7078; }
.input-wrap { position: relative; display: flex; }
.input-wrap .input { padding-right: 56px; }
.input-wrap .icon-btn { position: absolute; right: 2px; top: 2px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }

/* ---------- Messages ---------- */
.msg { padding: 12px 16px; border-radius: 10px; font-size: 15px; }
.msg-error { background: var(--danger-soft); color: #7D1F1F; }
.msg-info { background: var(--teal-soft); color: var(--teal-dark); }
.msg-warn { background: var(--amber-soft); color: var(--amber-ink); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 15px; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 1000; max-width: calc(100% - 32px);
}

/* ---------- Badges and progress ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge-teal { background: var(--teal-soft); color: var(--teal-dark); }
.badge-amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge-grey { background: var(--grey-soft); color: #3C424A; }
.tag { width: 84px; text-align: center; padding: 4px 0; border-radius: 6px; font-size: 13px; font-weight: 600; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); }
.progress.thin { height: 6px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px 22px;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #FBFAF6; }
.empty { padding: 28px 22px; color: var(--muted); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-panel {
  flex: 1 1 480px; background: var(--teal); color: #fff; padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
}
.auth-panel .brand-mark { background: #fff; }
.auth-panel h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(36px, 5vw, 52px); line-height: 1.08; max-width: 520px; text-wrap: balance; }
.auth-panel p { font-size: 18px; color: rgba(255,255,255,.88); max-width: 480px; }
.auth-form-wrap { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 600px) { .auth-panel { padding: 36px 24px; gap: 28px; } }

/* ---------- Video player ---------- */
.player-shell { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0F1215; border-radius: var(--radius); overflow: hidden; }
.player-shell iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-shell:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.player-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; padding: 24px; text-align: center; }
.watermark {
  position: absolute; z-index: 5; pointer-events: none; user-select: none;
  color: #fff; opacity: .38; font-weight: 600; font-size: clamp(12px, 1.6vw, 17px); letter-spacing: 1.5px;
  text-shadow: 0 0 3px rgba(0,0,0,.6); transition: left 1.2s ease, top 1.2s ease; white-space: nowrap;
}
.fs-btn {
  position: absolute; z-index: 6; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 8px;
  border: 0; background: rgba(15,18,21,.6); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.fs-btn:hover { background: rgba(15,18,21,.85); }

/* ---------- Lecture list in sidebar ---------- */
.lec-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; border-radius: 10px; text-decoration: none; font-size: 15px; }
a.lec-row:hover { background: #FBFAF6; }
.lec-row.current { background: var(--teal-soft); }

/* ---------- Notes viewer ---------- */
.viewer-stage { background: #E9E5DA; border-radius: var(--radius); padding: 24px; display: flex; justify-content: center; overflow: auto; }
.viewer-page { background: #fff; box-shadow: 0 1px 4px rgba(21,24,28,.18); display: block; max-width: none; user-select: none; -webkit-user-drag: none; }
.page-rail { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow: auto; padding-right: 4px; }
.page-rail button {
  width: 56px; min-height: 44px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.page-rail button.current { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.toolbar { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
@media (max-width: 700px) {
  .page-rail { flex-direction: row; max-height: none; width: 100%; overflow-x: auto; padding: 0 0 4px; }
  .viewer-stage { padding: 10px; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 640px; }
table.data th {
  text-align: left; padding: 12px 14px; font-size: 13px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid #CFC9BA; background: #fff;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.tabs button.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.switch-row { display: flex; align-items: center; gap: 16px; }
.switch { position: relative; width: 52px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 16px; background: #B9B3A3; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--teal); }
.switch[aria-checked="true"]::after { left: 24px; }
.retention { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding-top: 8px; }
.retention span { flex: 1 1 0; min-width: 2px; background: var(--teal); border-radius: 2px 2px 0 0; }
.creds { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }

@media print { body { display: none !important; } }
