anycoder-2bda4721 / index.html
badvillesaint's picture
Upload folder using huggingface_hub
3613e52 verified
Raw History Blame Contribute Delete
41.8 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kruu | Premium Experiential Learning</title>
<!-- Libraries -->
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1"></script>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#FF6B35', // Orange/Coral
secondary: '#0066FF', // Electric Blue
success: '#16A34A', // Green
muted: '#666',
dark: '#111',
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
}
}
}
}
</script>
<style>
body { font-family: 'Inter', sans-serif; background-color: #f8f9fa; }
.fade-in { animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #FF6B35; }
/* Checkmark Animation */
.checkmark-animate { stroke-dasharray: 100; stroke-dashoffset: 100; animation: dash 0.6s ease-in-out forwards; }
@keyframes dash { to { stroke-dashoffset: 0; } }
/* Locked State */
.locked { opacity: 0.6; filter: grayscale(100%); transition: all 0.3s; }
/* Active State */
.active-milestone { border-left: 4px solid #FF6B35; background: #fff5f0; }
/* Glassmorphism */
.glass { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); }
/* Button Pulse */
.btn-pulse:hover { transform: scale(1.02); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
</style>
</head>
<body class="text-dark antialiased">
<!-- Top Navigation / Header -->
<header id="app-header" class="fixed w-full top-0 z-50 glass border-b border-gray-100 h-16 flex items-center justify-between px-6">
<div class="flex items-center gap-4">
<div onclick="navigate('landing')" class="font-bold text-2xl tracking-tighter cursor-pointer">
<span class="text-primary">K</span>ruu<span class="text-secondary">.</span>
</div>
<div id="nav-links" class="hidden md:flex gap-6 text-sm font-semibold text-muted">
<a href="#" onclick="navigate('catalog')" class="hover:text-primary transition">Projects</a>
<a href="#" onclick="navigate('sessions')" class="hover:text-primary transition">Live Sessions</a>
<a href="#" onclick="navigate('profile')" class="hover:text-primary transition">Profile</a>
</div>
</div>
<div class="flex items-center gap-4">
<div class="hidden md:flex items-center gap-2">
<span class="text-xs font-bold uppercase text-muted">Built with</span>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="text-xs font-bold text-primary underline hover:text-secondary">Anycoder</a>
</div>
<button id="auth-btn" onclick="navigate('auth')" class="bg-primary text-white px-5 py-2 rounded-full font-bold text-sm hover:bg-orange-600 transition btn-pulse">
Sign In
</button>
</div>
</header>
<!-- Main Content Area -->
<main id="app-container" class="min-h-screen pt-16">
<!-- Views will be injected here -->
</main>
<!-- Bottom Navigation (Mobile) -->
<nav id="mobile-nav" class="hidden fixed bottom-0 w-full bg-white border-t border-gray-200 h-16 flex justify-around items-center z-50">
<button onclick="navigate('dashboard')" class="flex flex-col items-center text-muted hover:text-primary">
<i class="fas fa-home text-lg"></i>
<span class="text-xs mt-1">Home</span>
</button>
<button onclick="navigate('catalog')" class="flex flex-col items-center text-muted hover:text-primary">
<i class="fas fa-layer-group text-lg"></i>
<span class="text-xs mt-1">Explore</span>
</button>
<button onclick="navigate('sessions')" class="flex flex-col items-center text-muted hover:text-primary">
<i class="fas fa-video text-lg"></i>
<span class="text-xs mt-1">Sessions</span>
</button>
<button onclick="navigate('profile')" class="flex flex-col items-center text-muted hover:text-primary">
<i class="fas fa-user text-lg"></i>
<span class="text-xs mt-1">Profile</span>
</button>
</nav>
<!-- Application Logic -->
<script>
// --- MOCK DATA ---
const DATA = {
user: {
name: "Aryan",
grade: "11th",
score: 850,
subjects: ["STEM", "Business"],
activeProjectId: "p1",
completedProjects: ["p2"]
},
projects: [
{
id: "p1",
title: "Energy Management",
category: "STEM",
expert: "Dr. Gautam Natarajan",
university: "Syracuse University USA",
image: "https://images.unsplash.com/photo-1473341304170-971dccb5ac1e?ixlib=auto&format=fit&w=1280&q=80",
duration: "8 Weeks",
difficulty: "Intermediate",
milestones: 4,
status: "active", // active, completed
currentMilestone: 2
},
{
id: "p2",
title: "Digital Detectives",
category: "Business",
expert: "Prof. Maya Chen",
university: "National University of Singapore",
image: "https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=auto&format=fit&w=1280&q=80",
duration: "6 Weeks",
difficulty: "Advanced",
milestones: 4,
status: "completed",
currentMilestone: 4
},
{
id: "p3",
title: "Civic Superheroes",
category: "Humanities",
expert: "Dr. Elena Ramirez",
university: "University of Barcelona",
image: "https://images.unsplash.com/photo-1532629345140-6c5a3a70d40a?ixlib=auto&format=fit&w=1280&q=80",
duration: "5 Weeks",
difficulty: "Beginner",
milestones: 4,
status: "locked",
currentMilestone: 0
},
{
id: "p4",
title: "Clean Air at Home",
category: "STEM",
expert: "Dr. Gautam Natarajan",
university: "Syracuse University USA",
image: "https://images.unsplash.com/photo-1601933973783-59cf35a97d5b?ixlib=auto&format=fit&w=1280&q=80",
duration: "4 Weeks",
difficulty: "Beginner",
milestones: 4,
status: "locked",
currentMilestone: 0
}
],
sessions: [
{ id: "s1", title: "Energy Grid Analysis", expert: "Dr. Gautam", date: "Oct 24, 4:00 PM", status: "upcoming" },
{ id: "s2", title: "Market Trends", expert: "Prof. Maya", date: "Oct 26, 2:00 PM", status: "upcoming" },
{ id: "s3", title: "Previous Session: Intro", date: "Oct 10", status: "past", link: "#" }
]
};
// --- STATE MANAGEMENT ---
let state = {
route: 'landing',
projectView: null, // For inner project view
milestoneView: null, // For specific milestone content
activityView: null, // For specific activity content
completedActivities: {} // Map of activityId -> boolean
};
// --- CORE FUNCTIONS ---
function navigate(route, params = {}) {
state.route = route;
state.projectView = params.projectId || null;
state.milestoneView = params.milestone || null;
state.activityView = params.activity || null;
// Reset auth button text if logged in (simulated)
if(route !== 'auth' && route !== 'landing') {
document.getElementById('auth-btn').innerHTML = `<i class="fas fa-user-circle mr-2"></i>${DATA.user.name}`;
document.getElementById('nav-links').classList.remove('hidden');
document.getElementById('mobile-nav').classList.remove('hidden');
} else {
document.getElementById('auth-btn').innerHTML = "Sign In";
document.getElementById('nav-links').classList.add('hidden');
document.getElementById('mobile-nav').classList.add('hidden');
}
render();
}
function render() {
const container = document.getElementById('app-container');
container.innerHTML = ''; // Clear
// View Routing
switch(state.route) {
case 'landing': renderLanding(container); break;
case 'auth': renderAuth(container); break;
case 'subscription': renderSubscription(container); break;
case 'dashboard': renderDashboard(container); break;
case 'catalog': renderCatalog(container); break;
case 'project-detail': renderProjectDetail(container, state.projectView); break;
case 'project-inner': renderProjectInner(container, state.projectView); break;
case 'sessions': renderSessions(container); break;
case 'certificates': renderCertificates(container); break;
case 'profile': renderProfile(container); break;
default: renderLanding(container);
}
}
// --- COMPONENTS ---
// 1. LANDING PAGE
function renderLanding(container) {
const html = `
<div class="fade-in">
<!-- Hero -->
<section class="relative py-20 lg:py-30 px-6 bg-white overflow-hidden">
<div class="max-w-7xl mx-auto grid lg:grid-cols-2 gap-12 items-center">
<div class="space-y-6">
<span class="inline-block px-3 py-1 bg-secondary text-white text-xs font-bold rounded-full uppercase tracking-wide">Premium Learning</span>
<h1 class="text-5xl lg:text-7xl font-extrabold text-dark leading-[1.1]">
Learn By Doing. <br>
<span class="text-primary">With The World's Best.</span>
</h1>
<p class="text-xl text-muted max-w-lg">
Stop watching tutorials. Start building real projects guided by global university experts. Milestone-based, structured, and rigorous.
</p>
<div class="flex gap-4 mt-8">
<button onclick="navigate('auth')" class="bg-primary text-white px-8 py-4 rounded-full font-bold text-lg hover:bg-orange-600 transition btn-pulse shadow-lg shadow-orange-200">
Start Learning Free
</button>
<button onclick="navigate('catalog')" class="bg-white text-dark border border-gray-200 px-8 py-4 rounded-full font-bold text-lg hover:bg-gray-50 transition">
Explore Projects
</button>
</div>
</div>
<div class="relative">
<img src="https://images.unsplash.com/photo-1523240795619-30d0893e9bdd?ixlib=auto&format=fit&w=800&q=80" class="rounded-2xl shadow-2xl rotate-3 hover:rotate-0 transition duration-500" alt="Students">
<div class="absolute -bottom-6 -left-6 bg-white p-4 rounded-xl shadow-xl border border-gray-100">
<div class="flex items-center gap-3">
<div class="bg-success text-white p-2 rounded-lg"><i class="fas fa-check"></i></div>
<div>
<p class="font-bold text-dark">Project Completed</p>
<p class="text-xs text-muted">Energy Management</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- How It Works -->
<section class="py-20 bg-gray-50">
<div class="max-w-7xl mx-auto px-6">
<div class="grid md:grid-cols-3 gap-8">
<div class="p-6 bg-white rounded-2xl shadow-sm border border-gray-100">
<div class="w-12 h-12 bg-primary text-white rounded-full flex items-center justify-center font-bold text-xl mb-4">1</div>
<h3 class="font-bold text-2xl mb-2">Join</h3>
<p class="text-muted">Subscribe to access the full library of expert-led projects.</p>
</div>
<div class="p-6 bg-white rounded-2xl shadow-sm border border-gray-100">
<div class="w-12 h-12 bg-secondary text-white rounded-full flex items-center justify-center font-bold text-xl mb-4">2</div>
<h3 class="font-bold text-2xl mb-2">Learn</h3>
<p class="text-muted">Follow structured milestones. Unlock activities sequentially.</p>
</div>
<div class="p-6 bg-white rounded-2xl shadow-sm border border-gray-100">
<div class="w-12 h-12 bg-success text-white rounded-full flex items-center justify-center font-bold text-xl mb-4">3</div>
<h3 class="font-bold text-2xl mb-2">Build</h3>
<p class="text-muted">Complete real-world submissions and get certified.</p>
</div>
</div>
</div>
</section>
</div>
`;
container.innerHTML = html;
}
// 2. AUTH PAGE
function renderAuth(container) {
const html = `
<div class="fade-in max-w-md mx-auto py-20 px-6">
<div class="bg-white p-8 rounded-2xl shadow-xl border border-gray-100">
<h2 class="text-3xl font-bold mb-6 text-center">Create Account</h2>
<form onsubmit="handleSignup(event)" class="space-y-4">
<input type="text" placeholder="Full Name" class="w-full p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary" required>
<input type="email" placeholder="Email" class="w-full p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary" required>
<input type="password" placeholder="Password" class="w-full p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary" required>
<div class="grid grid-cols-2 gap-4">
<select class="w-full p-3 border border-gray-200 rounded-lg bg-white">
<option>Grade 9</option><option>Grade 10</option><option>Grade 11</option><option>Grade 12</option>
</select>
<select class="w-full p-3 border border-gray-200 rounded-lg bg-white">
<option>STEM</option><option>Business</option><option>Arts</option>
</select>
</div>
<button type="submit" class="w-full bg-primary text-white font-bold py-3 rounded-lg hover:bg-orange-600 transition">Sign Up</button>
<p class="text-center text-xs text-muted mt-4">Already have an account? <a href="#" class="text-primary">Login</a></p>
</form>
</div>
</div>
`;
container.innerHTML = html;
}
function handleSignup(e) {
e.preventDefault();
navigate('subscription');
}
// 3. SUBSCRIPTION PAGE
function renderSubscription(container) {
const html = `
<div class="fade-in max-w-4xl mx-auto py-20 px-6">
<h2 class="text-4xl font-bold text-center mb-12">Choose Your Plan</h2>
<div class="grid md:grid-cols-2 gap-8">
<!-- Monthly -->
<div class="bg-white p-8 rounded-2xl border border-gray-200 hover:shadow-xl transition">
<h3 class="text-2xl font-bold">Monthly</h3>
<p class="text-4xl font-bold text-primary mt-2">$29<span class="text-sm text-muted">/mo</span></p>
<ul class="mt-6 space-y-3 text-muted">
<li><i class="fas fa-check text-success mr-2"></i> Unlimited Projects</li>
<li><i class="fas fa-check text-success mr-2"></i> Live Sessions</li>
<li><i class="fas fa-check text-success mr-2"></i> Community Access</li>
</ul>
<button onclick="triggerConfetti(); navigate('dashboard')" class="w-full mt-8 bg-gray-100 text-dark font-bold py-3 rounded-lg hover:bg-gray-200">Select Monthly</button>
</div>
<!-- Annual -->
<div class="bg-dark text-white p-8 rounded-2xl relative overflow-hidden">
<div class="absolute top-0 right-0 bg-secondary text-white text-xs font-bold px-3 py-1 rounded-bl-lg">Save 30%</div>
<h3 class="text-2xl font-bold">Annual</h3>
<p class="text-4xl font-bold text-primary mt-2">$249<span class="text-sm text-gray-400">/yr</span></p>
<ul class="mt-6 space-y-3 text-gray-300">
<li><i class="fas fa-check text-success mr-2"></i> Unlimited Projects</li>
<li><i class="fas fa-check text-success mr-2"></i> Priority Support</li>
<li><i class="fas fa-check text-success mr-2"></i> Exclusive Workshops</li>
</ul>
<button onclick="triggerConfetti(); navigate('dashboard')" class="w-full mt-8 bg-primary text-white font-bold py-3 rounded-lg hover:bg-orange-600 btn-pulse">Select Annual</button>
</div>
</div>
</div>
`;
container.innerHTML = html;
}
// 4. DASHBOARD
function renderDashboard(container) {
const user = DATA.user;
const activeProj = DATA.projects.find(p => p.id === user.activeProjectId);
const html = `
<div class="fade-in max-w-7xl mx-auto px-6 py-10">
<header class="mb-10">
<h1 class="text-3xl font-bold text-dark">Hey ${user.name}, ready to build something amazing today?</h1>
<p class="text-muted">Let's continue your journey.</p>
</header>
<!-- Active Project Hero -->
<div class="bg-white rounded-2xl p-8 shadow-sm border border-gray-100 mb-12 relative overflow-hidden">
<div class="absolute top-0 right-0 w-32 h-32 bg-primary opacity-10 rounded-full -mr-10 -mt-10"></div>
<div class="grid md:grid-cols-3 gap-8">
<div class="md:col-span-2">
<span class="text-xs font-bold text-secondary uppercase tracking-wider">CURRENT PROJECT</span>
<h2 class="text-3xl font-bold mt-2">${activeProj.title}</h2>
<p class="text-muted mt-2">Milestone ${activeProj.currentMilestone} of 4 active. Next up: Worksheet Submission.</p>
<button onclick="navigate('project-inner', { projectId: activeProj.id })" class="mt-6 bg-primary text-white px-6 py-3 rounded-lg font-bold hover:bg-orange-600">Continue Learning</button>
</div>
<div class="bg-gray-50 p-4 rounded-xl flex flex-col justify-center">
<div class="flex justify-between mb-2">
<span class="font-bold">Progress</span>
<span class="text-primary font-bold">45%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-primary h-2 rounded-full" style="width: 45%"></div>
</div>
<div class="mt-4 text-xs text-muted">
<i class="fas fa-clock mr-1"></i> 2h remaining this week
</div>
</div>
</div>
</div>
<!-- Grid Layout -->
<div class="grid lg:grid-cols-3 gap-8">
<!-- Featured Projects -->
<div class="lg:col-span-2">
<h3 class="font-bold text-xl mb-4">Explore More</h3>
<div class="grid md:grid-cols-2 gap-4">
${DATA.projects.filter(p => p.id !== activeProj.id).map(p => renderProjectCard(p)).join('')}
</div>
</div>
<!-- Upcoming Sessions -->
<div class="bg-white p-6 rounded-2xl border border-gray-100 h-fit">
<h3 class="font-bold text-xl mb-4">Live Sessions</h3>
<div class="space-y-4">
${DATA.sessions.filter(s => s.status === 'upcoming').map(s => `
<div class="flex items-start gap-3 pb-3 border-b border-gray-100">
<div class="bg-secondary text-white text-xs font-bold px-2 py-1 rounded">
${s.date.split(',')[0]}
</div>
<div>
<p class="font-bold text-sm">${s.title}</p>
<p class="text-xs text-muted">${s.expert} • ${s.date.split(',')[1]}</p>
</div>
</div>
`).join('')}
</div>
</div>
</div>
</div>
`;
container.innerHTML = html;
}
// 5. PROJECT CATALOG
function renderCatalog(container) {
const html = `
<div class="fade-in max-w-7xl mx-auto px-6 py-10">
<div class="flex flex-col md:flex-row justify-between items-end mb-8 gap-4">
<h1 class="text-4xl font-bold">Project Catalog</h1>
<div class="flex gap-2">
<select class="p-2 border rounded-lg bg-white text-sm"><option>All Subjects</option><option>STEM</option><option>Business</option></select>
<select class="p-2 border rounded-lg bg-white text-sm"><option>Difficulty</option><option>Beginner</option><option>Advanced</option></select>
</div>
</div>
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
${DATA.projects.map(p => renderProjectCard(p)).join('')}
</div>
</div>
`;
container.innerHTML = html;
}
// Component: Project Card
function renderProjectCard(project) {
const isLocked = project.status === 'locked';
const isCompleted = project.status === 'completed';
let badge = '';
if(isLocked) badge = '<span class="absolute top-4 right-4 bg-gray-200 text-gray-600 text-xs px-2 py-1 rounded"><i class="fas fa-lock"></i> Locked</span>';
if(isCompleted) badge = '<span class="absolute top-4 right-4 bg-success text-white text-xs px-2 py-1 rounded"><i class="fas fa-check"></i> Done</span>';
if(project.id === DATA.user.activeProjectId) badge = '<span class="absolute top-4 right-4 bg-primary text-white text-xs px-2 py-1 rounded">Active</span>';
return `
<div onclick="navigate('project-detail', { projectId: ${project.id} })" class="bg-white rounded-xl overflow-hidden border border-gray-100 hover:shadow-lg transition cursor-pointer group relative">
<div class="h-48 overflow-hidden relative">
<img src="${project.image}" class="w-full h-full object-cover group-hover:scale-105 transition duration-500">
${badge}
<div class="absolute bottom-2 left-2 bg-white/90 px-2 py-1 rounded text-xs font-bold text-dark">${project.category}</div>
</div>
<div class="p-5">
<h3 class="font-bold text-lg leading-tight mb-1">${project.title}</h3>
<p class="text-xs text-muted mb-3">${project.expert} • ${project.university}</p>
<div class="flex items-center gap-4 text-xs text-muted border-t border-gray-100 pt-3">
<span><i class="fas fa-clock"></i> ${project.duration}</span>
<span><i class="fas fa-layer-group"></i> ${project.milestones} Milestones</span>
</div>
</div>
</div>
`;
}
// 6. PROJECT DETAIL PAGE
function renderProjectDetail(container, id) {
const project = DATA.projects.find(p => p.id === id);
const html = `
<div class="fade-in max-w-6xl mx-auto px-6 py-10">
<div class="grid lg:grid-cols-2 gap-12">
<!-- Left: Structure -->
<div>
<span class="text-secondary font-bold text-sm uppercase tracking-wider mb-2 block">Curriculum Structure</span>
<div class="space-y-4">
${[1,2,3,4].map(m => `
<div class="flex items-center gap-4 p-4 bg-white rounded-xl border border-gray-100">
<div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center font-bold text-sm text-muted">${m}</div>
<div>
<h4 class="font-bold">Milestone ${m}</h4>
<p class="text-xs text-muted">Foundational Concepts & Application</p>
</div>
<i class="fas fa-chevron-right text-muted"></i>
</div>
`).join('')}
</div>
</div>
<!-- Right: Info -->
<div class="space-y-6">
<img src="${project.image}" class="w-full rounded-2xl shadow-lg">
<h1 class="text-4xl font-bold mt-6">${project.title}</h1>
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-gray-200 rounded-full"></div>
<div>
<p class="font-bold">${project.expert}</p>
<p class="text-xs text-muted">${project.university}</p>
</div>
</div>
<p class="text-muted leading-relaxed">
In this project, you will tackle real-world problems using industry-standard tools.
You will move from theory to practice, submitting worksheets and interacting with peers.
</p>
<div class="flex gap-2 mt-4">
<span class="px-3 py-1 bg-gray-100 rounded text-xs font-bold">Python</span>
<span class="px-3 py-1 bg-gray-100 rounded text-xs font-bold">Data Analysis</span>
<span class="px-3 py-1 bg-gray-100 rounded text-xs font-bold">Research</span>
</div>
<button onclick="navigate('project-inner', { projectId: project.id })" class="w-full bg-primary text-white font-bold py-4 rounded-xl mt-8 hover:bg-orange-600 btn-pulse shadow-lg">
${project.status === 'locked' ? 'Enroll Now' : 'Continue Project'}
</button>
</div>
</div>
</div>
`;
container.innerHTML = html;
}
// 7. PROJECT INNER PAGE (CORE ENGINE)
function renderProjectInner(container, id) {
const project = DATA.projects.find(p => p.id === id);
// Mock activities for Milestone 2
const activities = [
{ id: 'a1', title: 'Learning Resource: Grid Basics', type: 'video', completed: true },
{ id: 'a2', title: 'Quiz: Fundamentals', type: 'quiz', completed: false },
{ id: 'a3', title: 'Worksheet: Data Collection', type: 'submit', completed: false },
{ id: 'a4', title: 'Live Session: Analysis', type: 'live', completed: false }
];
const html = `
<div class="fade-in flex flex-col lg:flex-row min-h-screen bg-white">
<!-- Sidebar (Milestones) -->
<div class="lg:w-80 bg-gray-50 border-r border-gray-200 p-6 flex flex-col">
<div class="mb-8">
<h2 class="font-bold text-lg truncate">${project.title}</h2>
<p class="text-xs text-muted">Milestone ${project.currentMilestone} Active</p>
</div>
<div class="space-y-2">
${[1,2,3,4].map(m => {
const isActive = m === project.currentMilestone;
const isLocked = m > project.currentMilestone;
const isDone = m < project.currentMilestone;
let icon = 'fa-lock';
let color = 'text-gray-400';
let bg = 'bg-gray-100';
if(isActive) { icon = 'fa-play'; color = 'text-primary'; bg = 'bg-white border-primary'; }
if(isDone) { icon = 'fa-check'; color = 'text-success'; bg = 'bg-success'; }
return `
<div class="p-3 rounded-lg ${isActive ? 'active-milestone shadow-sm' : (isLocked ? 'locked' : 'bg-white')} flex items-center gap-3 cursor-pointer">
<div class="${bg} w-8 h-8 rounded-full flex items-center justify-center text-white ${color}">
<i class="fas ${icon}"></i>
</div>
<span class="font-bold text-sm">Milestone ${m}</span>
</div>
`
}).join('')}
</div>
<div class="mt-auto pt-6 border-t border-gray-200">
<div class="flex justify-between text-xs font-bold mb-1">
<span>Total Progress</span>
<span>45%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-primary h-2 rounded-full" style="width: 45%"></div>
</div>
</div>
</div>
<!-- Main Content (Activities) -->
<div class="flex-1 p-8 lg:p-12 overflow-y-auto">
<div class="max-w-3xl">
<h1 class="text-3xl font-bold mb-6">Milestone 2: Analysis & Strategy</h1>
<div class="space-y-6">
${activities.map((act, index) => {
// Logic: Unlock if previous is completed or if this is the first
const prevCompleted = index === 0 ? true : activities[index-1].completed;
const isLocked = !prevCompleted && !act.completed;
return `
<div class="bg-white border border-gray-200 rounded-xl p-6 flex items-between gap-4 ${isLocked ? 'locked bg-gray-50' : 'shadow-sm'}">
<div class="flex-1">
<div class="flex items-center gap-3 mb-2">
<span class="text-xs font-bold uppercase text-muted bg-gray-100 px-2 py-1 rounded">${act.type}</span>
<h3 class="font-bold text-lg">${act.title}</h3>
</div>
<p class="text-muted text-sm">Complete this activity to unlock the next step in your learning journey.</p>
</div>
<div>
${act.completed ?
`<div class="text-success font-bold flex items-center gap-2"><i class="fas fa-check-circle"></i> Completed</div>` :
(isLocked ?
`<button disabled class="bg-gray-200 text-gray-400 px-4 py-2 rounded-lg font-bold"><i class="fas fa-lock"></i> Locked</button>` :
`<button onclick="completeActivity('${act.id}', ${index})" class="bg-secondary text-white px-4 py-2 rounded-lg font-bold hover:bg-blue-700 transition">Start Activity</button>`
)
}
</div>
</div>
`
}).join('')}
</div>
</div>
</div>
</div>
`;
container.innerHTML = html;
}
// 8. LIVE SESSIONS
function renderSessions(container) {
const html = `
<div class="fade-in max-w-5xl mx-auto px-6 py-10">
<h1 class="text-3xl font-bold mb-8">Live Sessions</h1>
<div class="grid md:grid-cols-2 gap-6">
${DATA.sessions.map(s => `
<div class="bg-white p-6 rounded-xl border border-gray-100 flex flex-col justify-between">
<div>
<span class="text-xs font-bold text-secondary uppercase">${s.status}</span>
<h3 class="font-bold text-xl mt-2">${s.title}</h3>
<p class="text-muted text-sm mt-1">${s.expert}</p>
<p class="text-dark font-bold mt-4"><i class="far fa-calendar-alt mr-2"></i>${s.date}</p>
</div>
<button class="mt-4 w-full bg-gray-100 text-dark font-bold py-2 rounded hover:bg-gray-200">
${s.status === 'past' ? 'Watch Recording' : 'Join Session'}
</button>
</div>
`).join('')}
</div>
</div>
`;
container.innerHTML = html;
}
// 9. CERTIFICATES
function renderCertificates(container) {
const completedIds = DATA.user.completedProjects;
const certs = DATA.projects.filter(p => completedIds.includes(p.id));
const html = `
<div class="fade-in max-w-5xl mx-auto px-6 py-10">
<h1 class="text-3xl font-bold mb-8">My Certificates</h1>
<div class="grid md:grid-cols-2 gap-6">
${certs.map(c => `
<div class="bg-white p-6 rounded-xl border border-gray-100 relative overflow-hidden">
<div class="absolute top-0 right-0 w-20 h-20 bg-success opacity-10 rounded-bl-full"></div>
<h3 class="font-bold text-xl">${c.title}</h3>
<p class="text-muted text-sm mb-4">Verified by ${c.expert}</p>
<div class="flex items-center justify-between mt-4">
<span class="text-xs text-muted">Completed: Oct 2023</span>
<button class="text-primary font-bold text-sm hover:underline">Download PDF</button>
</div>
</div>
`).join('')}
</div>
</div>
`;
container.innerHTML = html;
}
// 10. PROFILE
function renderProfile(container) {
const user = DATA.user;
const html = `
<div class="fade-in max-w-4xl mx-auto px-6 py-10">
<div class="bg-white rounded-2xl p-8 border border-gray-100 flex flex-col md:flex-row gap-8 items-center md:items-start">
<div class="w-24 h-24 bg-gray-200 rounded-full flex items-center justify-center text-4xl text-muted">
<i class="fas fa-user"></i>
</div>
<div class="flex-1 text-center md:text-left">
<h1 class="text-3xl font-bold">${user.name}</h1>
<p class="text-muted">Grade ${user.grade} • ${user.subjects.join(', ')}</p>
<div class="mt-4 flex gap-4 justify-center md:justify-start">
<div class="bg-primary text-white px-4 py-2 rounded-lg font-bold">
Score: ${user.score}
</div>
<div class="bg-gray-100 px-4 py-2 rounded-lg font-bold">
Projects: ${DATA.user.completedProjects.length + (DATA.user.activeProjectId ? 1 : 0)}
</div>
</div>
</div>
<button class="border border-gray