// Lumen — Mock data
const COURSES = [
  {
    id: "c1",
    title: "The Complete Course Creator OS",
    instructor: "Mara Klein",
    instructorId: "u1",
    cover: "linear-gradient(135deg, #FF5C28 0%, #B91C1C 100%)",
    pattern: "circles",
    price: 297,
    students: 4218,
    rating: 4.8,
    reviews: 412,
    progress: 64,
    lessonsTotal: 42,
    lessonsCompleted: 27,
    duration: "11h 24m",
    category: "Business",
    description: "The end-to-end system Mara used to scale from $0 to $1.4M ARR in 18 months — frameworks, templates, and weekly office hours.",
    modules: [
      { id: "m1", title: "Welcome & framing", lessons: [
        { id: "l1", title: "How this course works", type: "video", duration: "4:12", done: true, free: true },
        { id: "l2", title: "Your creator OS, in one diagram", type: "video", duration: "8:36", done: true },
        { id: "l3", title: "Workbook: define your wedge", type: "text", duration: "12 min read", done: true },
      ]},
      { id: "m2", title: "Audience & positioning", lessons: [
        { id: "l4", title: "The 1,000 true fans math, redone", type: "video", duration: "12:08", done: true },
        { id: "l5", title: "Niching down without going small", type: "video", duration: "9:41", done: true },
        { id: "l6", title: "Quiz: positioning fundamentals", type: "quiz", duration: "5 q", done: true },
        { id: "l7", title: "Office hours #1 (replay)", type: "video", duration: "58:21", done: false, current: true },
      ]},
      { id: "m3", title: "Building the offer", lessons: [
        { id: "l8", title: "Offer architecture", type: "video", duration: "14:02", done: false },
        { id: "l9", title: "Pricing tiers that actually convert", type: "video", duration: "11:18", done: false },
        { id: "l10", title: "The 7-day pre-sale framework", type: "text", duration: "18 min read", done: false },
        { id: "l11", title: "Quiz: offer design", type: "quiz", duration: "8 q", done: false },
      ]},
      { id: "m4", title: "Launching", lessons: [
        { id: "l12", title: "Pre-launch sequence (templates)", type: "video", duration: "16:44", done: false, locked: true },
        { id: "l13", title: "Launch week run-of-show", type: "video", duration: "9:55", done: false, locked: true },
      ]},
    ],
  },
  {
    id: "c2",
    title: "Writing for the Internet",
    instructor: "Theo Park",
    cover: "linear-gradient(135deg, #1B3A2F 0%, #0A0A0A 100%)",
    pattern: "lines",
    price: 149,
    students: 2104,
    rating: 4.9,
    progress: 32,
    lessonsTotal: 28,
    lessonsCompleted: 9,
    duration: "6h 50m",
    category: "Writing",
  },
  {
    id: "c3",
    title: "Design Systems in Practice",
    instructor: "Ines Vaz",
    cover: "linear-gradient(135deg, #0F1729 0%, #7C5CFF 100%)",
    price: 249,
    students: 1845,
    rating: 4.7,
    progress: 88,
    lessonsTotal: 36,
    lessonsCompleted: 32,
    duration: "9h 12m",
    category: "Design",
  },
  {
    id: "c4",
    title: "Cold Email That Doesn't Suck",
    instructor: "Dev Agarwal",
    cover: "linear-gradient(135deg, #FFF8EE 0%, #C2410C 100%)",
    price: 89,
    students: 6720,
    rating: 4.6,
    progress: 0,
    lessonsTotal: 18,
    lessonsCompleted: 0,
    duration: "3h 40m",
    category: "Sales",
  },
  {
    id: "c5",
    title: "Founder Storytelling",
    instructor: "Rae Mendez",
    cover: "linear-gradient(135deg, #131313 0%, #44403C 100%)",
    price: 179,
    students: 980,
    rating: 4.9,
    progress: 12,
    lessonsTotal: 24,
    lessonsCompleted: 3,
    duration: "5h 20m",
    category: "Marketing",
  },
  {
    id: "c6",
    title: "No-Code Product Studio",
    instructor: "Owen Sato",
    cover: "linear-gradient(135deg, #EFF6FF 0%, #1D4ED8 100%)",
    price: 199,
    students: 3215,
    rating: 4.7,
    progress: 0,
    lessonsTotal: 32,
    lessonsCompleted: 0,
    duration: "8h 05m",
    category: "Tech",
  },
];

// Sample sales data
const REVENUE_30D = [3200, 4100, 3800, 4900, 5400, 4700, 5800, 6100, 5500, 6200, 6800, 7100, 6500, 7400, 8100, 7600, 8300, 8800, 8400, 9100, 9700, 9200, 10100, 9800, 10400, 11200, 10800, 11400, 12100, 11800];
const REVENUE_LABELS = Array.from({ length: 30 }, (_, i) => `Apr ${i + 3}`);

const ENROLLMENTS_12W = [124, 156, 198, 211, 245, 287, 312, 298, 356, 401, 422, 478];
const ENROLLMENT_LABELS = ["W1","W2","W3","W4","W5","W6","W7","W8","W9","W10","W11","W12"];

