:root {
  --background: #ffffff;
  --foreground: #1e293b;
  --card: #f8fafc;
  --card-foreground: #1e293b;
  --primary: #2563EB;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #1e293b;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #7C3AED;
  --accent-foreground: #ffffff;
  --destructive: #ef4444;
  --border: #e2e8f0;
  --radius: 0.75rem;
  --header-bg: linear-gradient(135deg, #4c1d95, #5b21b6, #6d28d9, #7c3aed);
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c4b5fd;
  --sidebar-active: #7c3aed;
  --sidebar-hover: rgba(124,58,237,0.2);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--foreground); background: var(--background); font-size: 16px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: var(--radius); font-weight: 500; font-size: 14px; cursor: pointer; border: none; transition: all 0.2s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--secondary); }
.btn-outline { background: transparent; color: var(--foreground); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--secondary); }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 8px; background: transparent; border: none; cursor: pointer; border-radius: var(--radius); transition: background 0.2s; color: rgba(255,255,255,0.8); }
.btn-icon:hover { background: rgba(255,255,255,0.15); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }
.btn-flex-col { flex-direction: column; gap: 4px; padding: 16px; height: auto; }

.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.card-header { padding: 20px 24px 12px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--foreground); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--muted-foreground); }
.card-content { padding: 16px 24px 24px; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 500; }
.badge-primary { background: var(--primary); color: #fff; }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-accent { background: var(--accent); color: #fff; }
.badge-green { background: #16a34a; color: #fff; }
.badge-yellow { background: #ca8a04; color: #fff; }
.badge-red { background: var(--destructive); color: #fff; }

.progress { background: #e2e8f0; border-radius: 9999px; height: 8px; overflow: hidden; width: 100%; }
.progress-bar { height: 100%; border-radius: 9999px; background: var(--primary); transition: width 0.3s; }
.progress-sm { height: 4px; }

.avatar { width: 40px; height: 40px; border-radius: 9999px; overflow: hidden; background: var(--secondary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: var(--primary); flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }
.avatar-xl { width: 96px; height: 96px; font-size: 28px; }

.input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--card); color: var(--foreground); outline: none; transition: border-color 0.2s; }
.input:focus { border-color: var(--primary); }
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 36px; }
.input-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }

/* ═══════════════════════════════════════
   SIDEBAR — Dark Purple
═══════════════════════════════════════ */
.app-layout { display: flex; height: 100vh; background: #f8fafc; }

.sidebar {
  width: 256px;
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(76,29,149,0.18);
}

.sidebar-logo {
  padding: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo a { display: flex; align-items: center; gap: 8px; }

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(to right, #a5b4fc, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text-lg {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--sidebar-hover);
  color: #e9d5ff;
}

.nav-btn.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124,58,237,0.4);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-footer .btn-outline {
  color: #c4b5fd;
  border-color: rgba(196,181,253,0.3);
  background: transparent;
}

.sidebar-footer .btn-outline:hover {
  background: rgba(124,58,237,0.2);
  color: #e9d5ff;
}

/* ═══════════════════════════════════════
   HEADER — Purple Gradient
═══════════════════════════════════════ */
.main-content { flex: 1; overflow: auto; display: flex; flex-direction: column; }

.top-header {
  background: var(--header-bg);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(76,29,149,0.25);
}

/* Header search */
.top-header .input-wrap .input {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
  backdrop-filter: blur(8px);
}

.top-header .input-wrap .input::placeholder { color: rgba(255,255,255,0.55); }
.top-header .input-wrap .input:focus { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.18); }
.top-header .input-icon { color: rgba(255,255,255,0.6); }

/* Header text */
.top-header h2, .top-header h1 { color: #fff; }
.top-header p { color: rgba(255,255,255,0.75); }

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

.notif-dot { width: 8px; height: 8px; background: #fbbf24; border-radius: 50%; position: absolute; top: 2px; right: 2px; box-shadow: 0 0 0 2px rgba(76,29,149,0.5); }
.online-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; }
.icon-circle { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Avatar in header */
.top-header .avatar { border: 2px solid rgba(255,255,255,0.4); }

/* ═══════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════ */
.page-content { padding: 24px; display: flex; flex-direction: column; gap: 24px; flex: 1; }

/* Page title inside page-content (not header) */
.page-content h1 { color: #1e1b4b; }

/* ═══════════════════════════════════════
   GRADIENT TEXT
═══════════════════════════════════════ */
.gradient-text { background: linear-gradient(to right, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ═══════════════════════════════════════
   COMMON HELPERS
═══════════════════════════════════════ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.min-h-screen { min-height: 100vh; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }
.mb-16 { margin-bottom: 64px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.ml-2 { margin-left: 8px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 28px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-white { color: #fff; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-slate-900 { color: #0f172a; }
.text-green { color: #16a34a; }
.text-red { color: var(--destructive); }
.text-yellow { color: #ca8a04; }
.bg-white { background: #fff; }
.bg-slate-50 { background: #f8fafc; }
.bg-slate-900 { background: #0f172a; }
.bg-primary { background: var(--primary); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: 9999px; }
.rounded-3xl { border-radius: 24px; }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-10 { z-index: 10; }
.cursor-pointer { cursor: pointer; }
.opacity-60 { opacity: 0.6; }
.opacity-80 { opacity: 0.8; }
.opacity-90 { opacity: 0.9; }
.whitespace-pre-line { white-space: pre-line; }
.hidden { display: none; }

/* ═══════════════════════════════════════
   GRIDS
═══════════════════════════════════════ */
.metric-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.grid-4col { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* Space */
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }

/* ═══════════════════════════════════════
   TABS
═══════════════════════════════════════ */
.tabs-list { display: grid; background: var(--secondary); border-radius: var(--radius); padding: 4px; gap: 2px; }
.tabs-3 { grid-template-columns: 1fr 1fr 1fr; }
.tab-trigger { padding: 6px 12px; border-radius: calc(var(--radius) - 2px); font-size: 14px; font-weight: 500; cursor: pointer; background: transparent; border: none; color: var(--muted-foreground); transition: all 0.2s; text-align: center; }
.tab-trigger.active { background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(124,58,237,0.3); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ═══════════════════════════════════════
   CHAT
═══════════════════════════════════════ */
.chat-area { flex: 1; overflow-y: auto; padding: 24px; }
.chat-msg { display: flex; gap: 12px; margin-bottom: 16px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-bubble { max-width: 600px; border-radius: 16px; padding: 12px 16px; }
.chat-bubble.ai { background: #fff; border: 1px solid var(--border); }
.chat-bubble.user { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.chat-time.ai { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.chat-time.user { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.ai-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ═══════════════════════════════════════
   LEARNING PATH
═══════════════════════════════════════ */
.path-container { position: relative; height: 600px; }
.path-node { position: absolute; transform: translate(-50%, -50%); }
.node-btn { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 3px solid; cursor: pointer; transition: transform 0.2s; }
.node-btn:hover { transform: scale(1.1); }
.node-completed { background: #22c55e; border-color: #16a34a; }
.node-inprogress { background: var(--primary); border-color: #1d4ed8; }
.node-locked { background: #94a3b8; border-color: #64748b; }
.node-label { text-align: center; font-size: 11px; font-weight: 500; margin-top: 6px; max-width: 80px; }

/* ═══════════════════════════════════════
   GAMIFICATION
═══════════════════════════════════════ */
.badge-card { padding: 12px; border-radius: var(--radius); border: 2px solid; }
.badge-card.unlocked { background: linear-gradient(135deg, #fefce8, #fff7ed); border-color: #fde047; }
.badge-card.locked { background: #f8fafc; border-color: var(--border); opacity: 0.6; }
.badge-emoji { font-size: 32px; margin-bottom: 8px; }

/* ═══════════════════════════════════════
   RISK CARDS
═══════════════════════════════════════ */
.risk-high { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.risk-medium { background: #fefce8; border-color: #fde047; color: #92400e; }
.risk-low { background: #f0fdf4; border-color: #86efac; color: #166534; }

/* ═══════════════════════════════════════
   PREDICTION FORM
═══════════════════════════════════════ */
.predict-form { display: flex; flex-direction: column; gap: 16px; }
.predict-form .form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.predict-result { padding: 20px 24px; border-radius: var(--radius); font-size: 18px; font-weight: 700; text-align: center; margin-top: 8px; }
.result-high { background: linear-gradient(135deg, #fef2f2, #fee2e2); border: 2px solid #ef4444; color: #b91c1c; }
.result-medium { background: linear-gradient(135deg, #fefce8, #fef9c3); border: 2px solid #ca8a04; color: #92400e; }
.result-low { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border: 2px solid #16a34a; color: #166534; }

/* ═══════════════════════════════════════
   LANDING PAGE
═══════════════════════════════════════ */
.hero-section { padding: 80px 24px; background: linear-gradient(135deg, #eff6ff, #f5f3ff, #fff); }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; max-width: 1280px; margin: 0 auto; }
.hero-img-wrap { position: relative; }
.hero-img-glow { position: absolute; inset: 0; background: linear-gradient(to right, rgba(37,99,235,0.2), rgba(124,58,237,0.2)); border-radius: 24px; filter: blur(32px); }
.hero-img { width: 100%; border-radius: 24px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); position: relative; }
.feat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.feat-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 24px; transition: all 0.3s; }
.feat-card:hover { border-color: var(--accent); box-shadow: 0 10px 25px rgba(124,58,237,0.12); }
.stats-section { padding: 80px 24px; background: linear-gradient(135deg, #1e1b4b, #4c1d95, #6d28d9); color: #fff; }
.stat-card { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius); padding: 24px; text-align: center; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }

/* Landing navbar */
nav.border-b { background: rgba(255,255,255,0.92) !important; backdrop-filter: blur(12px); border-bottom: 1px solid rgba(124,58,237,0.15) !important; }

/* ═══════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════ */
.login-layout { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-right { background: linear-gradient(135deg, #1e1b4b, #4c1d95, #7c3aed); display: flex; align-items: center; justify-content: center; padding: 48px; position: relative; overflow: hidden; }
.login-orb1 { position: absolute; top: 40px; left: 40px; width: 288px; height: 288px; background: rgba(255,255,255,0.1); border-radius: 50%; filter: blur(32px); }
.login-orb2 { position: absolute; bottom: 40px; right: 40px; width: 384px; height: 384px; background: rgba(255,255,255,0.1); border-radius: 50%; filter: blur(32px); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
.mobile-menu-btn { display: none; background: transparent; border: none; color: #fff; cursor: pointer; padding: 4px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
@media (max-width: 900px) {
  .mobile-menu-btn { display: block; }
  .sidebar { 
    position: fixed; 
    left: -280px; 
    top: 0; 
    bottom: 0; 
    z-index: 50; 
    transition: left 0.3s ease; 
    width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { left: 0; }
  .sidebar.open + .main-content .sidebar-overlay { display: block; }
  .hero-grid, .login-layout { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .metric-cards { grid-template-columns: 1fr 1fr; }
  .grid-2col, .grid-3col { grid-template-columns: 1fr; }
  .grid-4col { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .predict-form .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .metric-cards, .grid-4col { grid-template-columns: 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
}