/* =============================================
   Macakka Learning Platform - Design System
   Academic Prestige Theme
   ============================================= */

/* Fonts are self-hosted: see /css/hanken-grotesk.css and /css/material-symbols.css.
   Loaded via <link> in each page head (no render-blocking @import). */

/* =============================================
   CSS Variables (Design Tokens)
   ============================================= */
:root {
  /* Primary Colors - Deep Navy */
  --primary: #000613;
  --on-primary: #ffffff;
  --primary-container: #001f3f;
  --on-primary-container: #6f88ad;

  /* Secondary Colors - Elegant Gold */
  --secondary: #735c00;
  --on-secondary: #ffffff;
  --secondary-container: #fed65b;
  --on-secondary-container: #745c00;

  /* Surface Colors */
  --surface: #fcf8f9;
  --surface-dim: #dcd9da;
  --surface-bright: #fcf8f9;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f6f3f4;
  --surface-container: #f0edee;
  --surface-container-high: #eae7e8;
  --surface-container-highest: #e5e2e3;
  --surface-variant: #e5e2e3;

  /* On Surface */
  --on-surface: #1b1b1c;
  --on-surface-variant: #43474e;
  --inverse-surface: #303031;
  --inverse-on-surface: #f3f0f1;

  /* Outline */
  --outline: #6b6e76;
  --outline-variant: #c4c6cf;

  /* Error */
  --error: #ba1a1a;
  --on-error: #ffffff;
  --error-container: #ffdad6;
  --on-error-container: #93000a;

  /* Background */
  --background: #fcf8f9;
  --on-background: #1b1b1c;

  /* Tertiary */
  --tertiary: #040607;
  --tertiary-container: #1c1f20;

  /* Surface Tint */
  --surface-tint: #476083;

  /* Secondary Fixed */
  --secondary-fixed: #ffe088;
  --secondary-fixed-dim: #e9c349;

  /* Primary Fixed */
  --primary-fixed: #d4e3ff;
  --primary-fixed-dim: #afc8f0;

  /* Typography */
  --font-family: 'Hanken Grotesk', sans-serif;

  /* Spacing */
  --unit: 8px;
  --container-max: 1200px;
  --gutter: 24px;
  --margin-mobile: 16px;
  --margin-desktop: 40px;

  /* Border Radius */
  --radius-sm: 0.125rem;
  --radius: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  /* Shadows (neutral, offset — no colored halos) */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-gold: 0 4px 14px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--on-background);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

button, input, select, textarea {
  font-family: var(--font-family);
}

img {
  max-width: 100%;
  height: auto;
}

/* =============================================
   Typography
   ============================================= */
.display-lg {
  font-size: 48px;
  font-weight: 700;
  line-height: 56px;
  letter-spacing: -0.02em;
}

.display-lg-mobile {
  font-size: 36px;
  font-weight: 700;
  line-height: 42px;
  letter-spacing: -0.02em;
}

.headline-md {
  font-size: 32px;
  font-weight: 600;
  line-height: 40px;
}

.headline-md-mobile {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
}

.title-lg {
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.body-lg {
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
}

.body-md {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.label-md {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.05em;
}

/* =============================================
   Layout
   ============================================= */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--margin-mobile);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--margin-desktop);
  }
}

.grid {
  display: grid;
  gap: var(--gutter);
}

.grid-12 {
  grid-template-columns: repeat(12, 1fr);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================================
   Material Symbols
   ============================================= */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1;
}

/* =============================================
   Top Navigation Bar
   ============================================= */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--margin-mobile);
  z-index: 100;
  border-bottom: 2px solid var(--secondary);
  transition: box-shadow var(--transition), left var(--transition-slow), width var(--transition-slow);
}

@media (min-width: 768px) {
  .topnav {
    padding: 0 var(--margin-desktop);
  }
}

/* When sidebar is present (guru pages), push topbar to the right on desktop */
.has-sidebar .topnav {
  left: 0;
  width: 100%;
}

@media (min-width: 1024px) {
  .has-sidebar .topnav {
    left: 260px;
    width: calc(100% - 260px);
  }
}

.topnav.scrolled {
  box-shadow: var(--shadow-md);
}

.topnav__brand {
  font-size: 24px;
  font-weight: 700;
  color: var(--secondary-container);
  letter-spacing: -0.02em;
}

