File size: 37,302 Bytes
971c47a
 
 
 
 
 
 
 
4ffd82e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971c47a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ffd82e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12e6bc2
25bc2b1
e51d332
 
 
 
 
 
 
 
 
25bc2b1
 
 
 
 
e51d332
25bc2b1
e51d332
e441b5d
 
25bc2b1
12e6bc2
878f875
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25bc2b1
12e6bc2
a815ebe
 
 
e51d332
878f875
a815ebe
 
 
e51d332
878f875
a815ebe
 
 
e51d332
878f875
a815ebe
 
 
e51d332
25bc2b1
 
 
 
 
e51d332
93250f2
12e6bc2
4ffd82e
12e6bc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ffd82e
12e6bc2
4ffd82e
12e6bc2
4ffd82e
 
 
 
 
 
 
 
e441b5d
4ffd82e
 
 
e441b5d
4ffd82e
 
 
 
 
 
 
 
e441b5d
971c47a
e441b5d
4ffd82e
12e6bc2
4ffd82e
 
 
 
 
 
 
 
971c47a
4ffd82e
 
 
 
 
 
 
 
 
 
 
 
971c47a
12e6bc2
e441b5d
12e6bc2
e441b5d
25bc2b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e441b5d
25bc2b1
e441b5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971c47a
 
 
 
 
 
 
e441b5d
 
 
971c47a
e441b5d
971c47a
 
 
e441b5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25bc2b1
 
 
e441b5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971c47a
e441b5d
971c47a
e441b5d
 
971c47a
 
 
 
 
 
 
 
e441b5d
971c47a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CodeGenius AI - Smart Coding Companion</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
  <script>
    function downloadBugAnalysis() {
      const content = document.getElementById('bugTerminal').textContent;
      const blob = new Blob([content], { type: 'text/plain' });
      const url = URL.createObjectURL(blob);
      
      const a = document.createElement('a');
      a.href = url;
      a.download = 'bug-analysis.txt';
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      URL.revokeObjectURL(url);
    }

    function copyFixedCode() {
      const code = document.getElementById('fixedCode').textContent;
      navigator.clipboard.writeText(code);
      
      const notification = document.createElement('div');
      notification.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-md shadow-lg';
      notification.textContent = 'Fixed code copied to clipboard!';
      document.body.appendChild(notification);
      
      setTimeout(() => {
        notification.remove();
      }, 2000);
    }

    function downloadFixedCode() {
      const code = document.getElementById('fixedCode').textContent;
      const blob = new Blob([code], { type: 'text/javascript' });
      const url = URL.createObjectURL(blob);
      
      const a = document.createElement('a');
      a.href = url;
      a.download = 'fixed-code.js';
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      URL.revokeObjectURL(url);
    }

    function downloadDocumentation() {
      const content = document.getElementById('documentationPanel').textContent;
      const blob = new Blob([content], { type: 'text/plain' });
      const url = URL.createObjectURL(blob);
      
      const a = document.createElement('a');
      a.href = url;
      a.download = 'documentation.txt';
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      URL.revokeObjectURL(url);
    }

    function downloadComments() {
      const content = document.getElementById('commentsPanel').textContent;
      const blob = new Blob([content], { type: 'text/plain' });
      const url = URL.createObjectURL(blob);
      
      const a = document.createElement('a');
      a.href = url;
      a.download = 'code-comments.txt';
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      URL.revokeObjectURL(url);
    }
tailwind.config = {
        theme: {
          extend: {
            colors: {
              primary: '#6366f1',
              secondary: '#8b5cf6',
              dark: '#0f172a',
              light: '#f8fafc'
            }
          }
        }
      }
    </script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
    <style>
      @import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap');
      body {
        font-family: 'Fira Code', monospace;
      }
      .code-editor {
        background-color: #1e293b;
        border-radius: 0.75rem;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
      }
      .gradient-text {
        background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
      }
      .vanta-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
      }
      .feature-card:hover {
        transform: translateY(-5px);
        transition: all 0.3s ease;
      }
      .glow {
        box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
      }
    </style>