const FUNNEL_DATA = [
  { label: "Visitors", value: 84210 },
  { label: "Sales page views", value: 24180 },
  { label: "Started checkout", value: 4120 },
  { label: "Completed purchase", value: 1842 },
  { label: "Active after 14 days", value: 1421 },
];

const COHORT_HEATMAP = {
  rows: ["Apr · Cohort A", "Apr · Cohort B", "Mar · Cohort A", "Feb · Cohort A", "Jan · Cohort A", "Dec · Cohort A"],
  cols: ["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8"],
  data: [
    [98, 92, 84, 71, 62, null, null, null],
    [97, 90, 80, null, null, null, null, null],
    [96, 89, 82, 74, 66, 58, 52, 47],
    [97, 88, 78, 68, 60, 52, 46, 42],
    [95, 84, 72, 64, 56, 49, 43, 38],
    [94, 81, 68, 58, 51, 44, 39, 34],
  ],
};

// Recent students (instructor)
const STUDENTS = [
  { name: "Hana Yusuf", email: "hana@studio.co", course: "Course Creator OS", progress: 86, joined: "2d ago", spent: 297 },
  { name: "Marcus Boll", email: "m.boll@gmail.com", course: "Course Creator OS", progress: 64, joined: "5d ago", spent: 297 },
  { name: "Priya Iyer", email: "priya@iyer.io", course: "Writing for the Internet", progress: 41, joined: "1w ago", spent: 149 },
  { name: "Diego Santos", email: "diego@santos.com", course: "Course Creator OS", progress: 22, joined: "1w ago", spent: 297 },
  { name: "Yuki Tanaka", email: "yuki.t@hey.com", course: "Founder Storytelling", progress: 100, joined: "2w ago", spent: 179 },
  { name: "Aria Nakamura", email: "aria@nakam.dev", course: "Writing for the Internet", progress: 78, joined: "2w ago", spent: 149 },
];

// Quiz
const QUIZ = {
  title: "Module 2 · Positioning Fundamentals",
  questions: [
    {
      q: "Which of these is the strongest positioning statement?",
      options: [
        "We help everyone become a better writer.",
        "We help technical founders ship clearer launch posts in 30 minutes.",
        "We're the AI-powered, all-in-one writing platform of the future.",
        "Writing tools, but better."
      ],
      correct: 1,
      explain: "Specific buyer + specific outcome + specific time-bound — the other options are too broad or vague.",
    },
    {
      q: "What is the main risk of niching down?",
      options: [
        "You'll run out of customers immediately.",
        "Your TAM math will look smaller — and that's actually a feature, not a bug.",
        "Your messaging won't resonate.",
        "Investors will lose interest."
      ],
      correct: 1,
      explain: "A smaller, sharper TAM lets you win a beachhead. Expansion happens after you've earned the right to a bigger story.",
    },
    {
      q: "Which signal best validates a course idea before you build it?",
      options: [
        "100 newsletter subscribers.",
        "Friends saying 'sounds great!'",
        "20 strangers paying for a pre-sale or deposit.",
        "An LLM saying the topic has high demand."
      ],
      correct: 2,
      explain: "Cash on the table from strangers > vanity metrics or AI guesses, every time.",
    },
  ],
};

// Course builder modules (mutable in app state)
const BUILDER_MODULES = [
  { id: "bm1", title: "Welcome & framing", lessons: [
    { id: "bl1", title: "How this course works", type: "video", duration: "4:12" },
    { id: "bl2", title: "Your creator OS, in one diagram", type: "video", duration: "8:36" },
  ]},
  { id: "bm2", title: "Audience & positioning", lessons: [
    { id: "bl3", title: "The 1,000 true fans math, redone", type: "video", duration: "12:08" },
    { id: "bl4", title: "Niching down without going small", type: "video", duration: "9:41" },
    { id: "bl5", title: "Quiz: positioning fundamentals", type: "quiz", duration: "5 q" },
  ]},
  { id: "bm3", title: "Building the offer", lessons: [
    { id: "bl6", title: "Offer architecture", type: "video", duration: "14:02" },
    { id: "bl7", title: "Pricing tiers that convert", type: "video", duration: "11:18" },
  ]},
];

// Watch heatmap (lesson seconds)
function genWatchHeat(len = 240) {
  const arr = [];
  for (let i = 0; i < len; i++) {
    let v = 0.5 + 0.4 * Math.sin(i / 18);
    if (i > 30 && i < 50) v += 0.3;
    if (i > 110 && i < 130) v += 0.45;
    if (i > 200) v -= 0.4;
    arr.push(Math.max(0.05, Math.min(1, v + (Math.random() - 0.5) * 0.1)));
  }
  return arr;
}

window.LUMEN_DATA = {
  COURSES, REVENUE_30D, REVENUE_LABELS, ENROLLMENTS_12W, ENROLLMENT_LABELS,
  FUNNEL_DATA, COHORT_HEATMAP, STUDENTS, QUIZ, BUILDER_MODULES, genWatchHeat
};