/* Hide topbar brand on desktop when sidebar has its own brand */
@media (min-width: 1024px) {
  .has-sidebar .topnav__brand {
    display: none;
  }
}

.topnav__links {
  display: none;
  list-style: none;
  gap: 32px;
  align-items: center;
  height: 100%;
}

@media (min-width: 768px) {
  .topnav__links {
    display: flex;
  }
}

.topnav__link {
  color: var(--on-primary);
  opacity: 0.8;
  transition: all var(--transition);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  height: 100%;
  display: flex;
  align-items: center;
}

.topnav__link:hover {
  opacity: 1;
  color: var(--secondary-container);
}

.topnav__link.active {
  color: var(--secondary-container);
  border-bottom-color: var(--secondary);
  opacity: 1;
  font-weight: 700;
}

.topnav__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav__icon-btn {
  background: none;
  border: none;
  color: var(--on-primary);
  opacity: 0.8;
  cursor: pointer;
  padding: 4px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.topnav__icon-btn:hover {
  opacity: 1;
  color: var(--secondary-container);
}

.topnav__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  object-fit: cover;
  background-color: var(--surface-variant);
}

.topnav__mobile-toggle {
  display: flex;
  background: none;
  border: none;
  color: var(--on-primary);
  cursor: pointer;
  padding: 4px;
}

@media (min-width: 768px) {
  /* Hide siswa mobile toggle on desktop */
  #mobile-menu-toggle {
    display: none;
  }
}

@media (min-width: 1024px) {
  /* Hide guru mobile toggle on desktop (sidebar is always visible) */
  #sidebar-mobile-toggle {
    display: none;
  }
}

/* =============================================
   Main Content Offsets
   ============================================= */
.main-content {
  padding-top: 88px;
  padding-bottom: 48px;
}

.main-with-sidebar {
  padding-top: 88px;
  padding-bottom: 48px;
}

@media (min-width: 1024px) {
  .main-with-sidebar {
    margin-left: 260px;
  }
}

/* =============================================
   Sidebar Navigation (Teacher)
   ============================================= */
.sidebar {
  position: fixed;
  left: -280px;
  top: 0;
  width: 260px;
  height: 100vh;
  background-color: var(--primary);
  display: flex;
  flex-direction: column;
  padding: 20px;
  z-index: 150;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow-y: auto;
  transition: left var(--transition-slow);
}

.sidebar.open {
  left: 0;
}

@media (min-width: 1024px) {
  .sidebar {
    left: 0;
  }
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 4px 0;
}

.sidebar__close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

@media (min-width: 1024px) {
  .sidebar__close {
    display: none;
  }
}

.sidebar__section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 12px 16px 6px;
  text-transform: uppercase;
}

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  color: rgba(255,255,255,0.65);
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
}

.sidebar__link:hover {
  background-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.95);
}

.sidebar__link.active {
  background-color: rgba(254, 214, 91, 0.12);
  color: var(--secondary-container);
  font-weight: 600;
}

.sidebar__link.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
  color: var(--secondary-container);
}

.sidebar__link .material-symbols-outlined {
  font-size: 20px;
}

.sidebar__link.danger {
  color: #ff8a80;
}

.sidebar__link.danger:hover {
  background-color: rgba(255, 138, 128, 0.12);
  color: #ffb4ab;
}

.sidebar__footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: auto;
}

/* Sidebar Backdrop (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 6, 19, 0.6);
  z-index: 140;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.sidebar-backdrop.open {
  display: block;
  opacity: 1;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary - Gold */
.btn-primary {
  background-color: var(--secondary);
  color: var(--on-secondary);
}

.btn-primary:hover {
  box-shadow: var(--shadow-gold);
}

/* Secondary - Outlined */
.btn-secondary {
  background-color: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary);
  color: var(--on-primary);
}

/* Gold Container */
.btn-gold {
  background-color: var(--secondary-container);
  color: var(--primary);
  font-weight: 700;
}

