/* ============================================================
   ClassMinds — Shared app styles (canvas v1 port)
   Source: webapp-canvas/ClassMinds Canvas.html (lines 10-540)
   Canvas-mockup chrome (.canvas, .canvas-header, .frame, .frame-glow,
   .hchip, .screens, .frame-wrap, .frame-label) stripped.
   Production additions: .page-glow, body{display:none}, .sb-tt hover rules,
   .sidebar positioning.
   ============================================================ */

/* ============================================================
   Tokens
   ============================================================ */
:root {
  --navy:        #040D1F;
  --navy-mid:    #071428;
  --navy-card:   #0A1C3A;
  --white:       #F0F4FF;
  --muted:       rgba(180,200,255,0.6);
  --muted-soft:  rgba(180,200,255,0.42);
  --border:      rgba(26,107,255,0.18);
  --border-hover:rgba(26,107,255,0.35);
  --border-active:rgba(26,107,255,0.6);
  --blue:        #1A6BFF;
  --blue-bright: #4D8FFF;
  --blue-dim:    #0D3A99;
  --blue-tint-06: rgba(26,107,255,0.06);
  --blue-tint-08: rgba(26,107,255,0.08);
  --blue-tint-12: rgba(26,107,255,0.12);
  --blue-tint-15: rgba(26,107,255,0.15);
  --surface-02:  rgba(255,255,255,0.02);
  --surface-04:  rgba(255,255,255,0.04);
  --surface-06:  rgba(255,255,255,0.06);

  --green:   #22C55E;
  --yellow:  #F59E0B;
  --red:     #EF4444;
  --purple:  #A855F7;
  --cyan:    #06B6D4;
  --orange:  #F97316;
  --pink:    #EC4899;

  --green-tint:  rgba(34,197,94,0.12);
  --yellow-tint: rgba(245,158,11,0.12);
  --red-tint:    rgba(239,68,68,0.12);
  --purple-tint: rgba(168,85,247,0.12);

  --class-1: #1A6BFF;
  --class-2: #22C55E;
  --class-3: #A855F7;
  --class-4: #F59E0B;
  --class-5: #EF4444;
  --class-6: #06B6D4;
  --class-7: #F97316;
  --class-8: #EC4899;

  --font-display: 'Syne', 'Trebuchet MS', sans-serif;
  --font-body:    'DM Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 12px;
  --r-2xl: 14px; --r-3xl: 16px; --r-4xl: 20px; --r-5xl: 28px;
  --r-full: 9999px;

  --shadow-glow:    0 0 40px rgba(26,107,255,0.35);
  --shadow-glow-xl: 0 0 60px rgba(26,107,255,0.5);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--navy); color: var(--white); font-family: var(--font-body); }
body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: none; /* revealed by requireUser() in app-shared.js after auth passes */
}

/* Grain */
body::before {
  content:"";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1000;
  mix-blend-mode: overlay;
}

/* Page-level positional glow — drop <div class="page-glow"></div> into body */
.page-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(80px);
  background: radial-gradient(circle, rgba(26,107,255,0.18), transparent 60%);
  top: -200px; right: -150px;
}
.page-glow.bl {
  top: auto; right: auto;
  bottom: -200px; left: 100px;
  background: radial-gradient(circle, rgba(77,143,255,0.14), transparent 60%);
  width: 500px; height: 500px;
}

