@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');
:root {
  --bg:         #f0f2f8;
  --surface:    #ffffff;
  --surface2:   #f5f7ff;
  --surface3:   #eceffe;
  --border:     #dde2f0;
  --border2:    #c8d0e8;

  --accent:     #5b4ef8;
  --accent-lt:  #ede9ff;
  --accent2:    #f0547a;
  --accent2-lt: #ffedf2;
  --accent3:    #0ec99a;
  --accent3-lt: #e0faf4;
  --warning:    #f59e0b;
  --warning-lt: #fff8e6;

  --text:       #1a1d2e;
  --text-muted: #5a607a;
  --text-dim:   #9399b2;

  --success:    #0ec99a;
  --danger:     #f0547a;

  --radius:     12px;
  --radius-lg:  18px;
  --shadow:     0 2px 16px rgba(91,78,248,0.08);
  --shadow-md:  0 4px 28px rgba(91,78,248,0.13);
  --shadow-accent: 0 0 40px rgba(91,78,248,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}

h1,h2,h3,h4,h5 {
 font-family: 'Poppins', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; transition: all .2s; }
a:hover { color: #7b6ef9; }

/* ── LAYOUT ── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #a89cff, #5be8c8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-logo .logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 3px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.28);
  padding: 10px 12px 4px;
  font-family: 'Syne', sans-serif;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(91,78,248,0.5), rgba(91,78,248,0.2));
  color: #fff;
  border-left: 3px solid #a89cff;
}
.nav-link .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items:center; justify-content:center;
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 800; color: white;
  flex-shrink: 0;
}
.user-info .user-name  { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); }
.user-info .user-role  { font-size: 11px; color: rgba(255,255,255,0.35); }

.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 var(--border);
}
.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 800;
  color: var(--text);
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.page-content { padding: 28px 32px; flex: 1; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-header { margin-bottom: 20px; }
.card-title   { font-size: 16px; font-weight: 700; color: var(--text); font-family: 'Syne', sans-serif; }
.card-subtitle{ font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  color: white;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-card.purple { background: linear-gradient(135deg, #5b4ef8, #8b7ffa); }
.stat-card.pink   { background: linear-gradient(135deg, #f0547a, #f87fa0); }
.stat-card.green  { background: linear-gradient(135deg, #0ec99a, #34d9b0); }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}

.stat-icon {
  font-size: 22px;
  margin-bottom: 14px;
  display: block;
}
.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 36px; font-weight: 800;
  color: white; line-height: 1;
}
.stat-label { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 4px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all .2s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 10px rgba(91,78,248,0.3);
}
.btn-primary:hover {
  background: #7b6ef9; color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(91,78,248,0.4);
}
.btn-secondary {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.btn-success {
  background: var(--accent3-lt);
  color: #0a9e7c;
  border: 1px solid rgba(14,201,154,0.25);
}
.btn-success:hover { background: var(--accent3); color: white; }
.btn-danger {
  background: var(--accent2-lt);
  color: var(--accent2);
  border: 1px solid rgba(240,84,122,0.2);
}
.btn-danger:hover { background: var(--accent2); color: white; }
.btn-sm  { padding: 6px 13px; font-size: 13px; }
.btn-lg  { padding: 13px 28px; font-size: 16px; border-radius: 10px; }
.btn-icon{ padding: 8px; }

/* ── FORMS ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.form-control {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,78,248,0.12);
  background: #fff;
}
.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-error{ font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 2px solid var(--border); }
th {
  font-family: 'Syne', sans-serif;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim);
  padding: 12px 16px; text-align: left; font-weight: 700;
}
td {
  padding: 14px 16px; font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--surface2); }
tbody tr:hover td { color: var(--text); }
td.text-main { color: var(--text); font-weight: 600; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
  font-family: 'Syne', sans-serif;
}
.badge-published, .badge-active, .badge-success {
  background: var(--accent3-lt); color: #0a9e7c;
}
.badge-draft, .badge-pending, .badge-warning {
  background: var(--warning-lt); color: #b97400;
}
.badge-archived, .badge-closed, .badge-danger {
  background: var(--accent2-lt); color: var(--accent2);
}
.badge-admin   { background: var(--accent-lt); color: var(--accent); }
.badge-learner { background: var(--surface3); color: var(--text-muted); }

/* ── ALERTS ── */
.alert {
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  font-weight: 500;
}
.alert-success {
  background: var(--accent3-lt);
  border: 1px solid rgba(14,201,154,0.3);
  color: #0a9e7c;
}
.alert-error, .alert-danger {
  background: var(--accent2-lt);
  border: 1px solid rgba(240,84,122,0.3);
  color: var(--accent2);
}
.alert-warning {
  background: var(--warning-lt);
  border: 1px solid rgba(245,158,11,0.3);
  color: #b97400;
}
.alert-info {
  background: var(--accent-lt);
  border: 1px solid rgba(91,78,248,0.2);
  color: var(--accent);
}

/* ── PROGRESS ── */
.progress-bar-wrap {
  background: var(--surface3);
  border-radius: 99px; overflow: hidden; height: 8px;
}
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-text { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ── STEP CARDS (learner) ── */
.steps-list { display: flex; flex-direction: column; gap: 10px; }
.step-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: all .2s;
  box-shadow: var(--shadow);
}
.step-card:hover { transform: translateX(3px); }
.step-card.available { border-color: rgba(91,78,248,0.35); background: #fdfcff; }
.step-card.completed { border-color: rgba(14,201,154,0.35); background: #fafffe; }
.step-card.locked    { opacity: 0.55; }
.step-card.expired   { border-color: rgba(240,84,122,0.35); background: #fff9fb; }

.step-number {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items:center; justify-content:center;
  font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 800;
  flex-shrink: 0;
}
.step-card.available .step-number { background: var(--accent-lt); color: var(--accent); }
.step-card.completed .step-number { background: var(--accent3-lt); color: #0a9e7c; }
.step-card.locked    .step-number { background: var(--surface3); color: var(--text-dim); }
.step-card.expired   .step-number { background: var(--accent2-lt); color: var(--accent2); }

.step-info   { flex: 1; }
.step-title  { font-weight: 700; font-size: 15px; color: var(--text); font-family: 'Syne', sans-serif; }
.step-meta   { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.step-score  {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800; color: #0a9e7c;
}

/* ── PDF VIEWER ── */
.pdf-wrapper {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.pdf-toolbar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.pdf-scroll-area { height: 70vh; overflow-y: auto; background: #f4f5fb; }
.pdf-scroll-area iframe { width: 100%; height: 100%; border: none; min-height: 70vh; }
.pdf-bottom-bar {
  background: var(--surface2);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── QUIZ ── */
.quiz-question {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.quiz-question-text {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  font-size: 14px;
  background: var(--surface);
}
.quiz-option:hover {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.quiz-option input[type=radio] { accent-color: var(--accent); }
.quiz-option.correct-answer {
  border-color: var(--accent3);
  background: var(--accent3-lt);
  color: #0a9e7c;
}
.quiz-option.wrong-answer {
  border-color: var(--accent2);
  background: var(--accent2-lt);
  color: var(--accent2);
}
.quiz-explanation {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--accent-lt);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 13px; color: var(--accent);
}

/* ── RESULT ── */
.result-hero { text-align: center; padding: 40px 20px; }
.result-score-ring {
  width: 140px; height: 140px; border-radius: 50%;
  margin: 0 auto 20px;
  display: flex; align-items:center; justify-content:center;
  font-family: 'Syne', sans-serif;
  font-size: 40px; font-weight: 800;
}
.result-score-ring.pass {
  background: var(--accent3-lt);
  border: 4px solid var(--accent3);
  color: #0a9e7c;
  box-shadow: 0 0 50px rgba(14,201,154,0.2);
}
.result-score-ring.fail {
  background: var(--accent2-lt);
  border: 4px solid var(--accent2);
  color: var(--accent2);
  box-shadow: 0 0 50px rgba(240,84,122,0.15);
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #edeaff 0%, #f0f8ff 50%, #e8fff7 100%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,78,248,0.15) 0%, transparent 70%);
  top: -150px; right: -100px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(14,201,154,0.12) 0%, transparent 70%);
  bottom: -100px; left: -80px;
}
.login-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(91,78,248,0.15);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-logo-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── CERTIFICATE PREVIEW ── */
.cert-preview {
  background: white;
  border-radius: var(--radius);
  padding: 48px; text-align: center;
  color: var(--text); max-width: 700px; margin: 0 auto;
  box-shadow: 0 0 60px rgba(91,78,248,0.2);
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-header-left .page-title {
  font-size: 24px; font-weight: 800;
  color: var(--text); font-family: 'Syne', sans-serif;
}
.page-header-left .page-desc {
  font-size: 14px; color: var(--text-muted); margin-top: 4px;
}

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── UTILS ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-success{ color: #0a9e7c; }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.text-accent { color: var(--accent); }
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:16px}.mt-4{margin-top:24px}.mt-6{margin-top:40px}
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:16px}.mb-4{margin-bottom:24px}
.flex{display:flex}.items-center{align-items:center}.justify-between{justify-content:space-between}
.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}
.fw-600{font-weight:600}.fw-700{font-weight:700}
.fs-13{font-size:13px}.fs-12{font-size:12px}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity:0; transform: translateY(10px); }
  to   { opacity:1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .35s ease both; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.pulse { animation: pulse 2s infinite; }

/* ── MOBILE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .login-card { padding: 28px; margin: 16px; }
}