</head>
<body class="bg-dark text-light min-h-screen">
  <div id="vanta-bg" class="vanta-container"></div>
  
  <!-- Navigation -->
  <nav class="bg-dark/80 backdrop-blur-md border-b border-gray-800 fixed w-full z-50">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="flex items-center justify-between h-16">
        <div class="flex items-center">
          <div class="flex-shrink-0 flex items-center">
            <i data-feather="code" class="text-primary h-6 w-6"></i>
            <span class="ml-2 text-xl font-bold gradient-text">CodeGenius AI</span>
          </div>
        </div>
        <div class="hidden md:block">
          <div class="ml-10 flex items-baseline space-x-4">
            <a href="#" class="text-primary px-3 py-2 rounded-md text-sm font-medium">Home</a>
            <a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Features</a>
            <a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Pricing</a>
            <a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Docs</a>
            <a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium">About</a>
          </div>
        </div>
        <div class="hidden md:block">
          <div class="ml-4 flex items-center md:ml-6">
            <button class="bg-primary hover:bg-primary/90 text-white px-4 py-2 rounded-md text-sm font-medium flex items-center">
              <i data-feather="log-in" class="mr-2 h-4 w-4"></i> Sign In
            </button>
          </div>
        </div>
        <div class="-mr-2 flex md:hidden">
          <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none">
            <i data-feather="menu"></i>
          </button>
        </div>
      </div>
    </div>
  </nav>

  <!-- Hero Section -->
  <div class="relative pt-32 pb-20 px-4 sm:px-6 lg:pt-40 lg:pb-28 lg:px-8">
    <div class="max-w-7xl mx-auto">
      <div class="text-center">
        <h1 class="text-4xl tracking-tight font-extrabold sm:text-5xl md:text-6xl">
          <span class="block">AI-Powered</span>
          <span class="block gradient-text">Coding Companion</span>
        </h1>
        <p class="mt-3 max-w-md mx-auto text-base text-gray-300 sm:text-lg md:mt-5 md:text-xl md:max-w-3xl">
          Supercharge your development workflow with our AI-powered tools that detect bugs, fix code, explain logic, and generate documentation automatically.
        </p>
        <div class="mt-10 sm:flex sm:justify-center">
          <div class="rounded-md shadow">
            <a href="#" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 md:py-4 md:text-lg md:px-10">
              Get Started
            </a>
          </div>
          <div class="mt-3 rounded-md shadow sm:mt-0 sm:ml-3">
            <a href="#" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-primary bg-white hover:bg-gray-50 md:py-4 md:text-lg md:px-10">
              Live Demo
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- Features Section -->
  <div class="py-12 bg-dark/50 backdrop-blur-sm">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="lg:text-center">
        <h2 class="text-base text-primary font-semibold tracking-wide uppercase">Features</h2>
        <p class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-white sm:text-4xl">
          Everything you need to code smarter
        </p>
      </div>

      <div class="mt-10">
        <div class="grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-3">
          <!-- Feature 1 -->
          <div class="feature-card bg-gray-800/50 p-6 rounded-lg border border-gray-700 hover:border-primary">
            <div class="flex items-center justify-center h-12 w-12 rounded-md bg-primary/10 text-primary mb-4">
              <i data-feather="bug"></i>
            </div>
            <h3 class="text-lg font-medium text-white mb-2">AI Bug Detector</h3>
            <p class="text-gray-300">
              Real-time scanning and detection of bugs, errors, and vulnerabilities in your code with detailed reports.
            </p>
          </div>

          <!-- Feature 2 -->
          <div class="feature-card bg-gray-800/50 p-6 rounded-lg border border-gray-700 hover:border-primary">
            <div class="flex items-center justify-center h-12 w-12 rounded-md bg-primary/10 text-primary mb-4">
              <i data-feather="check-circle"></i>
            </div>
            <h3 class="text-lg font-medium text-white mb-2">AI Bug Fixer</h3>
            <p class="text-gray-300">
              Automated suggestions and fixes for identified bugs, with options to apply changes instantly.
            </p>
          </div>

          <!-- Feature 3 -->
          <div class="feature-card bg-gray-800/50 p-6 rounded-lg border border-gray-700 hover:border-primary">
            <div class="flex items-center justify-center h-12 w-12 rounded-md bg-primary/10 text-primary mb-4">
              <i data-feather="book-open"></i>
            </div>
            <h3 class="text-lg font-medium text-white mb-2">AI Code Explainer</h3>
            <p class="text-gray-300">
              In-depth breakdowns of complex code segments, simplifying logic and functionality for better understanding.
            </p>
          </div>

          <!-- Feature 4 -->
          <div class="feature-card bg-gray-800/50 p-6 rounded-lg border border-gray-700 hover:border-primary">
            <div class="flex items-center justify-center h-12 w-12 rounded-md bg-primary/10 text-primary mb-4">
              <i data-feather="file-text"></i>
            </div>
            <h3 class="text-lg font-medium text-white mb-2">AI Documentation Maker</h3>
            <p class="text-gray-300">
              Auto-generates comprehensive, well-structured documentation for projects in various formats.
            </p>
          </div>

          <!-- Feature 5 -->
          <div class="feature-card bg-gray-800/50 p-6 rounded-lg border border-gray-700 hover:border-primary">
            <div class="flex items-center justify-center h-12 w-12 rounded-md bg-primary/10 text-primary mb-4">
              <i data-feather="message-square"></i>
            </div>
            <h3 class="text-lg font-medium text-white mb-2">AI Auto-Commentor</h3>
            <p class="text-gray-300">
              Intelligently adds descriptive comments to code, improving readability and maintainability.
            </p>
          </div>

          <!-- Feature 6 -->
          <div class="feature-card bg-gray-800/50 p-6 rounded-lg border border-gray-700 hover:border-primary">
            <div class="flex items-center justify-center h-12 w-12 rounded-md bg-primary/10 text-primary mb-4">
              <i data-feather="users"></i>
            </div>
            <h3 class="text-lg font-medium text-white mb-2">Real-time Collaboration</h3>
            <p class="text-gray-300">
              Work together with your team in real-time with built-in collaboration tools and version control.
            </p>
          </div>
        </div>
      </div>
    </div>
  </div>
    <!-- Interactive Code Section -->
    <div class="py-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
      <div class="grid grid-cols-1 gap-8">
        <!-- Bug Analysis and Fixed Code Section -->
        <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
          <!-- Bug Explanation Terminal -->
          <div class="code-editor p-4 glow">
            <div class="flex items-center justify-between mb-4">
              <div class="flex items-center">
                <div class="flex space-x-2 mr-4">
                  <div class="w-3 h-3 rounded-full bg-red-500"></div>
                  <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
                  <div class="w-3 h-3 rounded-full bg-green-500"></div>
                </div>
                <div class="text-sm text-gray-400">Bug Analysis</div>
              </div>
              <button onclick="downloadBugAnalysis()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Analysis">
                <i data-feather="download" class="w-4 h-4"></i>
              </button>
            </div>
            <div id="bugTerminal" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
              <div class="text-green-400">$ Waiting for code analysis...</div>
            </div>
          </div>

          <!-- Fixed Code Editor -->
          <div class="code-editor p-4 glow">
            <div class="flex items-center justify-between mb-4">
              <div class="flex items-center">
                <div class="flex space-x-2 mr-4">
                  <div class="w-3 h-3 rounded-full bg-red-500"></div>
                  <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
                  <div class="w-3 h-3 rounded-full bg-green-500"></div>
                </div>
                <div class="text-sm text-gray-400">fixed.js</div>
              </div>
              <div class="flex space-x-2">
                <button onclick="copyFixedCode()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Copy Code">
                  <i data-feather="copy" class="w-4 h-4"></i>
                </button>
                <button onclick="downloadFixedCode()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Code">
                  <i data-feather="download" class="w-4 h-4"></i>
                </button>
              </div>
            </div>
            <pre id="fixedCode" class="text-gray-300 text-sm font-mono h-64 overflow-auto bg-gray-800 p-4 rounded">