/* ============================================================
   Sidebar
   Canvas flows sidebar + main inside a frame. Production pins
   sidebar fixed to viewport so content pages don't need a wrapper.
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: 72px;
  background: var(--navy);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar .cm {
  width: 40px; height: 40px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.sidebar .cm img {
  width: 34px; height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(26,107,255,0.35));
}
.sidebar nav { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; }
.sidebar nav .ni {
  width: 44px; height: 44px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 18px;
  position: relative;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav .ni:hover {
  background: var(--blue-tint-08);
  color: var(--white);
}
.sidebar nav .ni.active {
  background: var(--blue-tint-12);
  color: var(--blue-bright);
  filter: drop-shadow(0 0 4px rgba(26,107,255,0.45));
}
.sidebar nav .ni.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 10px; bottom: 10px;
  width: 3px;
  border-radius: var(--r-full);
  background: var(--blue-bright);
  box-shadow: 0 0 8px var(--blue-bright);
}
.sidebar .spacer { flex: 1; }
.sidebar .avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--white);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

/* Sidebar hover tooltips (.sb-tt spans inside .ni) — hidden by default, shown on hover */
.sb-tt {
  display: none;
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--navy-card);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
}
.sidebar nav .ni:hover .sb-tt { display: block; }

/* ============================================================
   Main area
   Canvas nests main in a frame; production uses margin-left for sidebar.
   ============================================================ */
.main {
  margin-left: 72px;
  position: relative;
  z-index: 1;
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
}
.main.narrow { padding: 56px 120px; align-items: stretch; }
.main.tight  { padding: 28px 36px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.5px;
  line-height: 1.05;
  color: var(--white);
  margin: 0;
}
.page-title.lg { font-size: 40px; letter-spacing: -1.1px; }
.page-sub { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--navy-card);
  border: 0.5px solid var(--border);
  border-radius: var(--r-3xl);
  padding: 20px;
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card .card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.1px;
  display: inline-flex; align-items: center; gap: 8px;
}
.card .card-title .ico { font-size: 15px; }
.card .card-more { font-size: 12px; color: var(--muted); }

/* ============================================================
   Chips
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 0.5px solid transparent;
  font-family: var(--font-body);
}
.chip .d { width: 5px; height: 5px; border-radius: 50%; }
.chip.blue   { color: var(--blue-bright); background: var(--blue-tint-15); border-color: rgba(26,107,255,0.25); }
.chip.blue .d { background: var(--blue-bright); }
.chip.green  { color: var(--green); background: var(--green-tint); border-color: rgba(34,197,94,0.25); }
.chip.green .d { background: var(--green); }
.chip.yellow { color: var(--yellow); background: var(--yellow-tint); border-color: rgba(245,158,11,0.25); }
.chip.yellow .d { background: var(--yellow); }
.chip.red    { color: var(--red); background: var(--red-tint); border-color: rgba(239,68,68,0.25); }
.chip.red .d { background: var(--red); animation: pulse 2s ease-in-out infinite; }
.chip.purple { color: var(--purple); background: var(--purple-tint); border-color: rgba(168,85,247,0.25); }
.chip.purple .d { background: var(--purple); }
.chip.orange { color: var(--orange); background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.25); }
.chip.orange .d { background: var(--orange); }
.chip.muted  { color: var(--muted); background: var(--surface-04); border-color: var(--border); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-xl);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn.primary {
  background: var(--blue);
  color: var(--white);
}
.btn.primary:hover { background: var(--blue-bright); }
.btn.ghost {
  background: transparent;
  color: var(--white);
  border: 0.5px solid var(--border);
}
.btn.ghost:hover { border-color: var(--border-hover); background: var(--surface-02); }
.btn.sm { padding: 7px 12px; font-size: 12px; border-radius: var(--r-lg); }
.btn.lg { padding: 13px 22px; font-size: 14px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Inputs
   ============================================================ */
.input {
  background: var(--surface-04);
  border: 0.5px solid var(--border);
  color: var(--white);
  padding: 10px 14px;
  border-radius: var(--r-lg);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--border-active); }
.input::placeholder { color: var(--muted-soft); }
.search {
  position: relative;
  display: flex; align-items: center;
}
.search .si { position: absolute; left: 14px; color: var(--muted); font-size: 14px; pointer-events: none; }
.search .input { padding-left: 36px; }