.btn-gold:hover {
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

/* Error/Danger */
.btn-danger {
  background-color: var(--error);
  color: var(--on-error);
}

.btn-danger:hover {
  background-color: var(--on-error-container);
}

/* Small */
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Full width */
.btn-block {
  width: 100%;
}

/* =============================================
   Cards
   ============================================= */
.card {
  background-color: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Accent cards: emphasis comes from border + spacing, not a colored side stripe. */
.card--accent {
  border-color: rgba(115, 92, 0, 0.35);
}

.card--accent-left {
  border-color: rgba(115, 92, 0, 0.35);
}

.card__body {
  padding: 24px;
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* =============================================
   Form Controls
   ============================================= */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--on-surface);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  background-color: var(--surface-container-lowest);
  color: var(--on-surface);
  font-size: 16px;
  line-height: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--secondary);
  border-width: 2px;
  padding: 11px 15px;
  box-shadow: 0 0 0 3px rgba(115, 92, 0, 0.1);
}

.form-control::placeholder {
  color: var(--outline);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%2374777f' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* =============================================
   Progress Bar
   ============================================= */
.progress {
  width: 100%;
  height: 8px;
  background-color: var(--surface-variant);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background-color: var(--secondary);
  border-radius: var(--radius-full);
  transition: width 1s ease-out;
}

.progress--primary .progress__fill {
  background-color: var(--primary);
}

/* Circular Progress */
.circular-progress {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-container);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.circular-progress svg {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circular-progress__value {
  font-weight: 700;
  font-size: 20px;
  color: var(--on-primary);
  z-index: 1;
}

/* =============================================
   Chips / Tags
   ============================================= */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.chip--primary {
  background-color: var(--primary-container);
  color: var(--on-primary-container);
}

.chip--surface {
  background-color: var(--surface-variant);
  color: var(--on-surface-variant);
}

.chip--error {
  background-color: var(--error-container);
  color: var(--on-error-container);
}

.chip--success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.chip--gold {
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
}

/* =============================================
   Stat Cards
   ============================================= */
.stat-card {
  background-color: var(--surface-container-lowest);
  border: 1px solid rgba(196, 198, 207, 0.3);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.stat-card__accent {
  display: none;
}

.stat-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.stat-card__icon {
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 600;
  color: var(--primary);
}

.stat-card__trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  margin-top: 8px;
}

/* =============================================
   Tables
   ============================================= */
.table-wrap {
  background-color: var(--surface-container-lowest);
  border: 1px solid rgba(196, 198, 207, 0.3);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 16px;
  background-color: var(--surface-container-low);
  border-bottom: 1px solid rgba(196, 198, 207, 0.3);
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.table td {
  padding: 16px;
  border-bottom: 1px solid rgba(196, 198, 207, 0.15);
}

.table tbody tr:hover {
  background-color: var(--surface-container-lowest);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--transition);
}

.table tbody tr:hover .table__actions {
  opacity: 1;
}

/* =============================================
   Alerts / Flash Messages
   ============================================= */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert--success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert--error {
  background-color: var(--error-container);
  color: var(--on-error-container);
  border: 1px solid rgba(186, 26, 26, 0.2);
}

/* =============================================
   Hero Section
   ============================================= */
.hero {
  background-color: var(--primary);
  border-radius: var(--radius-xl);
  padding: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .hero {
    padding: 48px;
  }
}

.hero__pattern {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  opacity: 0.08;
  pointer-events: none;
  background-image: radial-gradient(var(--secondary) 1px, transparent 1px);
  background-size: 20px 20px;
}

.hero__title {
  color: var(--on-primary);
  position: relative;
  z-index: 1;
}

.hero__subtitle {
  color: rgba(255,255,255,0.75);
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin-top: 8px;
}

.hero__footer {
  position: relative;
  z-index: 1;
  margin-top: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* =============================================
   Upload Zone
   ============================================= */
.upload-zone {
  background-color: var(--surface);
  border: 2px dashed var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-slow);
  text-align: center;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--secondary);
  background-color: rgba(254, 214, 91, 0.03);
}

.upload-zone__icon {
  width: 64px;
  height: 64px;
  background-color: var(--primary-container);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  transition: transform var(--transition-slow);
}

.upload-zone:hover .upload-zone__icon {
  transform: scale(1.1);
}

.upload-zone__icon .material-symbols-outlined {
  font-size: 32px;
  color: var(--secondary);
}

/* =============================================
   Exam Interface
   ============================================= */
.exam-header {
  background-color: var(--primary);
  color: var(--on-primary);
  padding: 16px var(--margin-mobile);
  border-bottom: 4px solid var(--secondary-container);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .exam-header {
    padding: 16px var(--margin-desktop);
  }
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--error-container);
  color: var(--on-error-container);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.question-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.question-nav__item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
}