<span class="text-gray-500">// Fixed code will appear here after analysis</span></pre>
            <button onclick="applyFix()" class="group relative mt-4 w-full bg-gray-800/50 hover:bg-gray-700/70 border border-gray-700 hover:border-green-500 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-green-500/20">
              <div class="absolute inset-0 bg-green-500/10 group-hover:bg-green-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
              <i data-feather="check-circle" class="mr-2 text-green-400"></i> 
              <span class="relative">Apply Fix</span>
            </button>
          </div>
        </div>
<!-- Enhanced Code Editor with VS Code-like styling -->
      <div class="code-editor p-4 glow">
        <div class="flex items-center justify-between mb-4">
          <div class="flex items-center">
            <div class="flex space-x-2 mr-4">
              <div class="w-3 h-3 rounded-full bg-red-500"></div>
              <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
              <div class="w-3 h-3 rounded-full bg-green-500"></div>
            </div>
            <div class="text-sm text-gray-400">input.js</div>
          </div>
          <div class="flex space-x-2">
            <button onclick="copyCode()" class="group relative text-gray-400 hover:text-white p-1.5 rounded hover:bg-gray-700/50 transition-all duration-200" title="Copy Code">
              <i data-feather="copy" class="w-4 h-4"></i>
              <span class="absolute top-full left-1/2 transform -translate-x-1/2 mt-1 px-2 py-1 text-xs text-white bg-gray-800 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200">Copy</span>
            </button>
            <button onclick="downloadCode()" class="group relative text-gray-400 hover:text-white p-1.5 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Code">
              <i data-feather="download" class="w-4 h-4"></i>
              <span class="absolute top-full left-1/2 transform -translate-x-1/2 mt-1 px-2 py-1 text-xs text-white bg-gray-800 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200">Download</span>
            </button>
          </div>
        </div>
