/* ============================================================
   E-Learning Sekolah — Style Elegan Formal
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette — Navy + Gold (formal akademik) */
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-600: #475569;
  --navy-500: #64748b;
  --navy-400: #94a3b8;
  --navy-300: #cbd5e1;
  --navy-200: #e2e8f0;
  --navy-100: #f1f5f9;
  --navy-50:  #f8fafc;

  --gold-700: #a16207;
  --gold-600: #ca8a04;
  --gold-500: #eab308;
  --gold-400: #facc15;
  --gold-100: #fef9c3;

  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;

  --green-700: #15803d;
  --green-500: #22c55e;
  --green-100: #dcfce7;

  --red-700: #b91c1c;
  --red-500: #ef4444;
  --red-100: #fee2e2;

  --amber-600: #d97706;
  --amber-100: #fef3c7;

  --white: #ffffff;
  --bg-page: #f5f7fa;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--navy-900);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  border-radius: var(--radius);
  color: var(--gold-400);
}

.nav-main {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--navy-100);
  color: var(--navy-900);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.btn-logout {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--navy-100);
  color: var(--text-secondary);
  font-size: 16px;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background: var(--red-100);
  color: var(--red-700);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
main.container {
  padding: 32px 24px 60px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.welcome-section {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}

.welcome-section h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.welcome-section p {
  color: var(--navy-300);
  font-size: 14.5px;
}

.welcome-badge {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 16px;
  background: rgba(255, 255, 255, 0.08);
  padding: 16px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.welcome-badge span {
  color: var(--navy-300);
  font-weight: 500;
}

.welcome-badge b {
  color: var(--gold-400);
  font-weight: 700;
}

/* ============================================================
   GRID & CARD
   ============================================================ */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.card-topik {
  display: flex;
  gap: 18px;
  padding: 20px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.card-topik:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--navy-300);
}

.card-topik-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 30px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.card-topik-body { flex: 1; min-width: 0; }

.card-topik-body h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
}

.card-topik-body p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.card-topik-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.link-arrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-600);
}

/* ============================================================
   BADGE
   ============================================================ */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-soft {
  background: var(--blue-100);
  color: var(--blue-700);
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  background: var(--navy-50);
  white-space: nowrap;
}

.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.table tbody tr:hover { background: var(--navy-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   GRADE BADGES
   ============================================================ */
.grade {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
}

.grade-A { background: var(--green-100); color: var(--green-700); }
.grade-B { background: var(--blue-100); color: var(--blue-700); }
.grade-C { background: var(--amber-100); color: var(--amber-600); }
.grade-D { background: #ffedd5; color: #c2410c; }
.grade-E { background: var(--red-100); color: var(--red-700); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy-900);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--navy-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy-900);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--navy-50);
  border-color: var(--navy-400);
}

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-900);
}

.btn-gold:hover { background: var(--gold-600); }

.btn-danger {
  background: var(--red-500);
  color: var(--white);
}

.btn-danger:hover { background: var(--red-700); }

.btn-success {
  background: var(--green-500);
  color: var(--white);
}

.btn-success:hover { background: var(--green-700); }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
}

/* ============================================================
   FORM
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text-primary);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  outline: none;
  transition: all 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--navy-800);
  box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.08);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group .help-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 18px;
  border-left: 4px solid;
}

.alert-error {
  background: var(--red-100);
  color: var(--red-700);
  border-color: var(--red-500);
}

.alert-success {
  background: var(--green-100);
  color: var(--green-700);
  border-color: var(--green-500);
}

.alert-info {
  background: var(--blue-100);
  color: var(--blue-700);
  border-color: var(--blue-500);
}

.alert-warning {
  background: var(--amber-100);
  color: var(--amber-600);
  border-color: var(--amber-600);
}

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-page {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-container { width: 100%; max-width: 440px; }

.auth-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 34px;
  color: var(--gold-400);
  box-shadow: var(--shadow-md);
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-form { margin-bottom: 24px; }

.auth-demo {
  padding: 16px 18px;
  background: var(--navy-50);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  margin-bottom: 20px;
}

.auth-demo p {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.demo-grid {
  display: grid;
  gap: 8px;
}

.demo-grid > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.demo-grid span { color: var(--text-secondary); }

.demo-grid code {
  background: var(--white);
  padding: 3px 10px;
  border-radius: 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--navy-900);
  border: 1px solid var(--border);
}

.auth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--white);
  margin-top: 40px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--navy-900);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  max-width: 90vw;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--red-500); }
.toast.toast-success { background: var(--green-500); }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show { display: flex; }

.modal-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 2;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
  flex: 1;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--navy-100);
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--red-100);
  color: var(--red-700);
}

.modal-body { padding: 24px 26px; }
.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--navy-50);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: sticky;
  bottom: 0;
}

/* ============================================================
   SUMMARY CARDS
   ============================================================ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.sum-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.sum-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy-900), var(--gold-500));
}

.sum-card-icon {
  font-size: 22px;
  margin-bottom: 12px;
}

.sum-card-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 8px;
}

.sum-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.sum-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.toolbar input[type="text"],
.toolbar input[type="date"],
.toolbar select {
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text-primary);
  background: var(--white);
  transition: all 0.15s;
}

.toolbar input[type="text"] {
  flex: 1;
  min-width: 180px;
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--navy-800);
  box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.08);
}

.toolbar-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 12px; }
  .nav-main { width: 100%; overflow-x: auto; order: 3; padding-bottom: 6px; }
  .user-info { display: none; }
  .nav-link { font-size: 12.5px; padding: 7px 11px; }
  .container { padding: 0 16px; }
  main.container { padding: 20px 16px 40px; }
  .welcome-section { padding: 24px; }
  .welcome-section h1 { font-size: 20px; }
  .welcome-badge { width: 100%; }
  .auth-card { padding: 32px 24px; }
}