.question-nav__item--answered {
  background-color: var(--primary);
  color: var(--on-primary);
}

.question-nav__item--current {
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--primary), 0 0 0 4px var(--surface-container-lowest);
  transform: scale(1.1);
  z-index: 1;
}

.question-nav__item--unanswered {
  border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  background-color: transparent;
}

.question-nav__item--unanswered:hover {
  background-color: var(--surface-container);
}

.question-nav__item--flagged {
  border: 2px solid var(--secondary-container);
  color: var(--secondary-container);
  background-color: transparent;
  position: relative;
}

.question-nav__item--flagged::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background-color: var(--secondary-container);
  border-radius: 50%;
}

/* Radio options for exam */
.option-label {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(196, 198, 207, 0.3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  gap: 16px;
}

.option-label:hover {
  border-color: var(--primary-fixed-dim);
  background-color: rgba(212, 227, 255, 0.1);
}

.option-label.selected {
  border: 2px solid var(--secondary-container);
  background-color: rgba(255, 224, 136, 0.08);
  padding: 15px;
}

.option-label input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* =============================================
   Login / Auth Pages
   ============================================= */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page__pattern {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: radial-gradient(var(--secondary) 1px, transparent 1px);
  background-size: 20px 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.auth-card__brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card__brand-name {
  font-size: 36px;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: -0.02em;
}

.auth-card__brand-sub {
  color: var(--on-surface-variant);
  font-size: 14px;
  margin-top: 4px;
}

.auth-card__title {
  text-align: center;
  margin-bottom: 24px;
  color: var(--primary);
}

.auth-card__footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.auth-card__footer a {
  color: var(--secondary);
  font-weight: 600;
}

.auth-card__footer a:hover {
  text-decoration: underline;
}

/* Role selection */
.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.role-option {
  position: relative;
}

.role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-option__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.role-option__label:hover {
  border-color: var(--primary);
}

.role-option input:checked + .role-option__label {
  border-color: var(--secondary);
  background-color: rgba(254, 214, 91, 0.08);
}

.role-option__label .material-symbols-outlined {
  font-size: 32px;
  color: var(--primary);
}

/* =============================================
   Callout / Info Box
   ============================================= */
.callout {
  background-color: rgba(0, 31, 63, 0.04);
  border: 1px solid rgba(115, 92, 0, 0.25);
  padding: 24px;
  border-radius: var(--radius-lg);
  margin: 24px 0;
}

.callout h3 {
  color: var(--primary);
  margin-bottom: 8px;
}

/* =============================================
   Breadcrumb
   ============================================= */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.breadcrumb .material-symbols-outlined {
  font-size: 16px;
}

/* =============================================
   Badge / Counter
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.badge--error {
  background-color: var(--error);
  color: var(--on-error);
}

/* =============================================
   Content Area with Sidebar
   ============================================= */
.main-with-sidebar {
  padding-top: 80px;
  padding-bottom: 64px;
}

@media (min-width: 1024px) {
  .main-with-sidebar--teacher {
    margin-left: 256px;
  }
}

.main-content {
  padding-top: 80px;
  padding-bottom: 64px;
}

/* =============================================
   Sticky TOC Sidebar
   ============================================= */
.toc {
  position: sticky;
  top: 104px;
  background-color: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.toc__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  color: var(--on-surface-variant);
  transition: background-color var(--transition), color var(--transition);
  font-size: 14px;
  font-weight: 600;
}

.toc__link:hover {
  background-color: var(--surface-container);
  color: var(--primary);
}

.toc__link.active {
  background-color: var(--primary-container);
  color: var(--on-primary-container);
}

/* =============================================
   Video Player Placeholder
   ============================================= */
.video-player {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--primary);
  cursor: pointer;
}

.video-player__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 60%, rgba(0,0,0,0.7));
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player__play {
  width: 80px;
  height: 80px;
  background-color: var(--secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-slow);
}

.video-player:hover .video-player__play {
  transform: scale(1.1);
}

