/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f8fafc; color: #1e293b; line-height: 1.5; min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }
ul { list-style: none; }

/* ─── Color System ─────────────────────────────────────────── */
:root {
  --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-200: #c7d2fe;
  --brand-300: #a5b4fc; --brand-400: #818cf8; --brand-500: #6366f1;
  --brand-600: #4f46e5; --brand-700: #4338ca; --brand-800: #3730a3;
  --brand-900: #312e81; --brand-950: #1e1b4b;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0;
  --gray-300: #cbd5e1; --gray-400: #94a3b8; --gray-500: #64748b;
  --gray-600: #475569; --gray-700: #334155; --gray-800: #1e293b;
  --gray-900: #0f172a;
  --green-50: #f0fdf4; --green-500: #22c55e; --green-600: #16a34a;
  --yellow-50: #fefce8; --yellow-500: #eab308; --yellow-600: #ca8a04;
  --red-50: #fef2f2; --red-500: #ef4444; --red-600: #dc2626;
  --amber-50: #fffbeb; --amber-500: #f59e0b;
  --purple-50: #faf5ff; --purple-500: #a855f7;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

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

/* Sidebar */
.sidebar {
  width: 260px; background: #fff; border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 50;
}
.sidebar-brand { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; gap: 0.5rem; }
.sidebar-brand-icon { font-size: 1.75rem; }
.sidebar-brand-text { font-size: 1.125rem; font-weight: 800; color: var(--gray-900); }
.sidebar-nav { flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem;
  border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--gray-600);
  transition: all 0.15s;
}
.sidebar-link:hover { background: var(--gray-50); color: var(--gray-900); }
.sidebar-link.active { background: var(--brand-50); color: var(--brand-700); }
.sidebar-user { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); display: flex; align-items: center; gap: 0.75rem; }
.sidebar-user-avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--brand-100); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--brand-700); font-size: 0.875rem; }
.sidebar-user-info { flex: 1; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: var(--gray-900); }
.sidebar-user-role { font-size: 0.75rem; color: var(--gray-500); }

/* Main Content */
.main-content { margin-left: 260px; flex: 1; padding: 1.5rem; max-width: 1280px; }
.main-content-wide { margin-left: 260px; flex: 1; padding: 1.5rem; }

/* ─── Header ───────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); }

/* ─── Components ────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: 0.75rem; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-header-title { font-size: 0.9375rem; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 1.25rem 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; }

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600;
  transition: all 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-ghost { color: var(--gray-600); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; padding: 0.125rem 0.625rem;
  border-radius: 9999px; font-size: 0.75rem; font-weight: 600; line-height: 1.25rem;
}
.badge-default { background: var(--gray-100); color: var(--gray-700); }
.badge-success { background: var(--green-50); color: var(--green-600); }
.badge-warning { background: var(--yellow-50); color: var(--yellow-600); }
.badge-danger { background: var(--red-50); color: var(--red-600); }
.badge-info { background: var(--purple-50); color: var(--purple-500); }

/* Progress Bar */
.progress { width: 100%; background: var(--gray-100); border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 9999px; transition: width 0.5s ease; }
.progress-sm { height: 0.375rem; }
.progress-md { height: 0.625rem; }
.progress-lg { height: 1rem; }
.progress-indigo .progress-bar { background: var(--brand-500); }
.progress-green .progress-bar { background: var(--green-500); }
.progress-yellow .progress-bar { background: var(--yellow-500); }
.progress-red .progress-bar { background: var(--red-500); }

/* Avatar */
.avatar {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff;
}
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.125rem; }

/* ─── Dashboard Grid ───────────────────────────────────────── */
.dashboard-grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ─── Streak Bar ────────────────────────────────────────────── */
.streak-bar {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  border-radius: 0.75rem; padding: 1rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; color: #fff; box-shadow: var(--shadow-lg);
}
.streak-bar-stats { display: flex; align-items: center; gap: 1.5rem; }
.streak-stat { display: flex; align-items: center; gap: 0.5rem; }
.streak-stat-icon { font-size: 1.5rem; }
.streak-stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.streak-stat-label { font-size: 0.75rem; opacity: 0.7; }
.streak-divider { width: 1px; height: 2rem; background: rgba(255,255,255,0.2); }
.streak-goal { display: flex; align-items: center; gap: 0.75rem; }
.streak-goal-label { font-size: 0.8125rem; opacity: 0.8; }
.streak-goal-bar { width: 6rem; height: 0.5rem; background: rgba(255,255,255,0.2); border-radius: 9999px; overflow: hidden; }
.streak-goal-fill { height: 100%; background: #fff; border-radius: 9999px; transition: width 0.5s; }
.streak-goal-pct { font-size: 0.8125rem; font-weight: 700; }

/* ─── Plan Task ─────────────────────────────────────────────── */
.task-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.5rem; border-left: 4px solid; margin-bottom: 0.5rem; }
.task-review { border-left-color: var(--brand-500); background: var(--brand-50); }
.task-quiz { border-left-color: var(--purple-500); background: var(--purple-50); }
.task-break { border-left-color: var(--green-500); background: var(--green-50); }
.task-debrief { border-left-color: var(--amber-500); background: var(--amber-50); }
.task-icon { font-size: 1.25rem; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 0.875rem; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-time { font-size: 0.75rem; color: var(--gray-500); }
.task-duration { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); }

