/* ==========================================================================
   CORE AI CAMPUS - STUDENT PORTAL
   app.css   One stylesheet for the whole portal.

   The palette, the type scale and the shapes are lifted from the public
   coreaicampus.com sections, so a student moving from the website into the
   portal does not feel handed off to someone else's software.
   ========================================================================== */

:root {
  --navy-deep: #0A1E44;
  --navy:      #123B6E;
  --blue:      #1457C7;
  --teal:      #0E86A8;
  --teal-2:    #0DA087;
  --green:     #1FB566;

  --ink:    #0A1220;
  --muted:  #5C6472;
  --faint:  #8A93A3;
  --bg:     #F6F9FC;
  --surface:#FFFFFF;
  --line:   rgba(10,30,68,0.10);
  --line-2: rgba(10,30,68,0.06);

  --ramp: linear-gradient(90deg,#123B6E 0%,#1457C7 35%,#0E86A8 68%,#1FB566 100%);

  --sidebar: 252px;
  --radius:  16px;
  --shadow:  0 10px 30px -18px rgba(10,30,68,0.40);
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 { font-family: 'Sora','Inter',sans-serif; letter-spacing: -0.022em; line-height: 1.22; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

/* Default size for every icon drawn by icon() in app.js. Without it an inline
   SVG stretches to fill its container. More specific rules below (.cac-nav svg,
   .cac-res-i svg and so on) override this where a different size is wanted. */
.cac-ic { width: 16px; height: 16px; flex-shrink: 0; }
.cac-sec-title .cac-ic { width: 13px; height: 13px; vertical-align: -1px; margin-right: 3px; }
.cac-level-no .cac-ic { width: 17px; height: 17px; }

.cac-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}


/* ==========================================================================
   LOGIN
   ========================================================================== */

.cac-login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: 1.05fr 1fr;
}

.cac-login-art {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg,#08193A 0%,#0F3B76 48%,#0E7A73 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 46px;
  color: #fff;
}
.cac-login-art::before {
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(70% 55% at 28% 16%, rgba(31,181,102,0.26), transparent 66%),
    radial-gradient(60% 50% at 88% 80%, rgba(20,87,199,0.30), transparent 68%);
}
.cac-login-art > * { position: relative; z-index: 1; }

.cac-logo { display: flex; align-items: center; gap: 11px; }
.cac-logo-mark {
  width: 38px; height: 38px; border-radius: 11px; background: #fff;
  /* flex, not grid: a bare text run inside a grid container is an anonymous
     item that place-items does not centre, so "CAC" sat against the left
     edge. Only boxes that contain TEXT need this; icon boxes hold an <svg>
     element and centre correctly either way. */
  display: flex; align-items: center; justify-content: center;
  font-family: 'Sora',sans-serif; font-weight: 800; font-size: 14px;
  color: var(--navy-deep); letter-spacing: 0.3px;
}
.cac-logo-text { font-family:'Sora',sans-serif; font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; }

.cac-login-mid h2 { font-size: 30px; font-weight: 800; margin-bottom: 12px; }
.cac-login-mid p  { font-size: 14.5px; line-height: 1.6; color: rgba(255,255,255,0.72); max-width: 42ch; }

/* the five levels, as the ascending ramp used across the brand */
.cac-ramp { display: flex; align-items: flex-end; gap: 9px; height: 96px; margin-bottom: 28px; }
.cac-ramp i {
  flex: 1; border-radius: 7px; display: block;
  animation: cacRampIn .9s cubic-bezier(.22,.9,.3,1) both;
  transform-origin: 50% 100%;
}
.cac-ramp i:nth-child(1){height:26%;background:#2A4E85;animation-delay:.05s}
.cac-ramp i:nth-child(2){height:42%;background:#1457C7;animation-delay:.13s}
.cac-ramp i:nth-child(3){height:58%;background:#0E86A8;animation-delay:.21s}
.cac-ramp i:nth-child(4){height:76%;background:#0DA087;animation-delay:.29s}
.cac-ramp i:nth-child(5){height:100%;background:#1FB566;animation-delay:.37s}
@keyframes cacRampIn { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }

.cac-login-foot { font-size: 12.5px; color: rgba(255,255,255,0.55); }

.cac-login-side { display: grid; place-items: center; padding: 40px 32px; }
.cac-login-box  { width: 100%; max-width: 390px; }
.cac-login-box h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.cac-login-box .cac-sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }


/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */

.cac-field { margin-bottom: 14px; }
.cac-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

.cac-in {
  width: 100%; font-family: inherit; font-size: 15px; font-weight: 500; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 13px 15px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.cac-in::placeholder { color: #9AA3B2; }
.cac-in:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,87,199,0.13); }

.cac-btn {
  width: 100%; color: #fff; background: var(--ramp);
  font-family:'Sora',sans-serif; font-weight: 700; font-size: 15px;
  padding: 14px 20px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 14px 30px -14px rgba(10,30,68,0.5);
  transition: transform .2s cubic-bezier(.22,.9,.3,1), opacity .2s ease;
}
.cac-btn:hover:not(:disabled) { transform: translateY(-2px); }
.cac-btn:disabled { opacity: .6; cursor: not-allowed; }

.cac-btn-ghost {
  width: auto; background: var(--surface); color: var(--navy-deep);
  border: 1.5px solid var(--line); box-shadow: none;
  font-size: 13.5px; padding: 10px 18px;
}
.cac-btn-ghost:hover { border-color: var(--blue); }

.cac-spin {
  width: 15px; height: 15px; border-radius: 50%; display: none; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: cacRot .7s linear infinite;
}
.cac-btn.is-busy .cac-spin { display: block; }
@keyframes cacRot { to { transform: rotate(360deg); } }

.cac-alert {
  display: none; margin-bottom: 14px; padding: 11px 13px; border-radius: 11px;
  font-size: 13px; line-height: 1.5;
  background: rgba(208,69,59,0.08); color: #B3372E;
}
.cac-alert.is-on { display: block; }
.cac-alert.is-info { background: rgba(20,87,199,0.08); color: #0F47A8; }

.cac-note { margin-top: 16px; font-size: 12px; line-height: 1.55; color: var(--faint); text-align: center; }


/* ==========================================================================
   APP SHELL
   ========================================================================== */

.cac-app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.cac-side {
  background: var(--navy-deep); color: #fff;
  padding: 26px 18px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.cac-side .cac-logo-text { color: #fff; }

.cac-nav { display: flex; flex-direction: column; gap: 3px; }
.cac-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 11px;
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.68);
  transition: background .16s ease, color .16s ease;
}
.cac-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.cac-nav a.is-on { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }
.cac-nav svg { width: 17px; height: 17px; flex-shrink: 0; }

.cac-side-foot { margin-top: auto; }
.cac-side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 11px; border-radius: 12px; background: rgba(255,255,255,0.06);
  margin-bottom: 10px;
}
.cac-side-user .cac-avatar { width: 34px; height: 34px; font-size: 12px; }
.cac-side-user b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
/* :not(.cac-avatar) matters. The avatar is a <span> too, so the bare
   `.cac-side-user span` rule was setting display:block on it, which beat
   .cac-avatar's own display and stopped the initials from centring. */
.cac-side-user span:not(.cac-avatar) { display: block; font-size: 11px; color: rgba(255,255,255,0.55); }
.cac-signout {
  width: 100%; text-align: left; padding: 9px 13px; border-radius: 10px;
  font-size: 13px; color: rgba(255,255,255,0.6);
  display: flex; align-items: center; gap: 9px;
  transition: background .16s ease, color .16s ease;
}
.cac-signout:hover { background: rgba(255,255,255,0.07); color: #fff; }

.cac-main { padding: 34px 40px 60px; min-width: 0; }
.cac-wrap { max-width: 1060px; }

.cac-page-head { margin-bottom: 26px; }
.cac-page-head h1 { font-size: 27px; font-weight: 800; margin-bottom: 5px; }
.cac-page-head p  { color: var(--muted); font-size: 14.5px; }

.cac-crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--faint); margin-bottom: 10px; }
.cac-crumb a:hover { color: var(--blue); }

.cac-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--ramp); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family:'Sora',sans-serif; font-weight: 800; font-size: 17px;
  /* line-height 1, or the body's 1.55 makes the initials taller than the
     circle and clips them against overflow:hidden */
  line-height: 1;
  overflow: hidden;
}
.cac-avatar img { width: 100%; height: 100%; object-fit: cover; }


/* ==========================================================================
   CARDS
   ========================================================================== */

.cac-card {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.cac-card-pad { padding: 22px 24px; }

.cac-grid { display: grid; gap: 18px; }
.cac-grid-2 { grid-template-columns: 1.55fr 1fr; align-items: start; }

.cac-sec-title {
  font-family:'Sora',sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: .085em; text-transform: uppercase; color: var(--faint);
  margin-bottom: 12px;
}

/* student identity card */
.cac-idcard { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.cac-idcard .cac-avatar { width: 62px; height: 62px; font-size: 20px; }
.cac-idcard h2 { font-size: 21px; font-weight: 800; }
.cac-idcard p  { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

.cac-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.cac-chip {
  font-size: 11.5px; font-weight: 600; color: var(--navy);
  background: #E9F0FF; border-radius: 999px; padding: 5px 11px;
}

/* progress */
.cac-prog-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.cac-prog-top b { font-family:'Sora',sans-serif; font-size: 25px; font-weight: 800; }
.cac-prog-top span { font-size: 12.5px; color: var(--muted); }
.cac-bar { height: 10px; border-radius: 999px; background: rgba(10,30,68,0.08); overflow: hidden; }
.cac-bar i {
  display: block; height: 100%; border-radius: 999px; background: var(--ramp);
  transition: width .9s cubic-bezier(.22,.9,.3,1);
}

/* levels */
.cac-levels { display: flex; flex-direction: column; gap: 10px; }

.cac-level {
  display: flex; align-items: center; gap: 15px;
  padding: 16px 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-2);
  transition: border-color .18s ease, transform .18s ease;
}
.cac-level.is-open:hover { border-color: rgba(20,87,199,0.35); transform: translateX(2px); }
.cac-level.is-locked { background: #FBFCFE; border-style: dashed; }

.cac-level-no {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family:'Sora',sans-serif; font-weight: 800; font-size: 14px; color: #fff;
  line-height: 1;
}
/* The level colours are listed for both carriers of the .l1 to .l5 class:
   the compact row on the dashboard (.cac-level) and the full block on the
   programme page (.cac-lvblock). Scoped to .cac-level alone, the programme
   page's badges had no background at all, which left white numerals on a
   white card. */
.cac-level.l1 .cac-level-no, .cac-lvblock.l1 .cac-level-no { background: #123B6E; }
.cac-level.l2 .cac-level-no, .cac-lvblock.l2 .cac-level-no { background: #1457C7; }
.cac-level.l3 .cac-level-no, .cac-lvblock.l3 .cac-level-no { background: #0E86A8; }
.cac-level.l4 .cac-level-no, .cac-lvblock.l4 .cac-level-no { background: #0DA087; }
.cac-level.l5 .cac-level-no, .cac-lvblock.l5 .cac-level-no { background: #1FB566; }
.cac-level.is-locked .cac-level-no { background: #C6CDD8; }

.cac-level-body { flex: 1; min-width: 0; }
.cac-level-body h3 { font-size: 15.5px; font-weight: 700; }
.cac-level-body p  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.cac-state {
  font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}
.cac-state.done    { background: rgba(31,181,102,0.12); color: #12864F; }
.cac-state.now     { background: rgba(20,87,199,0.11);  color: #1044A8; }
.cac-state.locked  { background: rgba(10,30,68,0.06);   color: var(--faint); }
.cac-state.soon    { background: rgba(14,134,168,0.11); color: #0B6379; }

/* module list inside a level */
.cac-mods { display: grid; grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); gap: 10px; margin-top: 14px; }
.cac-mod {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-2);
  transition: border-color .18s ease, transform .18s ease;
}
.cac-mod:hover { border-color: rgba(20,87,199,0.35); transform: translateY(-2px); }
.cac-mod.is-locked { opacity: .55; pointer-events: none; border-style: dashed; }
.cac-mod-i {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: #EDF2FA; display: grid; place-items: center;
}
.cac-mod-i svg { width: 15px; height: 15px; color: var(--navy); }
.cac-mod b { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.cac-mod span { display: block; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.cac-mod.done .cac-mod-i { background: rgba(31,181,102,0.14); }
.cac-mod.done .cac-mod-i svg { color: #12864F; }

/* resources */
.cac-res { display: flex; flex-direction: column; gap: 9px; }
.cac-res-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--line-2);
  transition: border-color .18s ease, transform .18s ease;
  /* these rows are <button> elements so the whole row is clickable and
     reachable by keyboard. A button centres its text by default, which is
     what pushed every resource title into the middle of the row. */
  text-align: left; font: inherit; color: inherit;
}
.cac-res-item:hover { border-color: rgba(20,87,199,0.35); transform: translateX(2px); }
.cac-res-i {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; background: #EDF2FA;
}
.cac-res-i svg { width: 18px; height: 18px; }
.cac-res-i.pdf   { background: rgba(208,69,59,0.10);  color: #C13B31; }
.cac-res-i.video { background: rgba(20,87,199,0.10);  color: #1044A8; }
.cac-res-i.link  { background: rgba(14,134,168,0.11); color: #0B6379; }
.cac-res-i.file  { background: rgba(13,160,135,0.11); color: #0A7A66; }
.cac-res-body { flex: 1; min-width: 0; }
.cac-res-body b { font-size: 14.5px; font-weight: 600; display: block; }
.cac-res-body span { font-size: 12px; color: var(--faint); }
.cac-res-go { font-size: 13px; font-weight: 600; color: var(--blue); flex-shrink: 0; }

/* announcements */
.cac-ann { display: flex; flex-direction: column; gap: 11px; }
.cac-ann-item { padding: 14px 16px; border-radius: 13px; background: #FBFCFE; border: 1px solid var(--line-2); }
.cac-ann-item.important { background: rgba(20,87,199,0.05); border-color: rgba(20,87,199,0.18); }
.cac-ann-item b { display: block; font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.cac-ann-item p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.cac-ann-item time { display: block; font-size: 11.5px; color: var(--faint); margin-top: 7px; }

.cac-empty { padding: 30px 20px; text-align: center; color: var(--faint); font-size: 13.5px; }

.cac-skeleton {
  background: linear-gradient(90deg,#EEF2F7 25%,#F7F9FC 50%,#EEF2F7 75%);
  background-size: 400% 100%; animation: cacShim 1.3s ease infinite; border-radius: 10px;
}
@keyframes cacShim { 0%{background-position:100% 0} 100%{background-position:0 0} }

/* the banner shown while the portal is running on sample data */
.cac-demo {
  background: #FFF6E6; border: 1px solid #F2D9A8; color: #7A5A12;
  border-radius: 12px; padding: 11px 15px; font-size: 12.5px; line-height: 1.55;
  margin-bottom: 20px;
}
.cac-demo b { font-weight: 700; }


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 980px) {
  .cac-login { grid-template-columns: 1fr; }
  /* the art panel becomes a short header so the form is reachable without
     scrolling on a phone */
  .cac-login-art { padding: 26px 24px; gap: 22px; }
  .cac-login-mid h2 { font-size: 23px; }
  .cac-login-mid p { font-size: 13.5px; }
  .cac-ramp { height: 62px; margin-bottom: 20px; }
  .cac-login-foot { display: none; }
  .cac-login-side { padding: 32px 22px 48px; }

  .cac-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .cac-app { grid-template-columns: 1fr; }
  .cac-side {
    position: static; height: auto; flex-direction: row; align-items: center;
    padding: 12px 16px; gap: 14px; overflow-x: auto;
  }
  .cac-side .cac-logo { flex-shrink: 0; }
  .cac-side .cac-logo-text { display: none; }
  /* The top bar is icons only on a phone. Showing the active label pushed
     the row past the screen edge and clipped the sign out control, and a bar
     that scrolls sideways hides exactly the thing a student is reaching for.
     The current page is shown by the highlight instead of by the word. */
  .cac-nav { flex-direction: row; gap: 4px; flex: 1; justify-content: center; }
  .cac-nav a { padding: 10px 14px; }
  .cac-nav a span { display: none; }
  .cac-nav .cac-ic { width: 19px; height: 19px; }
  .cac-side-foot { margin-top: 0; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
  .cac-side-user { margin-bottom: 0; padding: 4px; background: none; }
  .cac-side-user b, .cac-side-user span:not(.cac-avatar) { display: none; }
  .cac-signout { width: auto; padding: 9px 10px; font-size: 0; }
  .cac-signout .cac-ic { width: 19px; height: 19px; }

  .cac-main { padding: 22px 18px 48px; }
  .cac-page-head h1 { font-size: 22px; }
  .cac-idcard { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cac-card-pad { padding: 18px 16px; }
  .cac-mods { grid-template-columns: 1fr; }

  /* A resource row gives its title the full width and drops the action to
     its own line. Squeezed beside a "Download" column, every title broke
     over two lines and the description over three. */
  .cac-res-item { flex-wrap: wrap; row-gap: 4px; padding: 14px; }
  .cac-res-body { flex-basis: calc(100% - 52px); }
  .cac-res-go { flex-basis: 100%; padding-left: 52px; }
  .cac-level { padding: 14px; gap: 10px 12px; flex-wrap: wrap; }
  /* the basis leaves room for the number badge only, so the status chip
     always drops to its own line. At a wider basis it sat inline for short
     level names and wrapped for long ones, which looked like a mistake. */
  .cac-level-body { flex-basis: calc(100% - 50px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
