@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: #475569;
  font-weight: 600;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-link:hover {
  background: #eef2ff;
  color: #3730a3;
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.24);
}

.icon-box {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: #eef2ff;
  color: #4f46e5;
}

.soft-card {
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost,
.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.7rem 1rem;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
  outline: none;
}

.btn-primary {
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 12px 20px rgba(79, 70, 229, 0.22);
}

.btn-primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-ghost:focus-visible,
.btn-success:focus-visible {
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.btn-secondary {
  background: #eef2ff;
  color: #3730a3;
}

.btn-secondary:hover {
  background: #e0e7ff;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-success {
  background: #dcfce7;
  color: #166534;
}

.btn-success:hover {
  background: #bbf7d0;
}

.btn-ghost {
  background: transparent;
  color: #475569;
}

.btn-ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.field {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.85rem;
  background: #fff;
  padding: 0.8rem 0.95rem;
  color: #0f172a;
  transition: border 160ms ease, box-shadow 160ms ease;
}

.field:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
  outline: none;
}

.field.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-green {
  color: #166534;
  background: #dcfce7;
}

.badge-amber {
  color: #92400e;
  background: #fef3c7;
}

.badge-red {
  color: #991b1b;
  background: #fee2e2;
}

.badge-indigo {
  color: #3730a3;
  background: #e0e7ff;
}

.progress-track {
  height: 0.55rem;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #22c55e);
  transition: width 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #e2e8f0;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.toast-enter {
  animation: toast-in 240ms ease-out both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.54);
}

.chart-bar {
  min-height: 1.25rem;
  border-radius: 0.5rem;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
}

.donut {
  --value: 74;
  width: 9.5rem;
  height: 9.5rem;
  border-radius: 999px;
  background: conic-gradient(#4f46e5 calc(var(--value) * 1%), #e2e8f0 0);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border-radius: inherit;
  background: #fff;
}

.donut span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.55rem;
  color: #0f172a;
}

.certificate-paper {
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #4f46e5, #22c55e, #f59e0b) border-box;
  border: 10px solid transparent;
}

.signature-line {
  border-top: 1px solid #94a3b8;
}

.toggle {
  position: relative;
  width: 3rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 180ms ease;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  top: 0.225rem;
  left: 0.25rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.24);
  transition: transform 180ms ease;
}

.toggle[data-on="true"] {
  background: #4f46e5;
}

.toggle[data-on="true"]::after {
  transform: translateX(1.25rem);
}

.tooltip {
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  white-space: nowrap;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #fff;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 50;
}

