File size: 30,206 Bytes
a6c5957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ContentGen Pro - AI-Powered Article Generator</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .article-card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .article-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
        }
        .image-selector {
            transition: all 0.2s ease;
        }
        .image-selector:hover {
            transform: scale(1.03);
        }
        .selected-image {
            border: 3px solid #4f46e5;
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
        }
        .loading-spinner {
            animation: spin 1s linear infinite;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .plan-card {
            transition: all 0.3s ease;
        }
        .plan-card:hover {
            transform: scale(1.03);
        }
        .premium-plan {
            position: relative;
            overflow: hidden;
        }
        .premium-plan::before {
            content: "POPULAR";
            position: absolute;
            top: 10px;
            right: -30px;
            background: #f59e0b;
            color: white;
            padding: 2px 30px;
            transform: rotate(45deg);
            font-size: 12px;
            font-weight: bold;
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- Navigation -->
    <nav class="gradient-bg text-white shadow-lg">
        <div class="container mx-auto px-4 py-4">
            <div class="flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <i class="fas fa-pen-nib text-2xl"></i>
                    <span class="text-xl font-bold">ContentGen Pro</span>
                </div>
                <div class="hidden md:flex space-x-6">
                    <a href="#features" class="hover:text-gray-200">Features</a>
                    <a href="#how-it-works" class="hover:text-gray-200">How It Works</a>
                    <a href="#pricing" class="hover:text-gray-200">Pricing</a>
                    <a href="#contact" class="hover:text-gray-200">Contact</a>
                </div>
                <div class="flex items-center space-x-4">
                    <button class="px-4 py-2 rounded-lg bg-white text-indigo-600 font-medium hover:bg-gray-100 transition">Login</button>
                    <button class="md:hidden text-xl">
                        <i class="fas fa-bars"></i>
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Hero Section -->
    <section class="gradient-bg text-white py-16 md:py-24">
        <div class="container mx-auto px-4 text-center">
            <h1 class="text-4xl md:text-6xl font-bold mb-6">AI-Powered Content Creation Made Simple</h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto">Generate high-quality articles with relevant images in minutes. Perfect for bloggers, marketers, and content creators.</p>
            <div class="flex flex-col md:flex-row justify-center gap-4">
                <button class="px-8 py-4 bg-white text-indigo-600 rounded-lg font-bold text-lg hover:bg-gray-100 transition">Start Generating</button>
                <button class="px-8 py-4 border-2 border-white text-white rounded-lg font-bold text-lg hover:bg-white hover:bg-opacity-10 transition">View Pricing</button>
            </div>
        </div>
    </section>

    <!-- Article Generator Section -->
    <section class="py-16 bg-white" id="generator">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center mb-12">Create Your Article</h2>
            
            <div class="max-w-4xl mx-auto bg-gray-50 rounded-xl p-6 shadow-md">
                <div class="mb-6">
                    <label class="block text-gray-700 font-medium mb-2" for="topic">Article Topic</label>
                    <input type="text" id="topic" placeholder="Enter your article topic (e.g., 'Sustainable Gardening')" 
                           class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500">
                </div>
                
                <div class="mb-6">
                    <label class="block text-gray-700 font-medium mb-2" for="keywords">Keywords (comma separated)</label>
                    <input type="text" id="keywords" placeholder="Enter keywords (e.g., 'organic, compost, water conservation')" 
                           class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500">
                </div>
                
                <div class="mb-6">
                    <label class="block text-gray-700 font-medium mb-2">Select Images (Choose 3)</label>
                    <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 mb-4" id="imageGallery">
                        <!-- Images will be loaded here -->
                        <div class="bg-gray-200 h-32 rounded-lg flex items-center justify-center text-gray-500">
                            <i class="fas fa-image text-3xl"></i>
                        </div>
                        <div class="bg-gray-200 h-32 rounded-lg flex items-center justify-center text-gray-500">
                            <i class="fas fa-image text-3xl"></i>
                        </div>
                        <div class="bg-gray-200 h-32 rounded-lg flex items-center justify-center text-gray-500">
                            <i class="fas fa-image text-3xl"></i>
                        </div>
                        <div class="bg-gray-200 h-32 rounded-lg flex items-center justify-center text-gray-500">
                            <i class="fas fa-image text-3xl"></i>
                        </div>
                    </div>
                    <button id="searchImagesBtn" class="px-4 py-2 bg-indigo-100 text-indigo-700 rounded-lg hover:bg-indigo-200 transition">
                        <i class="fas fa-search mr-2"></i> Search Images
                    </button>
                </div>
                
                <div class="flex justify-between items-center">
                    <div class="text-sm text-gray-500">
                        <span id="articleCount">0</span>/<span id="maxArticles">3</span> articles remaining this month
                    </div>
                    <button id="generateBtn" class="px-6 py-3 gradient-bg text-white rounded-lg font-medium hover:opacity-90 transition flex items-center">
                        <i class="fas fa-magic mr-2"></i> Generate Article
                    </button>
                </div>
            </div>
        </div>
    </section>

    <!-- Generated Articles Section -->
    <section class="py-16 bg-gray-50" id="articles">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center mb-12">Your Generated Articles</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8" id="articlesContainer">
                <!-- Sample article card - will be populated dynamically -->
                <div class="article-card bg-white rounded-xl overflow-hidden shadow-md">
                    <div class="h-48 bg-gray-200 flex items-center justify-center">
                        <i class="fas fa-image text-4xl text-gray-400"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold mb-2">Your Article Title</h3>
                        <p class="text-gray-600 mb-4">Generate your first article to see it appear here...</p>
                        <div class="flex justify-between items-center">
                            <span class="text-sm text-gray-500">Just now</span>
                            <button class="text-indigo-600 hover:text-indigo-800">
                                <i class="fas fa-download"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="text-center mt-8">
                <button id="downloadAllBtn" class="px-6 py-3 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700 transition flex items-center mx-auto">
                    <i class="fas fa-file-archive mr-2"></i> Download All as ZIP
                </button>
            </div>
        </div>
    </section>

    <!-- Pricing Section -->
    <section class="py-16 bg-white" id="pricing">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center mb-4">Simple, Transparent Pricing</h2>
            <p class="text-xl text-gray-600 text-center mb-12 max-w-2xl mx-auto">Choose the plan that fits your content creation needs</p>
            
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8 max-w-5xl mx-auto">
                <!-- Free Plan -->
                <div class="plan-card bg-gray-50 rounded-xl p-6 shadow-md border border-gray-200">
                    <h3 class="text-xl font-bold mb-2">Free</h3>
                    <p class="text-gray-600 mb-4">Perfect for trying out the platform</p>
                    <div class="mb-6">
                        <span class="text-4xl font-bold">$0</span>
                        <span class="text-gray-500">/month</span>
                    </div>
                    <ul class="space-y-3 mb-8">
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>3 articles per month</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Basic image selection</span>
                        </li>
                        <li class="flex items-center text-gray-400">
                            <i class="fas fa-times text-red-400 mr-2"></i>
                            <span>No priority generation</span>
                        </li>
                        <li class="flex items-center text-gray-400">
                            <i class="fas fa-times text-red-400 mr-2"></i>
                            <span>No bulk downloads</span>
                        </li>
                    </ul>
                    <button class="w-full py-3 border border-indigo-600 text-indigo-600 rounded-lg font-medium hover:bg-indigo-50 transition">
                        Current Plan
                    </button>
                </div>
                
                <!-- Premium Plan -->
                <div class="plan-card premium-plan bg-white rounded-xl p-6 shadow-lg border-2 border-indigo-500 transform scale-105">
                    <h3 class="text-xl font-bold mb-2">Premium</h3>
                    <p class="text-gray-600 mb-4">Best for regular content creators</p>
                    <div class="mb-6">
                        <span class="text-4xl font-bold">$5</span>
                        <span class="text-gray-500">/month</span>
                    </div>
                    <ul class="space-y-3 mb-8">
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>15 articles per month</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Premium image selection</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Priority generation</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Bulk downloads</span>
                        </li>
                    </ul>
                    <button class="w-full py-3 gradient-bg text-white rounded-lg font-medium hover:opacity-90 transition">
                        Upgrade Now
                    </button>
                </div>
                
                <!-- Lifetime Plan -->
                <div class="plan-card bg-gray-50 rounded-xl p-6 shadow-md border border-gray-200">
                    <h3 class="text-xl font-bold mb-2">Lifetime</h3>
                    <p class="text-gray-600 mb-4">For serious content creators</p>
                    <div class="mb-6">
                        <span class="text-4xl font-bold">$45</span>
                        <span class="text-gray-500">one time</span>
                    </div>
                    <ul class="space-y-3 mb-8">
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Unlimited articles</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Premium image selection</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>Highest priority generation</span>
                        </li>
                        <li class="flex items-center">
                            <i class="fas fa-check text-green-500 mr-2"></i>
                            <span>All premium features</span>
                        </li>
                    </ul>
                    <button class="w-full py-3 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700 transition">
                        Get Lifetime Access
                    </button>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h3 class="text-xl font-bold mb-4 flex items-center">
                        <i class="fas fa-pen-nib mr-2"></i> ContentGen Pro
                    </h3>
                    <p class="text-gray-400">AI-powered content creation platform for bloggers, marketers, and creators.</p>
                </div>
                <div>
                    <h4 class="font-bold mb-4">Features</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Article Generation</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Image Selection</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Bulk Downloads</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">API Access</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="font-bold mb-4">Company</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">About Us</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li>
                    </ul>
                </div>
                <div id="contact">
                    <h4 class="font-bold mb-4">Stay Updated</h4>
                    <p class="text-gray-400 mb-4">Subscribe to our newsletter for updates and tips.</p>
                    <div class="flex">
                        <input type="email" placeholder="Your email" class="px-4 py-2 rounded-l-lg text-gray-900 w-full">
                        <button class="px-4 py-2 bg-indigo-600 rounded-r-lg hover:bg-indigo-700">
                            <i class="fas fa-paper-plane"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 flex flex-col md:flex-row justify-between items-center">
                <p class="text-gray-400">© 2023 ContentGen Pro. All rights reserved.</p>
                <div class="flex space-x-6 mt-4 md:mt-0">
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin"></i></a>
                </div>
            </div>
        </div>
    </footer>

    <!-- Modal -->
    <div id="loadingModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-xl p-8 max-w-md w-full text-center">
            <div class="loading-spinner inline-block w-12 h-12 border-4 border-indigo-500 border-t-transparent rounded-full mb-4"></div>
            <h3 class="text-xl font-bold mb-2">Generating Your Article</h3>
            <p class="text-gray-600 mb-4">Our AI is working hard to create high-quality content for you. This may take a moment...</p>
            <div class="w-full bg-gray-200 rounded-full h-2.5">
                <div id="progressBar" class="bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
            </div>
        </div>
    </div>

    <script>
        // DOM Elements
        const searchImagesBtn = document.getElementById('searchImagesBtn');
        const generateBtn = document.getElementById('generateBtn');
        const downloadAllBtn = document.getElementById('downloadAllBtn');
        const imageGallery = document.getElementById('imageGallery');
        const articlesContainer = document.getElementById('articlesContainer');
        const loadingModal = document.getElementById('loadingModal');
        const progressBar = document.getElementById('progressBar');
        const articleCount = document.getElementById('articleCount');
        const maxArticles = document.getElementById('maxArticles');
        
        // Sample data for demonstration
        const sampleImages = [
            'https://images.unsplash.com/photo-1490750967868-88aa4486c946?w=500',
            'https://images.unsplash.com/photo-1526397751294-331021109fbd?w=500',
            'https://images.unsplash.com/photo-1466692476868-aef1dfb1e735?w=500',
            'https://images.unsplash.com/photo-1470114716159-e389f8712fda?w=500',
            'https://images.unsplash.com/photo-1500382017468-9049fed747ef?w=500',
            'https://images.unsplash.com/photo-1504208434309-cb69f4fe52b0?w=500',
            'https://images.unsplash.com/photo-1472214103451-9374bd1c798e?w=500',
            'https://images.unsplash.com/photo-1447752875215-b2761acb3c5d?w=500'
        ];
        
        const sampleArticles = [
            {
                title: "The Future of Sustainable Gardening",
                content: "Sustainable gardening is becoming increasingly important as we face environmental challenges. This article explores innovative techniques for eco-friendly gardening that can help reduce your carbon footprint while creating a beautiful outdoor space.",
                images: [
                    'https://images.unsplash.com/photo-1490750967868-88aa4486c946?w=500',
                    'https://images.unsplash.com/photo-1526397751294-331021109fbd?w=500',
                    'https://images.unsplash.com/photo-1466692476868-aef1dfb1e735?w=500'
                ],
                date: "2 minutes ago"
            },
            {
                title: "Organic Composting 101",
                content: "Learn how to turn your kitchen scraps into nutrient-rich compost for your garden. This beginner's guide covers everything from setting up your compost bin to troubleshooting common issues.",
                images: [
                    'https://images.unsplash.com/photo-1470114716159-e389f8712fda?w=500',
                    'https://images.unsplash.com/photo-1500382017468-9049fed747ef?w=500',
                    'https://images.unsplash.com/photo-1504208434309-cb69f4fe52b0?w=500'
                ],
                date: "5 minutes ago"
            }
        ];
        
        // Initialize with free plan (3 articles)
        let remainingArticles = 3;
        articleCount.textContent = remainingArticles;
        maxArticles.textContent = remainingArticles;
        
        // Search Images Button Click
        searchImagesBtn.addEventListener('click', () => {
            // In a real app, this would call the Unsplash API with the keywords
            // For demo, we'll use sample images
            
            // Clear existing images
            imageGallery.innerHTML = '';
            
            // Add sample images
            sampleImages.forEach((imgUrl, index) => {
                const imgDiv = document.createElement('div');
                imgDiv.className = 'image-selector bg-gray-200 h-32 rounded-lg overflow-hidden cursor-pointer';
                imgDiv.innerHTML = `
                    <img src="${imgUrl}" alt="Sample image ${index + 1}" class="w-full h-full object-cover">
                `;
                
                imgDiv.addEventListener('click', () => {
                    // Toggle selection
                    imgDiv.classList.toggle('selected-image');
                    
                    // Limit to 3 selected images
                    const selected = document.querySelectorAll('.selected-image');
                    if (selected.length > 3) {
                        imgDiv.classList.remove('selected-image');
                        alert('You can only select 3 images per article.');
                    }
                });
                
                imageGallery.appendChild(imgDiv);
            });
        });
        
        // Generate Article Button Click
        generateBtn.addEventListener('click', () => {
            const topic = document.getElementById('topic').value;
            const keywords = document.getElementById('keywords').value;
            const selectedImages = document.querySelectorAll('.selected-image');
            
            // Validate inputs
            if (!topic) {
                alert('Please enter an article topic');
                return;
            }
            
            if (selectedImages.length < 3) {
                alert('Please select exactly 3 images for your article');
                return;
            }
            
            if (remainingArticles <= 0) {
                alert('You have reached your monthly article limit. Please upgrade your plan to generate more articles.');
                return;
            }
            
            // Show loading modal
            loadingModal.classList.remove('hidden');
            
            // Simulate progress (in a real app, this would be API calls to Gemini)
            let progress = 0;
            const interval = setInterval(() => {
                progress += 10;
                progressBar.style.width = `${progress}%`;
                
                if (progress >= 100) {
                    clearInterval(interval);
                    setTimeout(() => {
                        loadingModal.classList.add('hidden');
                        generateArticle(topic, keywords);
                    }, 500);
                }
            }, 300);
        });
        
        // Function to generate and display a new article
        function generateArticle(topic, keywords) {
            // Decrement remaining articles
            remainingArticles--;
            articleCount.textContent = remainingArticles;
            
            // In a real app, this would use the Gemini API to generate content
            // For demo, we'll use a sample article and rotate through sample images
            
            const selectedImages = Array.from(document.querySelectorAll('.selected-image')).map(img => {
                return img.querySelector('img').src;
            });
            
            const newArticle = {
                title: `${topic} - ${keywords.split(',')[0].trim()}`,
                content: `This is a generated article about ${topic} with keywords: ${keywords}. The AI has created comprehensive content that covers all aspects of this topic in detail.`,
                images: selectedImages,
                date: "Just now"
            };
            
            // Add to beginning of articles container
            const articleCard = document.createElement('div');
            articleCard.className = 'article-card bg-white rounded-xl overflow-hidden shadow-md';
            articleCard.innerHTML = `
                <div class="h-48 bg-gray-200 overflow-hidden">
                    <img src="${newArticle.images[0]}" alt="${newArticle.title}" class="w-full h-full object-cover">
                </div>
                <div class="p-6">
                    <h3 class="text-xl font-bold mb-2">${newArticle.title}</h3>
                    <p class="text-gray-600 mb-4">${newArticle.content.substring(0, 100)}...</p>
                    <div class="flex justify-between items-center">
                        <span class="text-sm text-gray-500">${newArticle.date}</span>
                        <button class="text-indigo-600 hover:text-indigo-800 download-btn" data-title="${encodeURIComponent(newArticle.title)}">
                            <i class="fas fa-download"></i>
                        </button>
                    </div>
                </div>
            `;
            
            articlesContainer.insertBefore(articleCard, articlesContainer.firstChild);
            
            // Reset form
            document.getElementById('topic').value = '';
            document.getElementById('keywords').value = '';
            imageGallery.innerHTML = '';
            
            // Add empty placeholders
            for (let i = 0; i < 4; i++) {
                const placeholder = document.createElement('div');
                placeholder.className = 'bg-gray-200 h-32 rounded-lg flex items-center justify-center text-gray-500';
                placeholder.innerHTML = '<i class="fas fa-image text-3xl"></i>';
                imageGallery.appendChild(placeholder);
            }
        }
        
        // Download All Button Click
        downloadAllBtn.addEventListener('click', () => {
            alert('In a real implementation, this would generate a ZIP file containing all your articles with their selected images.');
        });
        
        // Sample articles for demo
        sampleArticles.forEach(article => {
            const articleCard = document.createElement('div');
            articleCard.className = 'article-card bg-white rounded-xl overflow-hidden shadow-md';
            articleCard.innerHTML = `
                <div class="h-48 bg-gray-200 overflow-hidden">
                    <img src="${article.images[0]}" alt="${article.title}" class="w-full h-full object-cover">
                </div>
                <div class="p-6">
                    <h3 class="text-xl font-bold mb-2">${article.title}</h3>
                    <p class="text-gray-600 mb-4">${article.content.substring(0, 100)}...</p>
                    <div class="flex justify-between items-center">
                        <span class="text-sm text-gray-500">${article.date}</span>
                        <button class="text-indigo-600 hover:text-indigo-800 download-btn" data-title="${encodeURIComponent(article.title)}">
                            <i class="fas fa-download"></i>
                        </button>
                    </div>
                </div>
            `;
            articlesContainer.appendChild(articleCard);
        });
        
        // Handle download buttons
        document.addEventListener('click', (e) => {
            if (e.target.classList.contains('download-btn') || e.target.closest('.download-btn')) {
                const btn = e.target.classList.contains('download-btn') ? e.target : e.target.closest('.download-btn');
                const title = btn.getAttribute('data-title');
                alert(`Downloading article: ${decodeURIComponent(title)}. In a real implementation, this would download the article as a PDF or HTML file with all selected images.`);
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=DIDAOUIaek/seo" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>