<div id="codeEditor" class="w-full h-96 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-auto">
<div>
            <div class="text-primary font-medium">Function Declaration:</div>
            <div class="text-gray-400 ml-4"><span class="text-purple-400">function</span> <span class="text-yellow-300">calculateTotal</span>(<span class="text-blue-400">items</span>) {</div>
          </div>
          <div class="mt-2">
            <div class="text-primary font-medium">Input Validation:</div>
            <div class="text-gray-400 ml-4"><span class="text-green-400">if</span> (!Array.isArray(<span class="text-blue-400">items</span>)) {</div>
            <div class="text-gray-400 ml-8"><span class="text-green-400">throw</span> <span class="text-purple-400">new</span> <span class="text-blue-400">Error</span>(<span class="text-orange-300">'Items must be an array'</span>);</div>
            <div class="text-gray-400 ml-4">}</div>
          </div>
          <div class="mt-2">
            <div class="text-primary font-medium">Total Calculation:</div>
            <div class="text-gray-400 ml-4"><span class="text-purple-400">let</span> total = <span class="text-blue-400">0</span>;</div>
            <div class="text-gray-400 ml-4"><span class="text-blue-400">items</span>.forEach(<span class="text-blue-400">item</span> => {</div>
            <div class="text-gray-400 ml-8"><span class="text-purple-400">const</span> price = <span class="text-blue-400">Number</span>(<span class="text-blue-400">item</span>.price) || <span class="text-blue-400">0</span>;</div>
            <div class="text-gray-400 ml-8">total += price * (<span class="text-blue-400">item</span>.quantity || <span class="text-blue-400">1</span>);</div>
            <div class="text-gray-400 ml-4">});</div>
          </div>
          <div class="mt-2">
            <div class="text-primary font-medium">Return Value:</div>
            <div class="text-gray-400 ml-4"><span class="text-green-400">return</span> total;</div>
            <div class="text-gray-400 ml-4">}</div>
          </div>
        </div>
        <div class="grid grid-cols-5 gap-3 mt-4">
<button onclick="explainCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-blue-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-blue-500/20">
            <div class="absolute inset-0 bg-blue-500/10 group-hover:bg-blue-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
            <i data-feather="book-open" class="mr-2 w-4 h-4 text-blue-400"></i> 
            <span class="relative">Explain</span>
          </button>
          <button onclick="commentCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-purple-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-purple-500/20">
            <div class="absolute inset-0 bg-purple-500/10 group-hover:bg-purple-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
            <i data-feather="message-square" class="mr-2 w-4 h-4 text-purple-400"></i> 
            <span class="relative">Comment</span>
          </button>
          <button onclick="analyzeCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-red-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-red-500/20">
            <div class="absolute inset-0 bg-red-500/10 group-hover:bg-red-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
            <i data-feather="bug" class="mr-2 w-4 h-4 text-red-400"></i> 
            <span class="relative">Find Bugs</span>
          </button>
          <button onclick="documentCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-green-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-green-500/20">
            <div class="absolute inset-0 bg-green-500/10 group-hover:bg-green-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
            <i data-feather="file-text" class="mr-2 w-4 h-4 text-green-400"></i> 
            <span class="relative">Document</span>
          </button>
          <button onclick="fixCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-indigo-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-indigo-500/20">
            <div class="absolute inset-0 bg-indigo-500/10 group-hover:bg-indigo-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
            <i data-feather="wrench" class="mr-2 w-4 h-4 text-indigo-400"></i> 
            <span class="relative">Fix Code</span>
          </button>
        </div>
