/* ===== WEBSITE 4: MINIMAL LEARNING PORTAL ===== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Tokens ── */
:root {
  --accent:       #2563eb;
  --accent-faint: rgba(37,99,235,0.07);

  --bg:           #ffffff;
  --bg-subtle:    #fafafa;
  --sidebar-bg:   #f5f5f5;

  --text:         #111111;
  --text-muted:   #6b6b6b;
  --text-faint:   #aaaaaa;

  --border:       #e5e5e5;
  --border-mid:   #d4d4d4;

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.07);

  --sidebar-w:    220px;
  --radius:       8px;
  --transition:   0.18s ease;
}

[data-theme="dark"] {
  --bg:           #111111;
  --bg-subtle:    #161616;
  --sidebar-bg:   #0a0a0a;

  --text:         #f0f0f0;
  --text-muted:   #888888;
  --text-faint:   #444444;

  --border:       #272727;
  --border-mid:   #333333;
  --accent-faint: rgba(59,130,246,0.1);
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }

/* ─────────────────────────────────────── */
/* ROOT HOME PAGE                          */
/* ─────────────────────────────────────── */

.home-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.home-brand {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.home-brand span {
  color: var(--text-faint);
  font-weight: 400;
  margin-left: 6px;
}

.home-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 32px;
  flex: 1;
}

.home-heading {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.home-subheading {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.course-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: block;
}

.course-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.course-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.course-card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 6px;
}

.course-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.55;
}

.course-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
}

.course-card-arrow {
  color: var(--accent);
  font-size: 13px;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
}

.course-card:hover .course-card-arrow {
  opacity: 1;
  transform: translateX(3px);
}

/* ─────────────────────────────────────── */
/* COURSE LAYOUT                           */
/* ─────────────────────────────────────── */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.22s ease, background var(--transition), border-color var(--transition);
}

.sidebar-top {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  transition: color var(--transition);
}

.back-link:hover { color: var(--accent); }

.back-link svg { flex-shrink: 0; }

.sidebar-course-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.sidebar-course-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Nav ── */
.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 2px solid transparent;
  margin-left: -10px;
  padding-left: 18px;
}

.nav-item svg { flex-shrink: 0; opacity: 0.6; transition: opacity var(--transition); }

.nav-item:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}

[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,0.05); }

.nav-item.active {
  color: var(--accent);
  background: var(--accent-faint);
  border-left-color: var(--accent);
}

.nav-item.active svg { opacity: 1; }

/* ── Sidebar footer ── */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  padding: 0;
  transition: color var(--transition);
}

.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { flex-shrink: 0; }

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.main-header {
  padding: 36px 44px 0;
}

.page-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.main-body {
  padding: 28px 44px 64px;
  flex: 1;
}

/* ─────────────────────────────────────── */
/* OVERVIEW PAGE                           */
/* ─────────────────────────────────────── */

.overview-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.topics-list {
  display: flex;
  flex-direction: column;
}

.topic-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 13px 12px;
  margin: 0 -12px;
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.topic-row:first-child { border-top: 1px solid var(--border); }

.topic-row:hover {
  background: var(--bg-subtle);
}

[data-theme="dark"] .topic-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.topic-row:hover .topic-n {
  color: var(--accent);
}

.topic-row:hover .topic-title {
  color: var(--accent);
}

/* Topic 1 is a link — keep it styled as text */
a.topic-row {
  text-decoration: none;
  color: inherit;
}

.topic-n {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  width: 20px;
  flex-shrink: 0;
  text-align: right;
  transition: color var(--transition);
}

.topic-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  transition: color var(--transition);
}

.topic-sub {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1.4;
}

.topic-wk {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─────────────────────────────────────── */
/* LECTURES PAGE                           */
/* ─────────────────────────────────────── */

.lecture-list {
  display: flex;
  flex-direction: column;
}

.lecture-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--transition);
}

.lecture-row:first-child { border-top: 1px solid var(--border); }

.lecture-row:hover .lec-title { color: var(--accent); }

.lec-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: all var(--transition);
}

.lecture-row:hover .lec-play {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-faint);
}

.lec-unavail .lec-play {
  opacity: 0.35;
  cursor: default;
}

.lec-unavail:hover .lec-play {
  border-color: var(--border-mid);
  color: var(--text-muted);
  background: transparent;
}

.lec-unavail:hover .lec-title { color: var(--text); }

.lec-info { flex: 1; }

.lec-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  transition: color var(--transition);
}