@media print {
  body { background: #fff; }
  .no-print, aside, header { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; }
  .certificate-paper { box-shadow: none !important; page-break-inside: avoid; }
}

/* ──────────────────────────────────────────────
   EXTENDED STYLES – Learner + Admin Portals
   ────────────────────────────────────────────── */

/* Admin sidebar */
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.admin-nav-link:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; transform: translateX(2px); }
.admin-nav-link.active { background: rgba(99,102,241,0.18); color: #a5b4fc; border-left: 3px solid #6366f1; padding-left: calc(0.85rem - 3px); }

.admin-icon-box {
  width: 2.25rem; height: 2.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0.75rem;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* KPI cards */
.kpi-card {
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 4px 20px rgba(15,23,42,0.06);
  border-radius: 1.5rem;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
}
.kpi-green::before { background: linear-gradient(90deg, #22c55e, #16a34a); }
.kpi-indigo::before { background: linear-gradient(90deg, #4f46e5, #6366f1); }
.kpi-amber::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.kpi-red::before { background: linear-gradient(90deg, #ef4444, #dc2626); }
.kpi-cyan::before { background: linear-gradient(90deg, #06b6d4, #0891b2); }

/* Cyan / purple / slate badges */
.badge-cyan   { color: #0e7490; background: #cffafe; }
.badge-purple { color: #6b21a8; background: #f3e8ff; }
.badge-slate  { color: #475569; background: #f1f5f9; }

/* Extra donut variants */
.donut.green { background: conic-gradient(#22c55e calc(var(--value) * 1%), #e2e8f0 0); }
.donut.amber { background: conic-gradient(#f59e0b calc(var(--value) * 1%), #e2e8f0 0); }
.donut.sm    { width: 7rem; height: 7rem; }
.donut.sm::after { inset: 0.85rem; }
.donut.sm span { font-size: 1.1rem; }

/* Progress variants */
.progress-track.thick { height: 0.75rem; }
.progress-fill.amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-fill.red   { background: linear-gradient(90deg, #ef4444, #dc2626); }
.progress-fill.cyan  { background: linear-gradient(90deg, #06b6d4, #0891b2); }

/* Chart bar variants */
.chart-bar { transition: width 800ms cubic-bezier(0.22,1,0.36,1); }
.chart-bar.green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.chart-bar.amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.chart-bar.red   { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* Button sizes */
.btn-sm { padding: 0.45rem 0.75rem; font-size: 0.8rem; border-radius: 0.6rem; }
.btn-warning { background: #fef3c7; color: #92400e; border: none; cursor: pointer; }
.btn-warning:hover { background: #fde68a; }

/* Notification item */
.notif-item {
  border-radius: 1rem; padding: 1rem;
  border: 1px solid #e2e8f0; background: #fff;
  transition: background 160ms ease; cursor: pointer;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eef2ff; border-color: #c7d2fe; }

/* Course card */
.course-card {
  border: 1px solid #e2e8f0; background: #fff;
  border-radius: 1.5rem; overflow: hidden;
  box-shadow: 0 4px 16px rgba(15,23,42,0.05);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(15,23,42,0.10); border-color: #a5b4fc; }
.course-card.locked { opacity: 0.6; filter: grayscale(0.4); }

/* Assessment options */
.option-btn {
  width: 100%; border-radius: 1rem;
  border: 2px solid #e2e8f0; padding: 1rem;
  text-align: left; background: #fff;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  cursor: pointer;
}
.option-btn:hover   { border-color: #a5b4fc; background: #eef2ff; }
.option-btn.selected { border-color: #4f46e5; background: #eef2ff; box-shadow: 0 0 0 4px rgba(99,102,241,0.12); }
.option-btn.correct  { border-color: #22c55e; background: #dcfce7; }
.option-btn.wrong    { border-color: #ef4444; background: #fee2e2; }

/* Tab bar */
.tab-bar { display: flex; gap: 0.25rem; background: #f1f5f9; border-radius: 1rem; padding: 0.25rem; }
.tab-item {
  border-radius: 0.75rem; padding: 0.45rem 0.9rem;
  font-size: 0.85rem; font-weight: 600; color: #64748b;
  cursor: pointer; transition: background 160ms ease, color 160ms ease;
  border: none; background: transparent;
}
.tab-item.active, .tab-item:hover { background: #fff; color: #4f46e5; box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-weight: 700; }

/* Timeline */
.timeline-item { position: relative; padding-left: 2.5rem; padding-bottom: 1.5rem; }
.timeline-item::before {
  content: ""; position: absolute;
  left: 0.75rem; top: 1.5rem; bottom: 0;
  width: 2px; background: #e2e8f0;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute; left: 0; top: 0.25rem;
  width: 1.5rem; height: 1.5rem; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 800;
}

/* Pulse dot */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 999px; background: #22c55e; position: relative;
}
.pulse-dot::after {
  content: ""; position: absolute; inset: -3px;
  border-radius: inherit; background: rgba(34,197,94,0.35);
  animation: pulse-ring 1.5s cubic-bezier(0.4,0,0.6,1) infinite;
}
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(1.7); opacity: 0; }
}

/* Data table */
.data-table th {
  padding: 0.75rem 1rem; font-size: 0.72rem;
  font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: #94a3b8;
  border-bottom: 1px solid #e2e8f0;
}
.data-table td { padding: 0.85rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: 0.875rem; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }

/* Animations */
.fade-in  { animation: fadeIn  300ms ease-out both; }
.slide-up { animation: slideUp 300ms ease-out both; }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Hover utilities */
.hover-lift { transition: transform 200ms ease, box-shadow 200ms ease; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,0.10); }

/* Risk row indicators */
.risk-high   { border-left: 3px solid #ef4444; }
.risk-medium { border-left: 3px solid #f59e0b; }
.risk-low    { border-left: 3px solid #22c55e; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1rem; text-align: center; }

/* Input group */
.input-group {
  display: flex; align-items: center;
  border: 1px solid #cbd5e1; border-radius: 0.85rem;
  overflow: hidden; background: #fff;
  transition: border-color 160ms, box-shadow 160ms;
}
.input-group:focus-within { border-color: #6366f1; box-shadow: 0 0 0 4px rgba(99,102,241,0.14); }
.input-group .field { border: none; border-radius: 0; box-shadow: none; flex: 1; }
.input-group .field:focus { border: none; box-shadow: none; }
.input-group-icon { padding: 0 0.75rem; color: #94a3b8; font-size: 0.85rem; }

/* Nav link base fix for both portals */
.nav-link { border: none; cursor: pointer; text-decoration: none; }

/* Admin sidebar */
.admin-sidebar {
  background: #0f172a;
  border-right: 1px solid rgba(255,255,255,0.06);
}

/* Extra button sizes */
.btn-xs { padding: 0.28rem 0.6rem; font-size: 0.72rem; border-radius: 0.5rem; }

/* Trend arrow helpers */
.arrow-up::before { content: "↑ "; }
.arrow-down::before { content: "↓ "; }

/* Sort icon */
.sort-icon { opacity: 0.4; font-size: 0.75rem; }
th:hover .sort-icon { opacity: 0.9; }