</div>
    </div>
<!-- Documentation Panel -->
      <div class="code-editor p-4 glow">
        <div class="flex items-center mb-4">
          <div class="flex space-x-2 mr-4">
            <div class="w-3 h-3 rounded-full bg-blue-500"></div>
            <div class="w-3 h-3 rounded-full bg-purple-500"></div>
            <div class="w-3 h-3 rounded-full bg-pink-500"></div>
          </div>
          <div class="text-sm text-gray-400">Documentation</div>
        </div>
        <div id="documentationPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
          <div class="text-blue-400">/**
           * <span class="text-purple-400">@function</span> calculateTotal
           * <span class="text-purple-400">@description</span> Calculates the total price of items in a shopping cart
           * <span class="text-purple-400">@param</span> {Array} items - Array of item objects with price and quantity
           * <span class="text-purple-400">@returns</span> {Number} Total calculated amount
           * <span class="text-purple-400">@throws</span> {Error} If items is not an array
           */</div>
        </div>
      </div>

      <!-- Comments Panel -->
      <div class="code-editor p-4 glow">
        <div class="flex items-center mb-4">
          <div class="flex space-x-2 mr-4">
            <div class="w-3 h-3 rounded-full bg-green-500"></div>
            <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
            <div class="w-3 h-3 rounded-full bg-red-500"></div>
          </div>
          <div class="text-sm text-gray-400">Comments</div>
        </div>
        <div id="commentsPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
          <div class="text-green-400">// Function declaration with items parameter</div>
          <div class="text-green-400 mt-2">// Input validation - checks if items is an array</div>
          <div class="text-green-400 mt-2">// Initialize total to 0</div>
          <div class="text-green-400 mt-2">// Loop through each item in the array</div>
          <div class="text-green-400 mt-2">// Convert price to number, default to 0 if invalid</div>
          <div class="text-green-400 mt-2">// Calculate line total (price * quantity)</div>
          <div class="text-green-400 mt-2">// Return the calculated total</div>
        </div>
      </div>
    </div>
    <!-- Documentation and Comments Section -->
    <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mt-8">
      <!-- Documentation Panel -->
      <div class="code-editor p-4 glow">
        <div class="flex items-center justify-between mb-4">
          <div class="flex items-center">
            <div class="flex space-x-2 mr-4">
              <div class="w-3 h-3 rounded-full bg-blue-500"></div>
              <div class="w-3 h-3 rounded-full bg-purple-500"></div>
              <div class="w-3 h-3 rounded-full bg-pink-500"></div>
            </div>
            <div class="text-sm text-gray-400">Documentation</div>
          </div>
          <button onclick="downloadDocumentation()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Documentation">
            <i data-feather="download" class="w-4 h-4"></i>
          </button>
        </div>
        <div id="documentationPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
          <div class="text-blue-400">/**
           * <span class="text-purple-400">@function</span> calculateTotal
           * <span class="text-purple-400">@description</span> Calculates the total price of items in a shopping cart
           * <span class="text-purple-400">@param</span> {Array} items - Array of item objects with price and quantity
           * <span class="text-purple-400">@returns</span> {Number} Total calculated amount
           * <span class="text-purple-400">@throws</span> {Error} If items is not an array
           */</div>
        </div>
      </div>

      <!-- Comments Panel -->
      <div class="code-editor p-4 glow">
        <div class="flex items-center justify-between mb-4">
          <div class="flex items-center">
            <div class="flex space-x-2 mr-4">
              <div class="w-3 h-3 rounded-full bg-green-500"></div>
              <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
              <div class="w-3 h-3 rounded-full bg-red-500"></div>
            </div>
            <div class="text-sm text-gray-400">Comments</div>
          </div>
          <button onclick="downloadComments()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Comments">
            <i data-feather="download" class="w-4 h-4"></i>
          </button>
        </div>
        <div id="commentsPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
          <div class="text-green-400">// Function declaration with items parameter</div>
          <div class="text-green-400 mt-2">// Input validation - checks if items is an array</div>
          <div class="text-green-400 mt-2">// Initialize total to 0</div>
          <div class="text-green-400 mt-2">// Loop through each item in the array</div>
          <div class="text-green-400 mt-2">// Convert price to number, default to 0 if invalid</div>
          <div class="text-green-400 mt-2">// Calculate line total (price * quantity)</div>
          <div class="text-green-400 mt-2">// Return the calculated total</div>
        </div>
      </div>
    </div>
