File size: 29,165 Bytes
a2a4fa2
3979311
a2a4fa2
 
3979311
 
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3979311
a2a4fa2
 
3979311
 
 
 
 
 
 
 
 
a2a4fa2
 
3979311
a2a4fa2
 
 
 
 
 
 
 
 
 
3979311
 
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9fef5b9
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3979311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3979311
 
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3979311
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3979311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3979311
 
 
 
 
 
 
 
 
 
a2a4fa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
import React, { useState } from 'react';
import { ChevronRight, Play, Download, Users, Clock, DollarSign, CheckCircle, Loader, Zap, BookOpen, Code, Mic, AlertCircle, Settings } from 'lucide-react';

const WorkshopGenerator = () => {
  const [currentStep, setCurrentStep] = useState('setup');
  const [apiKey, setApiKey] = useState('');
  const [workshopData, setWorkshopData] = useState({
    topic: '',
    audience: '',
    duration: '90',
    difficulty: 'intermediate'
  });
  const [generatedContent, setGeneratedContent] = useState(null);
  const [isGenerating, setIsGenerating] = useState(false);
  const [activeAgent, setActiveAgent] = useState('');
  const [error, setError] = useState('');

  const agents = [
    { id: 'topic', name: 'Topic Agent', icon: BookOpen, description: 'Analyzing topic and creating learning path' },
    { id: 'content', name: 'Content Agent', icon: Users, description: 'Writing module scripts and speaker notes' },
    { id: 'slide', name: 'Slide Agent', icon: Play, description: 'Generating presentation slides' },
    { id: 'code', name: 'Code Agent', icon: Code, description: 'Creating hands-on exercises' }
  ];

  // Real Claude API call function with proper authentication
  const callClaudeAPI = async (prompt, maxTokens = 2000) => {
    try {
      const headers = {
        "Content-Type": "application/json",
      };

      // Add API key for external deployment, or use built-in access for Claude.ai
      if (apiKey && apiKey.startsWith('sk-ant-')) {
        headers["x-api-key"] = apiKey;
      }

      const response = await fetch("https://api.anthropic.com/v1/messages", {
        method: "POST",
        headers: headers,
        body: JSON.stringify({
          model: "claude-sonnet-4-20250514",
          max_tokens: maxTokens,
          messages: [
            { role: "user", content: prompt }
          ]
        })
      });

      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`API request failed: ${response.status} - ${errorText}`);
      }

      const data = await response.json();
      return data.content[0].text;
    } catch (error) {
      console.error("Claude API Error:", error);
      throw error;
    }
  };

  // Topic Agent - Creates learning outline
  const topicAgent = async (topic, audience, duration, difficulty) => {
    const prompt = `You are an expert corporate trainer creating a workshop outline.

Topic: ${topic}
Audience: ${audience}
Duration: ${duration} minutes
Difficulty: ${difficulty}

Create a comprehensive workshop structure. Respond ONLY with valid JSON in this exact format:

{
  "title": "Workshop title",
  "objective": "Main learning objective",
  "modules": [
    {
      "name": "Module 1 name",
      "duration": 20,
      "objectives": ["objective 1", "objective 2"],
      "key_points": ["point 1", "point 2", "point 3"]
    }
  ],
  "target_outcomes": ["outcome 1", "outcome 2"],
  "prerequisites": ["prereq 1", "prereq 2"],
  "difficulty_level": "${difficulty}"
}

DO NOT include any text outside the JSON structure.`;

    return await callClaudeAPI(prompt, 1500);
  };

  // Content Agent - Creates detailed content
  const contentAgent = async (topicStructure, topic, audience) => {
    const prompt = `You are a corporate training content writer. Create detailed workshop content based on this structure:

${topicStructure}

Topic: ${topic}
Audience: ${audience}

Generate comprehensive content. Respond ONLY with valid JSON:

{
  "speaker_notes": {
    "introduction": "Detailed intro script with talking points",
    "modules": [
      {
        "module_name": "Name",
        "opening": "Module opening script",
        "main_content": "Detailed teaching content with examples",
        "activities": "Instructions for hands-on activities",
        "closing": "Module wrap-up and transition"
      }
    ],
    "conclusion": "Workshop conclusion script"
  },
  "participant_materials": {
    "worksheets": ["Worksheet 1 description", "Worksheet 2 description"],
    "reference_guides": ["Guide 1 content outline", "Guide 2 content outline"]
  },
  "assessment": {
    "quiz_questions": [
      {
        "question": "Question text",
        "type": "multiple_choice",
        "options": ["A", "B", "C", "D"],
        "correct_answer": "A",
        "explanation": "Why this is correct"
      }
    ]
  }
}

DO NOT include any text outside the JSON structure.`;

    return await callClaudeAPI(prompt, 3000);
  };

  // Slide Agent - Creates presentation structure
  const slideAgent = async (contentData, topic) => {
    const prompt = `You are a presentation designer. Create a professional slide deck structure based on this workshop content:

${contentData}

Topic: ${topic}

Generate slide-by-slide content. Respond ONLY with valid JSON:

{
  "slides": [
    {
      "slide_number": 1,
      "title": "Slide title",
      "type": "title_slide",
      "content": {
        "main_text": "Primary text content",
        "bullet_points": ["Point 1", "Point 2"],
        "notes": "Speaker notes for this slide"
      },
      "design_hints": {
        "layout": "title_and_content",
        "visual_elements": ["chart", "diagram", "icon"],
        "color_scheme": "professional_blue"
      }
    }
  ],
  "slide_count": 24,
  "estimated_presentation_time": "75 minutes"
}

Create exactly enough slides for the workshop duration. DO NOT include any text outside the JSON structure.`;

    return await callClaudeAPI(prompt, 4000);
  };

  // Code Agent - Creates practical exercises
  const codeAgent = async (topicStructure, topic, audience, difficulty) => {
    const prompt = `You are a technical training specialist. Create hands-on coding exercises based on:

${topicStructure}

Topic: ${topic}
Audience: ${audience}
Difficulty: ${difficulty}

Generate practical coding exercises. Respond ONLY with valid JSON:

{
  "exercises": [
    {
      "title": "Exercise title",
      "duration": 15,
      "difficulty": "beginner",
      "description": "What participants will build",
      "setup_instructions": "Step-by-step setup",
      "starter_code": "// Starter code template",
      "solution_code": "// Complete solution",
      "learning_objectives": ["objective 1", "objective 2"],
      "common_mistakes": ["mistake 1", "mistake 2"]
    }
  ],
  "code_demos": [
    {
      "title": "Demo title",
      "code": "# Complete demo code",
      "explanation": "Step-by-step explanation"
    }
  ],
  "resources": {
    "documentation_links": ["https://example.com/docs"],
    "additional_tools": ["Tool 1", "Tool 2"]
  }
}

Focus on practical, business-relevant examples. DO NOT include any text outside the JSON structure.`;

    return await callClaudeAPI(prompt, 3000);
  };

  const testAPIConnection = async () => {
    try {
      const testPrompt = "Respond with exactly: API_TEST_SUCCESS";
      const response = await callClaudeAPI(testPrompt, 50);
      return response.includes("API_TEST_SUCCESS");
    } catch (error) {
      console.error("API test failed:", error);
      return false;
    }
  };

  const handleAPISetup = async () => {
    setError('');
    
    // Test API connection
    const isConnected = await testAPIConnection();
    if (isConnected) {
      setCurrentStep('input');
    } else {
      setError('API connection failed. Please check your API key or try again.');
    }
  };

  const generateWorkshop = async () => {
    setIsGenerating(true);
    setCurrentStep('generating');
    setError('');
    
    try {
      // Step 1: Topic Agent
      setActiveAgent('topic');
      const topicResponse = await topicAgent(
        workshopData.topic, 
        workshopData.audience, 
        workshopData.duration, 
        workshopData.difficulty
      );
      
      let topicData;
      try {
        const cleanResponse = topicResponse.replace(/```json\n?/g, "").replace(/```\n?/g, "").trim();
        topicData = JSON.parse(cleanResponse);
      } catch (parseError) {
        console.error("Topic parsing error:", parseError);
        throw new Error("Failed to parse topic structure");
      }

      // Step 2: Content Agent
      setActiveAgent('content');
      const contentResponse = await contentAgent(
        JSON.stringify(topicData), 
        workshopData.topic, 
        workshopData.audience
      );
      
      let contentData;
      try {
        const cleanResponse = contentResponse.replace(/```json\n?/g, "").replace(/```\n?/g, "").trim();
        contentData = JSON.parse(cleanResponse);
      } catch (parseError) {
        console.error("Content parsing error:", parseError);
        throw new Error("Failed to parse content structure");
      }

      // Step 3: Slide Agent
      setActiveAgent('slide');
      const slideResponse = await slideAgent(
        JSON.stringify(contentData), 
        workshopData.topic
      );
      
      let slideData;
      try {
        const cleanResponse = slideResponse.replace(/```json\n?/g, "").replace(/```\n?/g, "").trim();
        slideData = JSON.parse(cleanResponse);
      } catch (parseError) {
        console.error("Slide parsing error:", parseError);
        throw new Error("Failed to parse slide structure");
      }

      // Step 4: Code Agent
      setActiveAgent('code');
      const codeResponse = await codeAgent(
        JSON.stringify(topicData), 
        workshopData.topic, 
        workshopData.audience, 
        workshopData.difficulty
      );
      
      let codeData;
      try {
        const cleanResponse = codeResponse.replace(/```json\n?/g, "").replace(/```\n?/g, "").trim();
        codeData = JSON.parse(cleanResponse);
      } catch (parseError) {
        console.error("Code parsing error:", parseError);
        throw new Error("Failed to parse code structure");
      }

      // Combine all generated content
      setGeneratedContent({
        topic: topicData,
        content: contentData,
        slides: slideData,
        code: codeData,
        metadata: {
          title: topicData.title,
          modules: topicData.modules?.length || 4,
          slideCount: slideData.slide_count || slideData.slides?.length || 0,
          exercises: codeData.exercises?.length || 0,
          estimatedValue: calculateWorkshopValue(workshopData.duration, workshopData.audience),
          generatedAt: new Date().toISOString()
        }
      });
      
      setCurrentStep('preview');
    } catch (error) {
      console.error("Workshop generation error:", error);
      setError(`Generation failed: ${error.message}`);
      setCurrentStep('input');
    } finally {
      setIsGenerating(false);
      setActiveAgent('');
    }
  };

  const calculateWorkshopValue = (duration, audience) => {
    const basePrices = {
      'executives': 200,
      'managers': 150,
      'developers': 120,
      'analysts': 100,
      'mixed': 140
    };
    
    const basePrice = basePrices[audience] || 120;
    const durationMultiplier = parseInt(duration) / 60;
    const estimatedValue = Math.round(basePrice * durationMultiplier) * 100;
    
    return `$${estimatedValue.toLocaleString()}`;
  };

  const downloadWorkshop = () => {
    if (!generatedContent) return;
    
    const workshopPackage = {
      ...generatedContent,
      generated_by: "AI Workshop in a Box",
      export_date: new Date().toISOString(),
      workshop_config: workshopData,
      api_version: "claude-sonnet-4-20250514"
    };
    
    const dataStr = JSON.stringify(workshopPackage, null, 2);
    const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
    
    const exportFileDefaultName = `workshop-${workshopData.topic.replace(/\s+/g, '-').toLowerCase()}.json`;
    
    const linkElement = document.createElement('a');
    linkElement.setAttribute('href', dataUri);
    linkElement.setAttribute('download', exportFileDefaultName);
    linkElement.click();
  };

  const handleInputChange = (field, value) => {
    setWorkshopData(prev => ({ ...prev, [field]: value }));
  };

  return (
    <div className="min-h-screen bg-gradient-to-br from-blue-900 via-purple-900 to-indigo-900 text-white">
      {/* Header */}
      <div className="bg-black/20 backdrop-blur-lg border-b border-white/10">
        <div className="max-w-7xl mx-auto px-6 py-4">
          <div className="flex items-center justify-between">
            <div className="flex items-center space-x-3">
              <div className="w-10 h-10 bg-gradient-to-r from-cyan-400 to-blue-500 rounded-lg flex items-center justify-center">
                <Zap className="w-6 h-6 text-white" />
              </div>
              <div>
                <h1 className="text-2xl font-bold">AI Workshop in a Box</h1>
                <p className="text-blue-200 text-sm">Production Multi-Agent Generator</p>
              </div>
            </div>
            <div className="flex items-center space-x-4">
              <div className="text-right">
                <div className="text-2xl font-bold text-green-400">$10K+</div>
                <div className="text-sm text-gray-300">per workshop</div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div className="max-w-7xl mx-auto px-6 py-8">
        {/* Error Display */}
        {error && (
          <div className="max-w-2xl mx-auto mb-6">
            <div className="bg-red-500/20 border border-red-400 rounded-lg p-4 flex items-center space-x-3">
              <AlertCircle className="w-5 h-5 text-red-400" />
              <span className="text-red-200">{error}</span>
            </div>
          </div>
        )}

        {/* Step 0: API Setup */}
        {currentStep === 'setup' && (
          <div className="max-w-2xl mx-auto">
            <div className="bg-white/10 backdrop-blur-lg rounded-2xl p-8 border border-white/20">
              <div className="text-center mb-6">
                <Settings className="w-16 h-16 text-cyan-400 mx-auto mb-4" />
                <h2 className="text-3xl font-bold mb-2">API Configuration</h2>
                <p className="text-blue-200">Set up your Claude API access to start generating workshops</p>
              </div>
              
              <div className="space-y-6">
                <div>
                  <label className="block text-sm font-medium mb-2">
                    Claude API Key (Optional for Claude.ai)
                  </label>
                  <input
                    type="password"
                    placeholder="sk-ant-api03-... (leave blank if running in Claude.ai)"
                    className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-cyan-400 focus:border-transparent text-white placeholder-gray-300"
                    value={apiKey}
                    onChange={(e) => setApiKey(e.target.value)}
                  />
                  <p className="text-xs text-gray-400 mt-2">
                    • Leave blank when running in Claude.ai (uses built-in access)<br/>
                    • Required when deploying to your own domain<br/>
                    • Get your API key from: <span className="text-cyan-400">console.anthropic.com</span>
                  </p>
                </div>

                <div className="bg-blue-500/20 border border-blue-400/30 rounded-lg p-4">
                  <h4 className="font-semibold text-blue-200 mb-2">Deployment Options:</h4>
                  <div className="text-sm text-blue-100 space-y-1">
                    <div>• <strong>Claude.ai:</strong> No API key needed (current environment)</div>
                    <div>• <strong>Your Domain:</strong> Add API key to environment variables</div>
                    <div>• <strong>GitHub:</strong> Store API key in repository secrets</div>
                  </div>
                </div>

                <button
                  onClick={handleAPISetup}
                  className="w-full py-4 bg-gradient-to-r from-cyan-500 to-blue-600 rounded-lg font-semibold text-lg hover:from-cyan-600 hover:to-blue-700 transition-all duration-200 flex items-center justify-center space-x-2"
                >
                  <CheckCircle className="w-5 h-5" />
                  <span>Test Connection & Continue</span>
                </button>
              </div>
            </div>
          </div>
        )}

        {/* Step 1: Input */}
        {currentStep === 'input' && (
          <div className="max-w-2xl mx-auto">
            <div className="bg-white/10 backdrop-blur-lg rounded-2xl p-8 border border-white/20">
              <h2 className="text-3xl font-bold mb-6 text-center">Create Your Workshop</h2>
              
              <div className="space-y-6">
                <div>
                  <label className="block text-sm font-medium mb-2">Workshop Topic</label>
                  <input
                    type="text"
                    placeholder="e.g., Advanced Prompt Engineering, AI Agents for Business"
                    className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-cyan-400 focus:border-transparent text-white placeholder-gray-300"
                    value={workshopData.topic}
                    onChange={(e) => handleInputChange('topic', e.target.value)}
                  />
                </div>

                <div>
                  <label className="block text-sm font-medium mb-2">Target Audience</label>
                  <select
                    className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-cyan-400 text-white"
                    value={workshopData.audience}
                    onChange={(e) => handleInputChange('audience', e.target.value)}
                  >
                    <option value="">Select audience</option>
                    <option value="executives">C-Suite Executives</option>
                    <option value="managers">Product Managers</option>
                    <option value="developers">Developers & Engineers</option>
                    <option value="analysts">Data Analysts</option>
                    <option value="mixed">Mixed Technical Team</option>
                  </select>
                </div>

                <div className="grid grid-cols-2 gap-4">
                  <div>
                    <label className="block text-sm font-medium mb-2">Duration (minutes)</label>
                    <select
                      className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-cyan-400 text-white"
                      value={workshopData.duration}
                      onChange={(e) => handleInputChange('duration', e.target.value)}
                    >
                      <option value="60">60 minutes</option>
                      <option value="90">90 minutes</option>
                      <option value="120">2 hours</option>
                      <option value="240">Half day</option>
                    </select>
                  </div>

                  <div>
                    <label className="block text-sm font-medium mb-2">Difficulty Level</label>
                    <select
                      className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-cyan-400 text-white"
                      value={workshopData.difficulty}
                      onChange={(e) => handleInputChange('difficulty', e.target.value)}
                    >
                      <option value="beginner">Beginner</option>
                      <option value="intermediate">Intermediate</option>
                      <option value="advanced">Advanced</option>
                    </select>
                  </div>
                </div>

                <button
                  onClick={generateWorkshop}
                  disabled={!workshopData.topic || !workshopData.audience || isGenerating}
                  className="w-full py-4 bg-gradient-to-r from-cyan-500 to-blue-600 rounded-lg font-semibold text-lg hover:from-cyan-600 hover:to-blue-700 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center space-x-2"
                >
                  <Zap className="w-5 h-5" />
                  <span>Generate Workshop</span>
                  <ChevronRight className="w-5 h-5" />
                </button>
              </div>

              <div className="mt-6 pt-6 border-t border-white/10">
                <button
                  onClick={() => setCurrentStep('setup')}
                  className="text-gray-300 hover:text-white text-sm flex items-center space-x-2"
                >
                  <Settings className="w-4 h-4" />
                  <span>Change API Settings</span>
                </button>
              </div>
            </div>
          </div>
        )}

        {/* Step 2: Generation Process */}
        {currentStep === 'generating' && (
          <div className="max-w-4xl mx-auto">
            <div className="text-center mb-8">
              <h2 className="text-3xl font-bold mb-4">Generating Your Workshop</h2>
              <p className="text-blue-200">Multi-agent system creating your complete training package...</p>
            </div>

            <div className="grid gap-6">
              {agents.map((agent, index) => {
                const isActive = activeAgent === agent.id;
                const isComplete = agents.findIndex(a => a.id === activeAgent) > index;
                const Icon = agent.icon;

                return (
                  <div
                    key={agent.id}
                    className={`p-6 rounded-xl border transition-all duration-500 ${
                      isActive
                        ? 'bg-cyan-500/20 border-cyan-400 shadow-lg shadow-cyan-500/25'
                        : isComplete
                        ? 'bg-green-500/20 border-green-400'
                        : 'bg-white/5 border-white/10'
                    }`}
                  >
                    <div className="flex items-center space-x-4">
                      <div className={`p-3 rounded-lg ${
                        isActive ? 'bg-cyan-500' : isComplete ? 'bg-green-500' : 'bg-white/10'
                      }`}>
                        {isActive ? (
                          <Loader className="w-6 h-6 animate-spin" />
                        ) : isComplete ? (
                          <CheckCircle className="w-6 h-6" />
                        ) : (
                          <Icon className="w-6 h-6" />
                        )}
                      </div>
                      <div className="flex-1">
                        <h3 className="font-semibold text-lg">{agent.name}</h3>
                        <p className="text-gray-300">{agent.description}</p>
                      </div>
                      {isActive && (
                        <div className="flex space-x-1">
                          <div className="w-2 h-2 bg-cyan-400 rounded-full animate-bounce"></div>
                          <div className="w-2 h-2 bg-cyan-400 rounded-full animate-bounce" style={{animationDelay: '0.1s'}}></div>
                          <div className="w-2 h-2 bg-cyan-400 rounded-full animate-bounce" style={{animationDelay: '0.2s'}}></div>
                        </div>
                      )}
                    </div>
                  </div>
                );
              })}
            </div>
          </div>
        )}

        {/* Step 3: Preview & Download */}
        {currentStep === 'preview' && generatedContent && (
          <div className="max-w-6xl mx-auto">
            <div className="text-center mb-8">
              <h2 className="text-3xl font-bold mb-4">Workshop Generated Successfully! 🎉</h2>
              <p className="text-blue-200 text-lg">Your complete training package is ready for delivery</p>
            </div>

            <div className="grid lg:grid-cols-3 gap-8">
              {/* Workshop Overview */}
              <div className="lg:col-span-2">
                <div className="bg-white/10 backdrop-blur-lg rounded-2xl p-8 border border-white/20">
                  <h3 className="text-2xl font-bold mb-6">{generatedContent.metadata.title}</h3>
                  
                  <div className="grid md:grid-cols-3 gap-6 mb-8">
                    <div className="text-center">
                      <div className="text-3xl font-bold text-cyan-400">{generatedContent.metadata.slideCount}</div>
                      <div className="text-sm text-gray-300">Slides</div>
                    </div>
                    <div className="text-center">
                      <div className="text-3xl font-bold text-green-400">{generatedContent.metadata.exercises}</div>
                      <div className="text-sm text-gray-300">Exercises</div>
                    </div>
                    <div className="text-center">
                      <div className="text-3xl font-bold text-purple-400">{workshopData.duration}m</div>
                      <div className="text-sm text-gray-300">Duration</div>
                    </div>
                  </div>

                  <div className="space-y-3">
                    <h4 className="font-semibold text-lg mb-3">Workshop Modules:</h4>
                    {generatedContent.topic.modules?.map((module, index) => (
                      <div key={index} className="flex items-center space-x-3 p-3 bg-white/5 rounded-lg">
                        <div className="w-8 h-8 bg-gradient-to-r from-cyan-400 to-blue-500 rounded-full flex items-center justify-center text-sm font-bold">
                          {index + 1}
                        </div>
                        <div>
                          <div className="font-medium">{module.name}</div>
                          <div className="text-sm text-gray-300">{module.duration} minutes</div>
                        </div>
                      </div>
                    )) || <div className="text-gray-400">Modules loaded successfully</div>}
                  </div>
                </div>
              </div>

              {/* Actions & Pricing */}
              <div className="space-y-6">
                <div className="bg-gradient-to-r from-green-500/20 to-emerald-500/20 border border-green-400/30 rounded-2xl p-6 text-center">
                  <DollarSign className="w-12 h-12 text-green-400 mx-auto mb-4" />
                  <div className="text-3xl font-bold text-green-400 mb-2">{generatedContent.metadata.estimatedValue}</div>
                  <div className="text-sm text-green-200">Estimated Workshop Value</div>
                </div>

                <div className="space-y-4">
                  <button 
                    onClick={downloadWorkshop}
                    className="w-full py-3 bg-gradient-to-r from-cyan-500 to-blue-600 rounded-lg font-semibold hover:from-cyan-600 hover:to-blue-700 transition-all duration-200 flex items-center justify-center space-x-2"
                  >
                    <Download className="w-5 h-5" />
                    <span>Download Package</span>
                  </button>

                  <button className="w-full py-3 bg-white/10 border border-white/20 rounded-lg font-semibold hover:bg-white/20 transition-all duration-200 flex items-center justify-center space-x-2">
                    <Play className="w-5 h-5" />
                    <span>Preview Content</span>
                  </button>

                  <button className="w-full py-3 bg-purple-600/20 border border-purple-400/30 rounded-lg font-semibold hover:bg-purple-600/30 transition-all duration-200 flex items-center justify-center space-x-2">
                    <Users className="w-5 h-5" />
                    <span>Book Client Demo</span>
                  </button>
                </div>

                <div className="bg-white/5 rounded-xl p-4">
                  <h4 className="font-semibold mb-2">Package Includes:</h4>
                  <ul className="text-sm space-y-1 text-gray-300">
                    <li>• Complete slide deck</li>
                    <li>• Speaker notes & scripts</li>
                    <li>• Hands-on exercises</li>
                    <li>• Code examples</li>
                    <li>• Assessment materials</li>
                    <li>• JSON export for customization</li>
                  </ul>
                </div>
              </div>
            </div>

            <div className="mt-8 text-center">
              <button
                onClick={() => {
                  setCurrentStep('input');
                  setGeneratedContent(null);
                  setWorkshopData({ topic: '', audience: '', duration: '90', difficulty: 'intermediate' });
                  setError('');
                }}
                className="px-6 py-3 bg-white/10 border border-white/20 rounded-lg hover:bg-white/20 transition-all duration-200"
              >
                Generate Another Workshop
              </button>
            </div>
          </div>
        )}
      </div>
    </div>
  );
};

export default WorkshopGenerator;