/* Section label */
.label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   Shared row (class-colored left bar + body + end slot)
   ============================================================ */
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0;
  border-top: 0.5px solid var(--border);
}
.row:first-of-type { border-top: none; }
.row .bar {
  width: 3px; align-self: stretch; border-radius: var(--r-full);
  background: var(--c, var(--blue));
  min-height: 28px;
}
.row .body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row .body .t {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--white);
  letter-spacing: -0.1px;
}
.row .body .m {
  font-size: 12px;
  color: var(--muted);
}
.row .end { display: flex; align-items: center; gap: 10px; }

/* ============================================================
   Day strip
   ============================================================ */
.day-strip {
  display: flex; gap: 8px;
}
.day-strip .day {
  flex: 1;
  padding: 10px 0 12px;
  border-radius: var(--r-xl);
  border: 0.5px solid var(--border);
  background: var(--navy-card);
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  min-width: 72px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.day-strip .day:hover { border-color: var(--border-hover); }
.day-strip .day .dow {
  font-size: 10px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.day-strip .day .dn {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  color: var(--white); letter-spacing: -0.3px;
}
.day-strip .day .dots { display: flex; gap: 3px; height: 4px; }
.day-strip .day .dots .pt { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-soft); }
.day-strip .day.today {
  background: var(--blue-tint-15);
  border-color: var(--border-active);
}
.day-strip .day.today .dn, .day-strip .day.today .dow { color: var(--blue-bright); }

/* ============================================================
   Stat tile
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.stat {
  background: var(--surface-02);
  border: 0.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; }
.stat .v {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--white);
  letter-spacing: -0.5px;
}
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .v.blue { color: var(--blue-bright); }

/* ============================================================
   Filter tabs (inside a surface-04 pill container)
   ============================================================ */
.tabs {
  display: flex; gap: 6px;
  padding: 3px;
  background: var(--surface-04);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  width: fit-content;
}
.tabs .tab {
  padding: 6px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.tabs .tab:hover { color: var(--white); }
.tabs .tab.active {
  background: var(--blue-tint-15);
  color: var(--blue-bright);
}

/* Filter dropdown — assignments (overdue / due today / upcoming / all).
   Native <select> styled to match the tab pills; custom caret. */
.filter-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding: 6px 30px 6px 12px;
  background-color: var(--surface-04);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-bright);
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c8aa5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s, color 0.15s;
}
.filter-select:hover { border-color: var(--border-active); color: var(--white); }
.filter-select:focus { outline: none; border-color: var(--blue-bright); }
.filter-select option { background: #0e1730; color: #fff; }

/* ============================================================
   Filter pills (bigger, for assignments + tutor scope)
   ============================================================ */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pillf {
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1px;
  background: var(--surface-04);
  border: 0.5px solid var(--border);
  color: var(--muted);
  display: inline-flex; gap: 6px; align-items: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pillf:hover { color: var(--white); border-color: var(--border-hover); }
.pillf .cnt { color: rgba(180,200,255,0.4); font-family: var(--font-mono); font-size: 11px; }
.pillf.active {
  background: var(--blue-tint-15);
  border-color: var(--border-active);
  color: var(--blue-bright);
}
.pillf.active .cnt { color: var(--blue-bright); }

/* ============================================================
   Assignment checkbox — cycles empty → started → done, plus overdue
   ============================================================ */
.cb {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-02);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--white);
  flex-shrink: 0;
  cursor: pointer;
}
.cb.done   { background: var(--green); border-color: var(--green); }
.cb.started{ background: var(--yellow-tint); border-color: var(--yellow); color: var(--yellow); }
.cb.started::after { content:"◐"; font-size: 12px; }
.cb.overdue{ background: var(--red-tint); border-color: var(--red); color: var(--red); }
.cb.overdue::after { content:"!"; font-weight: 800; font-size: 10px; }
.cb.done::after { content:"✓"; font-size: 10px; color: var(--white); font-weight: 800; }

/* ============================================================
   Spinner + toast (carried over, restyled to canvas tokens)
   ============================================================ */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--blue-bright);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--navy-card);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--white);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(34,197,94,0.45); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,0.45); color: var(--red); }