.lec-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.lec-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.lec-duration {
  font-size: 12.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.lec-date {
  font-size: 11.5px;
  color: var(--text-faint);
}

.lec-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ─────────────────────────────────────── */
/* ASSIGNMENTS PAGE                        */
/* ─────────────────────────────────────── */

.assign-list {
  display: flex;
  flex-direction: column;
}

.assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

.assign-row:first-child { border-top: 1px solid var(--border); }

.assign-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.assign-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.assign-due {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─────────────────────────────────────── */
/* QUIZ PAGE                               */
/* ─────────────────────────────────────── */

.quiz-intro {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.quiz-list {
  display: flex;
  flex-direction: column;
}

.quiz-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.quiz-row:first-child { border-top: 1px solid var(--border); }

.quiz-week-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.quiz-row.upcoming .quiz-week-badge {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-faint);
}

.quiz-info { flex: 1; }

.quiz-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}

.quiz-covers {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.quiz-date {
  font-size: 11.5px;
  color: var(--text-faint);
}

.quiz-status {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 3px;
}

.quiz-row.upcoming .quiz-status { color: var(--accent); }

/* ─────────────────────────────────────── */
/* SHARED UTILITIES                        */
/* ─────────────────────────────────────── */

/* Used on home page */
.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover { color: var(--text); border-color: var(--border-mid); background: var(--bg-subtle); }

/* ─────────────────────────────────────── */
/* TOP-BAR ON COURSE PAGES                 */
/* ─────────────────────────────────────── */

.main-topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 44px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* On the homepage topbar, lay our auth button next to the theme toggle. */
.home-topbar [data-auth-slot] {
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─────────────────────────────────────── */
/* AUTH BUTTON + USER PILL                 */
/* ─────────────────────────────────────── */

.auth-slot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  line-height: 1;
}

.auth-btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.auth-btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 1px 4px rgba(37,99,235,0.25);
}

.auth-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.auth-btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-mid);
  background: var(--bg-subtle);
}

.auth-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px 4px 9px;
}
.auth-user-pill svg { opacity: 0.7; }

/* ─────────────────────────────────────── */
/* AUTH MODAL                              */
/* ─────────────────────────────────────── */

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  transition: opacity var(--transition);
}

.auth-modal-backdrop.hidden {
  display: none;
}

.auth-modal {
  position: relative;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 28px 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.auth-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: all var(--transition);
}
.auth-modal-close:hover { color: var(--text); background: var(--bg-subtle); }

.auth-modal-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.auth-modal-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 16px;
}

.auth-modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.auth-modal-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  margin-bottom: 18px;
  transition: border-color var(--transition);
}
.auth-modal-input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-modal-status {
  min-height: 1em;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-modal-status[data-kind="error"]   { color: #c2410c; }
.auth-modal-status[data-kind="success"] { color: #15803d; }

[data-theme="dark"] .auth-modal-status[data-kind="error"]   { color: #fca5a5; }
[data-theme="dark"] .auth-modal-status[data-kind="success"] { color: #86efac; }

/* ─────────────────────────────────────── */
/* QUIZ LIST INTERACTIVITY                 */
/* ─────────────────────────────────────── */

.quiz-row.available { cursor: pointer; }

.quiz-row.available .quiz-title {
  color: var(--accent);
}

.quiz-row.available:hover {
  background: var(--accent-faint);
}
[data-theme="dark"] .quiz-row.available:hover {
  background: rgba(59,130,246,0.08);
}

.quiz-row.locked .quiz-status { color: var(--text-faint); font-style: italic; }

.quiz-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ─────────────────────────────────────── */
/* INDIVIDUAL QUIZ PAGE                    */
/* ─────────────────────────────────────── */

.quiz-banner {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.quiz-banner-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.quiz-banner-text strong { color: var(--text); }

.quiz-questions {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.quiz-question {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: var(--bg);
}

.quiz-question-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.quiz-q-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quiz-q-prompt {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13.5px;
  color: var(--text);
}
.quiz-choice:hover {
  border-color: var(--border-mid);
  background: var(--bg-subtle);
}
.quiz-choice input { accent-color: var(--accent); }

.quiz-choice.selected {
  border-color: var(--accent);
  background: var(--accent-faint);
  color: var(--accent);
}

.quiz-question.graded .quiz-choice {
  cursor: default;
}
.quiz-question.graded .quiz-choice.correct {
  border-color: #16a34a;
  background: rgba(22,163,74,0.08);
  color: #15803d;
}
.quiz-question.graded .quiz-choice.incorrect.selected {
  border-color: #dc2626;
  background: rgba(220,38,38,0.08);
  color: #b91c1c;
}
[data-theme="dark"] .quiz-question.graded .quiz-choice.correct {
  color: #86efac;
}
[data-theme="dark"] .quiz-question.graded .quiz-choice.incorrect.selected {
  color: #fca5a5;
}

.quiz-actions {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.quiz-submit-btn {
  padding: 10px 22px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: filter var(--transition);
}
.quiz-submit-btn:hover { filter: brightness(1.08); }
.quiz-submit-btn:disabled {
  background: var(--border-mid);
  cursor: not-allowed;
  filter: none;
}

.quiz-result-summary {
  font-size: 14px;
  color: var(--text);
}
.quiz-result-summary strong { color: var(--accent); }

.quiz-locked-card {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}
.quiz-locked-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.quiz-locked-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.6;
}

/* ─────────────────────────────────────── */
/* MOBILE HAMBURGER + SIDEBAR DRAWER       */
/* ─────────────────────────────────────── */

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
}
.menu-btn:hover { color: var(--text); border-color: var(--border-mid); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .main-topbar {
    justify-content: space-between;
    padding: 0 20px;
  }
  .menu-btn {
    display: flex;
  }
  .main-header {
    padding: 28px 20px 0;
  }
  .main-body {
    padding: 20px 20px 48px;
  }
}