.video-player__play .material-symbols-outlined {
  font-size: 48px;
  color: var(--on-secondary);
  font-variation-settings: 'FILL' 1;
}

/* =============================================
   Scrollbar
   ============================================= */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--outline-variant);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--outline);
}

/* =============================================
   Utility Classes
   ============================================= */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-on-surface { color: var(--on-surface); }
.text-on-surface-variant { color: var(--on-surface-variant); }
.text-on-primary { color: var(--on-primary); }
.text-error { color: var(--error); }
.text-success { color: #166534; }
.text-gold { color: var(--secondary-container); }

.bg-primary { background-color: var(--primary); }
.bg-surface { background-color: var(--surface); }
.bg-surface-container { background-color: var(--surface-container); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-6 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-6 { margin-bottom: 48px; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.font-bold { font-weight: 700; }

.hidden { display: none; }

.border-t { border-top: 1px solid var(--outline-variant); }
.border-b { border-bottom: 1px solid var(--outline-variant); }

.rounded-full { border-radius: 50%; }
.overflow-hidden { overflow: hidden; }

/* Responsive show/hide */
@media (min-width: 768px) {
  .md-show { display: flex; }
  .md-hide { display: none; }
  .md-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .md-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .lg-show { display: flex; }
  .lg-hide { display: none; }
  .lg-grid-12 { grid-template-columns: repeat(12, 1fr); }
}

/* Grid span utilities */
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-8 { grid-column: span 8; }
.col-span-9 { grid-column: span 9; }
.col-span-12 { grid-column: span 12; }

@media (max-width: 1023px) {
  .col-span-3, .col-span-4, .col-span-8, .col-span-9, .col-span-12 {
    grid-column: span 1;
  }
  .lg-grid-12 {
    grid-template-columns: 1fr;
  }
}

/* Gold halo hover */
.gold-halo:hover {
  box-shadow: var(--shadow-gold);
}

/* Icon button */
.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--on-surface-variant);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background-color: var(--surface-container);
  color: var(--primary);
}

/* Dot indicator */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot--error { background-color: var(--error); }
.dot--gold { background-color: var(--secondary); }
.dot--success { background-color: #16a34a; }

/* Skeleton placeholder for images */
.img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface-container) 0%, var(--surface-container-high) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--outline);
}

/* Status dot with text */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.status--active {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status--completed {
  background-color: var(--surface-container-high);
  color: var(--on-surface);
  border: 1px solid rgba(196, 198, 207, 0.3);
}

.status--draft {
  background-color: var(--surface-container);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
}

.status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status--active .status__dot { background-color: #22c55e; }
.status--completed .status__dot { background-color: var(--outline); }
.status--draft .status__dot { background-color: var(--outline-variant); }

/* Submission item */
.submission-item {
  padding: 16px;
  background-color: var(--surface-container-low);
  border: 1px solid var(--surface-variant);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}

.submission-item:hover {
  border-color: var(--outline);
}

.submission-item__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-container);
  color: var(--on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Active assignment sidebar item */
.assignment-item {
  padding: 16px;
  border-bottom: 1px solid var(--surface-variant);
  transition: background-color var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assignment-item:hover {
  background-color: var(--surface-container);
}

.assignment-item:last-child {
  border-bottom: none;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 6, 19, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background-color: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal__header {
  padding: 24px;
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__body {
  padding: 24px;
}

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--outline-variant);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* =============================================
   Accessibility — minimum hit areas (WCAG 2.5.5)
   ============================================= */
.topnav__brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.topnav__link,
.topnav__icon-btn,
.topnav__mobile-toggle,
.sidebar__link,
.sidebar__close,
.icon-btn {
  min-height: 44px;
}

.topnav__icon-btn,
.topnav__mobile-toggle,
.icon-btn {
  min-width: 44px;
  justify-content: center;
}

.topnav__avatar {
  width: 44px;
  height: 44px;
}

.btn-sm {
  min-height: 40px;
}

.table__actions .icon-btn,
.table__actions .btn {
  min-width: 44px;
  min-height: 44px;
}

/* Headings balance rather than orphan a word */
h1, h2, h3, .display-lg, .display-lg-mobile, .headline-md {
  text-wrap: balance;
}

/* =============================================
   Reduced motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
