﻿/* ================================================================
   E-Learning — Custom Stylesheet
   ================================================================ */

:root {
  --primary:    #4f46e5;
  --primary-dk: #3730a3;
  --secondary:  #06b6d4;
  --success:    #10b981;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --sidebar-w:  260px;
  --sidebar-bg: #1e1b4b;
  --sidebar-fg: #c7d2fe;
  --sidebar-hover: #312e81;
  --sidebar-active: #4f46e5;
  --topbar-h:   60px;
  --body-bg:    #f1f5f9;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: #334155;
  margin: 0;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid #312e81;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
}

.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6d76b5;
  padding: .6rem 1.25rem .25rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1.25rem;
  color: var(--sidebar-fg);
  text-decoration: none;
  border-radius: 0;
  font-size: .875rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-link i { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--secondary);
  font-weight: 600;
}
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #312e81;
  font-size: .78rem;
  color: #6d76b5;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1020;
  gap: 1rem;
}
.topbar-title { font-weight: 600; font-size: 1rem; color: #1e293b; flex: 1; }
.topbar .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 1.75rem;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* Stat cards */
.stat-card {
  border-radius: 14px;
  padding: 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  position: absolute; right: 1rem; bottom: .75rem;
  font-size: 3.5rem; opacity: .15;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .8rem; opacity: .85; margin-top: .25rem; }

.stat-primary   { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-secondary { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-success   { background: linear-gradient(135deg, #10b981, #059669); }
.stat-warning   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-danger    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-info      { background: linear-gradient(135deg, #6366f1, #4f46e5); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-hover > tbody > tr:hover { background-color: #f8fafc; }
.table th {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #94a3b8;
  border-top: none;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge-role-admin     { background: #7c3aed; color: #fff; }
.badge-role-dosen     { background: #0891b2; color: #fff; }
.badge-role-mahasiswa { background: #059669; color: #fff; }

/* ── Auth Layout ────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 1.8rem; color: #fff;
}

/* ── Kelas Card ─────────────────────────────────────────────── */
.kelas-card {
  border-radius: 14px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.kelas-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,.1); }
.kelas-card .kelas-header {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  padding: 1.25rem;
}
.kelas-card .kode-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border-radius: 6px;
  padding: .15rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .1em;
  cursor: pointer;
}

/* ── Forum / Diskusi ────────────────────────────────────────── */
.diskusi-item {
  border-left: 3px solid transparent;
  transition: border-color .15s;
}
.diskusi-item:hover { border-left-color: var(--primary); }
.diskusi-item.pinned { border-left-color: var(--warning); background: #fffbeb; }

/* ── Quiz Timer ─────────────────────────────────────────────── */
.quiz-timer {
  background: linear-gradient(135deg, #1e1b4b, #4f46e5);
  color: #fff;
  border-radius: 14px;
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
}
.quiz-timer.warning { background: linear-gradient(135deg, #92400e, #d97706); }
.quiz-timer.danger  { background: linear-gradient(135deg, #7f1d1d, #ef4444); }

/* ── Presensi status ────────────────────────────────────────── */
.status-hadir  { color: #059669; font-weight: 600; }
.status-izin   { color: #0891b2; font-weight: 600; }
.status-sakit  { color: #d97706; font-weight: 600; }
.status-alpha  { color: #dc2626; font-weight: 600; }

/* ── Nilai Grade ────────────────────────────────────────────── */
.grade-A { color: #059669; font-weight: 700; }
.grade-B { color: #0891b2; font-weight: 700; }
.grade-C { color: #d97706; font-weight: 700; }
.grade-D { color: #ea580c; font-weight: 700; }
.grade-E { color: #dc2626; font-weight: 700; }

/* ── Utilities ──────────────────────────────────────────────── */
.text-primary-custom { color: var(--primary) !important; }
.btn-primary-custom {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary-custom:hover {
  background: var(--primary-dk);
  border-color: var(--primary-dk);
  color: #fff;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h2 { margin: 0; font-weight: 700; font-size: 1.35rem; }

/* ── Sidebar toggle for mobile ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1029;
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .topbar { left: 0; }
  .main-content { margin-left: 0; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Notification badge ─────────────────────────────────────── */
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  font-size: .65rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ── Flash / Alert ──────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: calc(var(--topbar-h) + .75rem);
  right: 1rem;
  z-index: 9999;
  width: 340px;
}