/* ─── Review Item ───────────────────────────────────────────── */
.review-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; }
.review-item + .review-item { border-top: 1px solid var(--gray-100); }
.review-topic { font-size: 0.875rem; color: var(--gray-700); }

/* ─── Skill Tree ────────────────────────────────────────────── */
.skill-node { padding: 0.5rem 0.75rem; border-radius: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.skill-node:hover { background: var(--gray-50); }
.skill-node.locked { opacity: 0.5; }
.skill-star { font-size: 0.8125rem; }
.skill-name { font-size: 0.875rem; font-weight: 500; }
.skill-locked { font-size: 0.75rem; color: var(--gray-400); }
.skill-children { margin-left: 1.5rem; }

.mastery-green { color: var(--green-600); }
.mastery-yellow { color: var(--yellow-600); }
.mastery-gray { color: var(--gray-400); }

/* ─── Radar Chart ───────────────────────────────────────────── */
.radar-container { display: flex; justify-content: center; padding: 1rem 0; }

/* ─── Subject Progress ──────────────────────────────────────── */
.subject-progress { margin-bottom: 1rem; }
.subject-progress:last-child { margin-bottom: 0; }
.subject-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.subject-name { font-size: 0.875rem; font-weight: 600; color: var(--gray-700); }
.subject-pct { font-size: 0.8125rem; color: var(--gray-500); }

/* ─── Table ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 0.75rem 1rem; font-weight: 600; color: var(--gray-500); border-bottom: 1px solid var(--gray-100); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-50); }
tr:hover td { background: var(--gray-50); }
.heatmap-dot { display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; }
.heatmap-green { background: var(--green-500); }
.heatmap-yellow { background: var(--yellow-500); }
.heatmap-red { background: var(--red-500); }

/* ─── Mentor Chat ───────────────────────────────────────────── */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 6rem); }
.chat-header { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 1rem 1.5rem; display: flex; align-items: center; gap: 0.75rem; }
.chat-header-icon { font-size: 2rem; }
.chat-header-title { font-size: 1.125rem; font-weight: 700; }
.chat-header-status { font-size: 0.8125rem; color: var(--green-600); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; }
.chat-message { display: flex; gap: 0.75rem; margin-bottom: 1rem; max-width: 80%; }
.chat-message.user { margin-left: auto; flex-direction: row-reverse; }
.chat-avatar { width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; flex-shrink: 0; }
.chat-avatar.mentor { background: var(--brand-100); }
.chat-avatar.user { background: var(--brand-600); color: #fff; }
.chat-bubble { padding: 0.75rem 1rem; border-radius: 1rem; font-size: 0.875rem; line-height: 1.5; }
.chat-bubble.mentor { background: #fff; border: 1px solid var(--gray-200); color: var(--gray-800); }
.chat-bubble.user { background: var(--brand-600); color: #fff; }
.chat-typing { display: flex; gap: 0.25rem; padding: 0.5rem 0; }
.chat-typing span { width: 0.5rem; height: 0.5rem; background: var(--gray-400); border-radius: 50%; animation: chatBounce 1.4s infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.chat-quick-actions { display: flex; gap: 0.5rem; padding: 0.75rem 1.5rem; background: #fff; border-top: 1px solid var(--gray-200); overflow-x: auto; }
.chat-quick-btn { padding: 0.375rem 0.875rem; background: var(--gray-100); border-radius: 9999px; font-size: 0.8125rem; color: var(--gray-700); white-space: nowrap; transition: background 0.15s; }
.chat-quick-btn:hover { background: var(--gray-200); }
.chat-input-area { display: flex; gap: 0.75rem; padding: 1rem 1.5rem; background: #fff; border-top: 1px solid var(--gray-200); }
.chat-input { flex: 1; padding: 0.75rem 1rem; border: 1px solid var(--gray-300); border-radius: 0.75rem; font-size: 0.875rem; outline: none; transition: border-color 0.15s; }
.chat-input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* ─── Plan Cards ────────────────────────────────────────────── */
.plan-card { cursor: pointer; transition: all 0.15s; }
.plan-card:hover { box-shadow: var(--shadow-md); }
.plan-card.selected { ring: 2px solid var(--brand-500); box-shadow: var(--shadow-md); }
.plan-stat { display: flex; align-items: center; justify-content: space-between; font-size: 0.875rem; margin-bottom: 0.5rem; }
.plan-stat-label { color: var(--gray-500); }
.plan-stat-value { font-weight: 600; }
.plan-divider { border: none; border-top: 1px solid var(--gray-100); margin: 0.75rem 0; }
.plan-gain-title { font-size: 0.75rem; color: var(--gray-500); margin-bottom: 0.5rem; }
.plan-gain-item { display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem; margin-bottom: 0.25rem; }
.plan-gain-value { color: var(--green-600); font-weight: 600; }

/* ─── Badge Grid ────────────────────────────────────────────── */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.badge-card { text-align: center; padding: 1.5rem 1rem; }
.badge-card.earned { }
.badge-card.locked { opacity: 0.4; filter: grayscale(1); }
.badge-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.badge-name { font-size: 0.8125rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.25rem; }
.badge-desc { font-size: 0.75rem; color: var(--gray-500); }

/* ─── Stat Cards ────────────────────────────────────────────── */
.stat-card { text-align: center; padding: 1.5rem; background: var(--gray-50); border-radius: 0.75rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--gray-900); line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8125rem; color: var(--gray-500); font-weight: 500; }

/* ─── Level Circle ──────────────────────────────────────────── */
.level-circle {
  width: 5rem; height: 5rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--purple-600));
  display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem;
}
.level-circle span { font-size: 2rem; font-weight: 800; color: #fff; }

/* ─── Alert Card ────────────────────────────────────────────── */
.alert-card { border-left: 4px solid var(--red-500); }
.alert-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; }
.alert-student { font-weight: 700; color: var(--gray-900); }
.alert-severity { font-size: 0.75rem; color: var(--gray-400); }
.alert-details { font-size: 0.8125rem; color: var(--gray-600); }

/* ─── Schedule Card ─────────────────────────────────────────── */
.schedule-day { border: 1px solid var(--gray-200); border-radius: 0.75rem; padding: 1rem; }
.schedule-day-title { font-size: 0.875rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.75rem; }
.schedule-task { font-size: 0.8125rem; margin-bottom: 0.75rem; }
.schedule-task:last-child { margin-bottom: 0; }
.schedule-task-time { font-size: 0.75rem; color: var(--gray-400); min-width: 3rem; }
.schedule-task-row { display: flex; align-items: center; gap: 0.5rem; }
.schedule-task-name { color: var(--gray-700); }
.schedule-task-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.schedule-task-type { font-size: 0.6875rem; }
.schedule-task-dur { font-size: 0.6875rem; color: var(--gray-400); }

/* ─── Landing ───────────────────────────────────────────────── */
.landing {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand-900), var(--brand-800), #3730a3);
}
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 2rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.landing-nav-brand { display: flex; align-items: center; gap: 0.5rem; }
.landing-nav-brand span:first-child { font-size: 1.75rem; }
.landing-nav-brand span:last-child { font-size: 1.25rem; font-weight: 800; color: #fff; }
.landing-nav-links { display: flex; align-items: center; gap: 1rem; }
.landing-nav-link { color: rgba(255,255,255,0.7); font-size: 0.875rem; font-weight: 500; transition: color 0.15s; }
.landing-nav-link:hover { color: #fff; }
.landing-cta { background: #fff; color: var(--brand-900); padding: 0.625rem 1.25rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 700; transition: background 0.15s; }
.landing-cta:hover { background: var(--brand-50); }
.landing-hero { max-width: 72rem; margin: 0 auto; padding: 6rem 2rem 8rem; text-align: center; }
.landing-hero h1 { font-size: 3rem; font-weight: 800; color: #fff; line-height: 1.15; margin-bottom: 1.5rem; }
.landing-hero h1 span { background: linear-gradient(to right, #c084fc, #f9a8d4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.landing-hero p { font-size: 1.125rem; color: rgba(255,255,255,0.6); max-width: 40rem; margin: 0 auto 2.5rem; }
.landing-hero-actions { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.landing-hero-btn { padding: 0.875rem 2rem; border-radius: 0.75rem; font-size: 1rem; font-weight: 700; }
.landing-hero-btn-primary { background: #fff; color: var(--brand-900); }
.landing-hero-btn-primary:hover { background: var(--brand-50); }
.landing-hero-btn-secondary { border: 1px solid rgba(255,255,255,0.3); color: #fff; }
.landing-hero-btn-secondary:hover { background: rgba(255,255,255,0.1); }
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; max-width: 64rem; margin: 0 auto; padding: 0 2rem; }
.landing-feature { background: rgba(255,255,255,0.08); backdrop-filter: blur(8px); border-radius: 0.75rem; padding: 1.5rem; border: 1px solid rgba(255,255,255,0.08); transition: background 0.15s; }
.landing-feature:hover { background: rgba(255,255,255,0.12); }
.landing-feature-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; }
.landing-feature h3 { font-size: 1.125rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }
.landing-feature p { font-size: 0.875rem; color: rgba(255,255,255,0.5); }

/* ─── Utilities ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; }
.p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-900 { color: var(--gray-900); }
.text-brand-600 { color: var(--brand-600); }
.text-green-600 { color: var(--green-600); }
.text-white { color: #fff; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .main-content, .main-content-wide { margin-left: 220px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content, .main-content-wide { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .streak-bar { flex-direction: column; gap: 1rem; }
  .streak-bar-stats { flex-wrap: wrap; justify-content: center; }
  .landing-features { grid-template-columns: 1fr; }
  .landing-hero h1 { font-size: 2rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .chat-message { max-width: 95%; }
}