</div>
  <script>
    function copyCode() {
      const code = document.getElementById('codeEditor').textContent;
      navigator.clipboard.writeText(code);
      
      // Show copied notification
      const notification = document.createElement('div');
      notification.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-md shadow-lg';
      notification.textContent = 'Code copied to clipboard!';
      document.body.appendChild(notification);
      
      setTimeout(() => {
        notification.remove();
      }, 2000);
    }

    function downloadCode() {
      const code = document.getElementById('codeEditor').textContent;
      const blob = new Blob([code], { type: 'text/javascript' });
      const url = URL.createObjectURL(blob);
      
      const a = document.createElement('a');
      a.href = url;
      a.download = 'code.js';
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      URL.revokeObjectURL(url);
    }

    function fixCode() {
      analyzeCode();
      setTimeout(() => {
        applyFix();
      }, 2000);
    }

    function analyzeCode() {
const code = document.getElementById('codeInput').value;
      const bugTerminal = document.getElementById('bugTerminal');
      
      // Clear terminal
      bugTerminal.innerHTML = '<div class="text-green-400">$ Analyzing code...</div>';
      
      // Simulate AI analysis
      setTimeout(() => {
        bugTerminal.innerHTML = `
          <div class="text-green-400">$ Code analysis complete</div>
          <div class="text-yellow-400">$ Found 2 potential issues:</div>
          <div class="mt-2">
            <div class="text-red-400">1. Line 3: Missing input validation for 'items' array elements</div>
            <div class="text-gray-400 ml-4">- Items should be validated for required properties (price, quantity)</div>
          </div>
          <div class="mt-2">
            <div class="text-red-400">2. Line 7: Potential floating point precision issue</div>
            <div class="text-gray-400 ml-4">- Consider using toFixed(2) for currency calculations</div>
          </div>
          <div class="mt-4 text-green-400">$ Suggested fixes available</div>
        `;
        
        // Update fixed code
        document.getElementById('fixedCode').innerHTML = `
<span class="text-purple-400">function</span> <span class="text-yellow-300">calculateTotal</span>(items) {
  <span class="text-green-400">if</span> (!Array.isArray(items)) {
    <span class="text-green-400">throw</span> <span class="text-purple-400">new</span> <span class="text-blue-400">Error</span>(<span class="text-orange-300">'Items must be an array'</span>);
  }

  <span class="text-purple-400">let</span> total = <span class="text-blue-400">0</span>;
  items.forEach(item => {
    <span class="text-green-400">if</span> (!item.price || !item.quantity) {
      <span class="text-green-400">throw</span> <span class="text-purple-400">new</span> <span class="text-blue-400">Error</span>(<span class="text-orange-300">'Items must have price and quantity'</span>);
    }
    <span class="text-purple-400">const</span> price = <span class="text-blue-400">Number</span>(item.price) || <span class="text-blue-400">0</span>;
    total += <span class="text-blue-400">Number</span>((price * (item.quantity || <span class="text-blue-400">1</span>)).toFixed(<span class="text-blue-400">2</span>));
  });

  <span class="text-green-400">return</span> total;
}`;
      }, 1500);
    }
    
    function applyFix() {
      const fixedCode = document.getElementById('fixedCode').textContent;
      document.getElementById('codeInput').value = fixedCode;
      
      const bugTerminal = document.getElementById('bugTerminal');
      bugTerminal.innerHTML = `
        <div class="text-green-400">$ Fix applied successfully!</div>
        <div class="text-gray-400 mt-2">Original code has been replaced with the fixed version.</div>
        <div class="text-green-400 mt-4">$ Ready for new analysis</div>
      `;
    }
  </script>
  <!-- Enhanced Code Explanation Section -->
  <div class="py-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto bg-gradient-to-br from-gray-800/50 to-gray-900/60 rounded-lg border border-gray-700/50">
<div class="text-center mb-12">
      <h2 class="text-3xl font-extrabold text-white sm:text-4xl">
        <span class="gradient-text">Code Explanation</span>
      </h2>
      <p class="mt-3 max-w-2xl mx-auto text-lg text-gray-300">
        Our AI breaks down your code line by line for better understanding and learning.
      </p>
    </div>
    
    <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
      <div class="code-editor p-4">
        <div class="flex items-center mb-4">
          <div class="text-sm text-gray-400">Code Breakdown</div>
        </div>
        <div id="codeExplanation" class="text-gray-300 text-sm font-mono space-y-4">
          <div>
            <div class="text-primary font-medium">Function Declaration:</div>
            <div class="text-gray-400 ml-4">Defines a function named 'calculateTotal' that takes an 'items' parameter</div>
          </div>
          <div>
            <div class="text-primary font-medium">Input Validation:</div>
            <div class="text-gray-400 ml-4">Checks if 'items' is an array, throws error if not</div>
          </div>
          <div>
            <div class="text-primary font-medium">Total Calculation:</div>
            <div class="text-gray-400 ml-4">Iterates through items array, converts prices to numbers, handles missing quantities</div>
          </div>
          <div>
            <div class="text-primary font-medium">Return Value:</div>
            <div class="text-gray-400 ml-4">Returns the calculated total after processing all items</div>
          </div>
        </div>
      </div>
      
      <div class="code-editor p-4">
        <div class="flex items-center mb-4">
          <div class="text-sm text-gray-400">Optimization Tips</div>
        </div>
        <div class="text-gray-300 text-sm font-mono space-y-4">
          <div class="flex items-start">
            <i data-feather="zap" class="text-yellow-400 mr-2 mt-0.5 flex-shrink-0"></i>
            <div>
              <div class="font-medium">Use reduce() instead of forEach:</div>
              <div class="text-gray-400">Could make the total calculation more concise</div>
            </div>
          </div>
          <div class="flex items-start">
            <i data-feather="alert-triangle" class="text-red-400 mr-2 mt-0.5 flex-shrink-0"></i>
            <div>
              <div class="font-medium">Watch for floating point math:</div>
              <div class="text-gray-400">Currency calculations should use fixed decimal places</div>
            </div>
          </div>
          <div class="flex items-start">
            <i data-feather="code" class="text-blue-400 mr-2 mt-0.5 flex-shrink-0"></i>
            <div>
              <div class="font-medium">Add TypeScript:</div>
              <div class="text-gray-400">Would catch type issues at compile time</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- CTA Section -->
<div class="bg-gradient-to-r from-primary/20 to-secondary/20 py-16 px-4 sm:px-6 lg:px-8">
    <div class="max-w-3xl mx-auto text-center">
      <h2 class="text-3xl font-extrabold text-white sm:text-4xl">
        Ready to revolutionize your coding workflow?
      </h2>
      <p class="mt-3 text-xl text-gray-300">
        Join thousands of developers who are coding smarter with AI assistance.
      </p>
      <div class="mt-10 sm:flex sm:justify-center">
        <div class="rounded-md shadow">
          <a href="#" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 md:py-4 md:text-lg md:px-10">
            Start free trial
          </a>
        </div>
        <div class="mt-3 rounded-md shadow sm:mt-0 sm:ml-3">
          <a href="#" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-primary bg-white hover:bg-gray-50 md:py-4 md:text-lg md:px-10">
            See pricing
          </a>
        </div>
      </div>
    </div>
  </div>

  <!-- Footer -->
  <footer class="bg-gray-900/80 backdrop-blur-md border-t border-gray-800 mt-20">
    <div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
      <div class="grid grid-cols-2 md:grid-cols-4 gap-8">
        <div>
          <h3 class="text-sm font-semibold text-gray-400 tracking-wider uppercase">Product</h3>
          <ul class="mt-4 space-y-4">
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Features</a></li>
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Pricing</a></li>
            <li><a href="#" class="text-base text-gray-300 hover:text-white">API</a></li>
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Integrations</a></li>
          </ul>
        </div>
        <div>
          <h3 class="text-sm font-semibold text-gray-400 tracking-wider uppercase">Resources</h3>
          <ul class="mt-4 space-y-4">
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Documentation</a></li>
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Guides</a></li>
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Blog</a></li>
            <li><a href="#" class="text-base text-gray-300 hover:text-white">Support</a></li>
          </ul>
        </div>
        <div>
          <h3 class="text-sm font-semibold text-gray-400 tracking-wider uppercase">Company</h3>
          <ul class="mt-4 space-y-4">
            <li><a href="#" class="text-base text-gray-300 hover:text-white">About</a></li
</body>
</html>