File size: 35,509 Bytes
0042773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Media Planning Tool</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, #6b73ff 0%, #000dff 100%);
        }
        .chart-container {
            height: 300px;
            position: relative;
        }
        .budget-bar {
            transition: all 0.5s ease;
        }
        .fade-in {
            animation: fadeIn 0.5s ease-in;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <header class="text-center mb-12">
            <h1 class="text-4xl font-bold text-gray-800 mb-2">Media Planning Tool</h1>
            <p class="text-lg text-gray-600">Optimize your marketing budget allocation for maximum ROI</p>
        </header>

        <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
            <!-- Input Form -->
            <div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-1">
                <h2 class="text-2xl font-semibold text-gray-800 mb-6">Offer Details</h2>
                <form id="mediaPlanForm" class="space-y-4">
                    <div>
                        <label for="offerName" class="block text-sm font-medium text-gray-700 mb-1">Offer Name</label>
                        <input type="text" id="offerName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. Summer Sale">
                    </div>
                    
                    <div>
                        <label for="category" class="block text-sm font-medium text-gray-700 mb-1">Category</label>
                        <select id="category" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                            <option value="ecommerce">E-commerce</option>
                            <option value="saas">SaaS</option>
                            <option value="education">Education</option>
                            <option value="health">Health & Wellness</option>
                            <option value="finance">Finance</option>
                            <option value="other">Other</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="geo" class="block text-sm font-medium text-gray-700 mb-1">Target Geography</label>
                        <select id="geo" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                            <option value="global">Global</option>
                            <option value="north_america">North America</option>
                            <option value="europe">Europe</option>
                            <option value="asia">Asia</option>
                            <option value="latin_america">Latin America</option>
                            <option value="middle_east">Middle East</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="price" class="block text-sm font-medium text-gray-700 mb-1">Product/Service Price ($)</label>
                        <input type="number" id="price" min="0" step="0.01" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 99.99">
                    </div>
                    
                    <div>
                        <label for="cpa" class="block text-sm font-medium text-gray-700 mb-1">Desired CPA ($)</label>
                        <input type="number" id="cpa" min="0" step="0.01" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 20.00">
                    </div>
                    
                    <div>
                        <label for="budget" class="block text-sm font-medium text-gray-700 mb-1">Total Budget ($)</label>
                        <input type="number" id="budget" min="100" step="100" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 5000">
                    </div>
                    
                    <div>
                        <label for="duration" class="block text-sm font-medium text-gray-700 mb-1">Campaign Duration (weeks)</label>
                        <input type="number" id="duration" min="1" max="52" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 4">
                    </div>
                    
                    <div>
                        <label for="target" class="block text-sm font-medium text-gray-700 mb-1">Primary Target Audience</label>
                        <select id="target" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                            <option value="millennials">Millennials (25-40)</option>
                            <option value="gen_z">Gen Z (18-24)</option>
                            <option value="gen_x">Gen X (41-56)</option>
                            <option value="boomers">Boomers (57-75)</option>
                            <option value="women">Women</option>
                            <option value="men">Men</option>
                            <option value="business">Business Professionals</option>
                        </select>
                    </div>
                    
                    <button type="submit" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300 flex items-center justify-center">
                        <i class="fas fa-chart-pie mr-2"></i> Generate Media Plan
                    </button>
                </form>
            </div>
            
            <!-- Results Section -->
            <div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-2" id="resultsSection" style="display: none;">
                <div class="flex justify-between items-center mb-6">
                    <h2 class="text-2xl font-semibold text-gray-800">Media Plan for <span id="planOfferName" class="text-blue-600"></span></h2>
                    <button id="printPlan" class="bg-gray-100 hover:bg-gray-200 text-gray-800 py-2 px-4 rounded-lg flex items-center">
                        <i class="fas fa-print mr-2"></i> Print Plan
                    </button>
                </div>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                    <div class="bg-blue-50 rounded-xl p-4">
                        <h3 class="font-medium text-blue-800 mb-2">Campaign Summary</h3>
                        <div class="space-y-2">
                            <p><span class="font-medium">Budget:</span> $<span id="summaryBudget">0</span></p>
                            <p><span class="font-medium">Duration:</span> <span id="summaryDuration">0</span> weeks</p>
                            <p><span class="font-medium">Target CPA:</span> $<span id="summaryCPA">0</span></p>
                            <p><span class="font-medium">Geography:</span> <span id="summaryGeo">Global</span></p>
                            <p><span class="font-medium">Audience:</span> <span id="summaryAudience">All</span></p>
                        </div>
                    </div>
                    
                    <div class="bg-green-50 rounded-xl p-4">
                        <h3 class="font-medium text-green-800 mb-2">Performance Projection</h3>
                        <div class="space-y-2">
                            <p><span class="font-medium">Estimated Conversions:</span> <span id="projectedConversions">0</span></p>
                            <p><span class="font-medium">Projected Revenue:</span> $<span id="projectedRevenue">0</span></p>
                            <p><span class="font-medium">ROI:</span> <span id="projectedROI">0</span>%</p>
                            <p><span class="font-medium">Break-even Point:</span> <span id="breakEven">0</span> conversions</p>
                        </div>
                    </div>
                </div>
                
                <h3 class="text-xl font-semibold text-gray-800 mb-4">Budget Allocation</h3>
                <div class="chart-container mb-8">
                    <div class="grid grid-cols-1 md:grid-cols-4 gap-4 h-full">
                        <div class="flex flex-col justify-end">
                            <div class="bg-blue-500 budget-bar rounded-t-lg" style="height: 0%;" id="paidAdsBar">
                                <div class="text-center text-white py-1 font-medium">0%</div>
                            </div>
                            <div class="text-center mt-2 font-medium text-gray-700">Paid Ads</div>
                        </div>
                        <div class="flex flex-col justify-end">
                            <div class="bg-purple-500 budget-bar rounded-t-lg" style="height: 0%;" id="socialMediaBar">
                                <div class="text-center text-white py-1 font-medium">0%</div>
                            </div>
                            <div class="text-center mt-2 font-medium text-gray-700">Social Media</div>
                        </div>
                        <div class="flex flex-col justify-end">
                            <div class="bg-green-500 budget-bar rounded-t-lg" style="height: 0%;" id="seoBar">
                                <div class="text-center text-white py-1 font-medium">0%</div>
                            </div>
                            <div class="text-center mt-2 font-medium text-gray-700">SEO</div>
                        </div>
                        <div class="flex flex-col justify-end">
                            <div class="bg-yellow-500 budget-bar rounded-t-lg" style="height: 0%;" id="contentBar">
                                <div class="text-center text-white py-1 font-medium">0%</div>
                            </div>
                            <div class="text-center mt-2 font-medium text-gray-700">Content</div>
                        </div>
                    </div>
                </div>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                    <div class="bg-white border border-gray-200 rounded-xl p-4 fade-in">
                        <h3 class="font-medium text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-ad mr-2 text-blue-500"></i> Paid Advertising
                        </h3>
                        <div class="space-y-3">
                            <p><span class="font-medium">Budget:</span> $<span id="paidBudget">0</span></p>
                            <p><span class="font-medium">Recommended Platforms:</span></p>
                            <ul class="list-disc pl-5" id="paidPlatforms">
                                <!-- Filled by JS -->
                            </ul>
                            <p class="text-sm text-gray-600 mt-2" id="paidNotes">
                                <!-- Filled by JS -->
                            </p>
                        </div>
                    </div>
                    
                    <div class="bg-white border border-gray-200 rounded-xl p-4 fade-in">
                        <h3 class="font-medium text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-share-alt mr-2 text-purple-500"></i> Social Media
                        </h3>
                        <div class="space-y-3">
                            <p><span class="font-medium">Budget:</span> $<span id="socialBudget">0</span></p>
                            <p><span class="font-medium">Recommended Platforms:</span></p>
                            <ul class="list-disc pl-5" id="socialPlatforms">
                                <!-- Filled by JS -->
                            </ul>
                            <p class="text-sm text-gray-600 mt-2" id="socialNotes">
                                <!-- Filled by JS -->
                            </p>
                        </div>
                    </div>
                    
                    <div class="bg-white border border-gray-200 rounded-xl p-4 fade-in">
                        <h3 class="font-medium text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-search mr-2 text-green-500"></i> SEO
                        </h3>
                        <div class="space-y-3">
                            <p><span class="font-medium">Budget:</span> $<span id="seoBudget">0</span></p>
                            <p><span class="font-medium">Focus Areas:</span></p>
                            <ul class="list-disc pl-5" id="seoFocus">
                                <!-- Filled by JS -->
                            </ul>
                            <p class="text-sm text-gray-600 mt-2" id="seoNotes">
                                <!-- Filled by JS -->
                            </p>
                        </div>
                    </div>
                    
                    <div class="bg-white border border-gray-200 rounded-xl p-4 fade-in">
                        <h3 class="font-medium text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-pen-fancy mr-2 text-yellow-500"></i> Content Marketing
                        </h3>
                        <div class="space-y-3">
                            <p><span class="font-medium">Budget:</span> $<span id="contentBudget">0</span></p>
                            <p><span class="font-medium">Content Types:</span></p>
                            <ul class="list-disc pl-5" id="contentTypes">
                                <!-- Filled by JS -->
                            </ul>
                            <p class="text-sm text-gray-600 mt-2" id="contentNotes">
                                <!-- Filled by JS -->
                            </p>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-50 rounded-xl p-4 border border-gray-200 fade-in">
                    <h3 class="font-medium text-gray-800 mb-3 flex items-center">
                        <i class="fas fa-lightbulb mr-2 text-orange-500"></i> Strategic Recommendations
                    </h3>
                    <div class="space-y-2" id="recommendations">
                        <!-- Filled by JS -->
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.getElementById('mediaPlanForm');
            const resultsSection = document.getElementById('resultsSection');
            const printButton = document.getElementById('printPlan');
            
            form.addEventListener('submit', function(e) {
                e.preventDefault();
                generateMediaPlan();
                resultsSection.style.display = 'block';
                window.scrollTo({
                    top: document.getElementById('resultsSection').offsetTop - 20,
                    behavior: 'smooth'
                });
            });
            
            printButton.addEventListener('click', function() {
                window.print();
            });
            
            function generateMediaPlan() {
                // Get form values
                const offerName = document.getElementById('offerName').value || 'Your Offer';
                const category = document.getElementById('category').value;
                const geo = document.getElementById('geo').value;
                const price = parseFloat(document.getElementById('price').value) || 0;
                const cpa = parseFloat(document.getElementById('cpa').value) || 0;
                const budget = parseFloat(document.getElementById('budget').value) || 0;
                const duration = parseInt(document.getElementById('duration').value) || 1;
                const target = document.getElementById('target').value;
                
                // Set basic info
                document.getElementById('planOfferName').textContent = offerName;
                document.getElementById('summaryBudget').textContent = budget.toLocaleString();
                document.getElementById('summaryDuration').textContent = duration;
                document.getElementById('summaryCPA').textContent = cpa.toLocaleString();
                document.getElementById('summaryGeo').textContent = getGeoName(geo);
                document.getElementById('summaryAudience').textContent = getAudienceName(target);
                
                // Calculate performance projections
                const estimatedConversions = Math.floor(budget / cpa);
                const projectedRevenue = estimatedConversions * price;
                const roi = ((projectedRevenue - budget) / budget * 100).toFixed(1);
                const breakEven = Math.ceil(budget / price);
                
                document.getElementById('projectedConversions').textContent = estimatedConversions.toLocaleString();
                document.getElementById('projectedRevenue').textContent = projectedRevenue.toLocaleString();
                document.getElementById('projectedROI').textContent = roi;
                document.getElementById('breakEven').textContent = breakEven.toLocaleString();
                
                // Determine budget allocation based on category and other factors
                const allocation = calculateAllocation(category, geo, target, budget, duration);
                
                // Update budget allocation bars
                animateBudgetBars(allocation);
                
                // Set budget amounts
                document.getElementById('paidBudget').textContent = allocation.paid.toLocaleString();
                document.getElementById('socialBudget').textContent = allocation.social.toLocaleString();
                document.getElementById('seoBudget').textContent = allocation.seo.toLocaleString();
                document.getElementById('contentBudget').textContent = allocation.content.toLocaleString();
                
                // Set platform recommendations
                setPlatformRecommendations(category, geo, target, allocation);
                
                // Set strategic recommendations
                setStrategicRecommendations(category, geo, target, budget, duration, price, cpa);
            }
            
            function calculateAllocation(category, geo, target, budget, duration) {
                // Base allocation percentages
                let paidPercent = 40;
                let socialPercent = 30;
                let seoPercent = 20;
                let contentPercent = 10;
                
                // Adjust based on category
                if (category === 'ecommerce') {
                    paidPercent = 50;
                    socialPercent = 25;
                    seoPercent = 15;
                    contentPercent = 10;
                } else if (category === 'saas') {
                    paidPercent = 35;
                    socialPercent = 25;
                    seoPercent = 30;
                    contentPercent = 10;
                } else if (category === 'education') {
                    paidPercent = 30;
                    socialPercent = 35;
                    seoPercent = 20;
                    contentPercent = 15;
                }
                
                // Adjust based on geography
                if (geo === 'north_america' || geo === 'europe') {
                    paidPercent += 5;
                    socialPercent -= 5;
                } else if (geo === 'asia') {
                    socialPercent += 10;
                    paidPercent -= 5;
                    seoPercent -= 5;
                }
                
                // Adjust based on target audience
                if (target === 'gen_z' || target === 'millennials') {
                    socialPercent += 10;
                    paidPercent -= 5;
                    seoPercent -= 5;
                } else if (target === 'gen_x' || target === 'boomers') {
                    paidPercent += 10;
                    socialPercent -= 5;
                    contentPercent -= 5;
                }
                
                // Adjust based on budget size
                if (budget < 1000) {
                    paidPercent = 70;
                    socialPercent = 20;
                    seoPercent = 5;
                    contentPercent = 5;
                } else if (budget > 10000) {
                    seoPercent += 5;
                    contentPercent += 5;
                    paidPercent -= 5;
                    socialPercent -= 5;
                }
                
                // Adjust based on duration
                if (duration > 8) {
                    seoPercent += 5;
                    contentPercent += 5;
                    paidPercent -= 5;
                    socialPercent -= 5;
                }
                
                // Calculate final amounts
                return {
                    paid: Math.round(budget * paidPercent / 100),
                    social: Math.round(budget * socialPercent / 100),
                    seo: Math.round(budget * seoPercent / 100),
                    content: Math.round(budget * contentPercent / 100),
                    paidPercent,
                    socialPercent,
                    seoPercent,
                    contentPercent
                };
            }
            
            function animateBudgetBars(allocation) {
                const paidBar = document.getElementById('paidAdsBar');
                const socialBar = document.getElementById('socialMediaBar');
                const seoBar = document.getElementById('seoBar');
                const contentBar = document.getElementById('contentBar');
                
                setTimeout(() => {
                    paidBar.style.height = allocation.paidPercent + '%';
                    paidBar.querySelector('div').textContent = allocation.paidPercent + '%';
                    
                    socialBar.style.height = allocation.socialPercent + '%';
                    socialBar.querySelector('div').textContent = allocation.socialPercent + '%';
                    
                    seoBar.style.height = allocation.seoPercent + '%';
                    seoBar.querySelector('div').textContent = allocation.seoPercent + '%';
                    
                    contentBar.style.height = allocation.contentPercent + '%';
                    contentBar.querySelector('div').textContent = allocation.contentPercent + '%';
                }, 100);
            }
            
            function setPlatformRecommendations(category, geo, target, allocation) {
                // Paid Advertising
                const paidPlatforms = document.getElementById('paidPlatforms');
                paidPlatforms.innerHTML = '';
                
                let paidItems = ['Google Ads (Search & Display)'];
                if (category === 'ecommerce') paidItems.push('Google Shopping');
                if (target === 'gen_z' || target === 'millennials') paidItems.push('TikTok Ads');
                if (geo === 'north_america') paidItems.push('Facebook Ads', 'Instagram Ads');
                if (geo === 'asia') paidItems.push('Baidu Ads (China)', 'Naver Ads (Korea)');
                
                paidItems.forEach(item => {
                    const li = document.createElement('li');
                    li.textContent = item;
                    paidPlatforms.appendChild(li);
                });
                
                document.getElementById('paidNotes').textContent = getPaidNotes(category, geo, target, allocation.paid);
                
                // Social Media
                const socialPlatforms = document.getElementById('socialPlatforms');
                socialPlatforms.innerHTML = '';
                
                let socialItems = ['Instagram'];
                if (target === 'gen_z') socialItems.push('TikTok', 'Snapchat');
                if (target === 'millennials') socialItems.push('Facebook', 'LinkedIn');
                if (target === 'business') socialItems.push('LinkedIn', 'Twitter');
                if (geo === 'asia') socialItems.push('WeChat (China)', 'Line (Japan/Thailand)');
                
                socialItems.forEach(item => {
                    const li = document.createElement('li');
                    li.textContent = item;
                    socialPlatforms.appendChild(li);
                });
                
                document.getElementById('socialNotes').textContent = getSocialNotes(category, target, allocation.social);
                
                // SEO
                const seoFocus = document.getElementById('seoFocus');
                seoFocus.innerHTML = '';
                
                let seoItems = ['Keyword optimization', 'Technical SEO'];
                if (category === 'ecommerce') seoItems.push('Product page optimization');
                if (category === 'saas') seoItems.push('Blog content strategy', 'Landing page optimization');
                if (allocation.seo > 1000) seoItems.push('Link building', 'Content marketing');
                
                seoItems.forEach(item => {
                    const li = document.createElement('li');
                    li.textContent = item;
                    seoFocus.appendChild(li);
                });
                
                document.getElementById('seoNotes').textContent = getSeoNotes(category, allocation.seo);
                
                // Content Marketing
                const contentTypes = document.getElementById('contentTypes');
                contentTypes.innerHTML = '';
                
                let contentItems = ['Blog posts'];
                if (target === 'gen_z') contentItems.push('Short-form videos', 'Memes');
                if (target === 'millennials') contentItems.push('How-to guides', 'Case studies');
                if (target === 'business') contentItems.push('Whitepapers', 'Webinars');
                if (category === 'ecommerce') contentItems.push('Product videos', 'User-generated content');
                
                contentItems.forEach(item => {
                    const li = document.createElement('li');
                    li.textContent = item;
                    contentTypes.appendChild(li);
                });
                
                document.getElementById('contentNotes').textContent = getContentNotes(target, allocation.content);
            }
            
            function setStrategicRecommendations(category, geo, target, budget, duration, price, cpa) {
                const recommendations = document.getElementById('recommendations');
                recommendations.innerHTML = '';
                
                // General recommendations
                addRecommendation(`Focus on platforms where your target audience (${getAudienceName(target)}) is most active.`);
                
                // Budget-specific recommendations
                if (budget < 1000) {
                    addRecommendation('With a limited budget, focus on 1-2 high-impact channels rather than spreading too thin.');
                } else if (budget > 5000) {
                    addRecommendation('Consider A/B testing different ad creatives and audiences to optimize performance.');
                }
                
                // Duration recommendations
                if (duration < 4) {
                    addRecommendation('For short campaigns, prioritize paid channels for immediate results.');
                } else {
                    addRecommendation('With a longer campaign duration, invest in SEO and content marketing for sustainable growth.');
                }
                
                // CPA vs Price analysis
                if (cpa > price * 0.5) {
                    addRecommendation('Your target CPA is high relative to product price. Focus on higher conversion rate strategies.', 'warning');
                }
                
                // Geo-specific recommendations
                if (geo === 'asia') {
                    addRecommendation('Localize your content and ads for Asian markets, considering cultural differences.');
                } else if (geo === 'europe') {
                    addRecommendation('Be mindful of GDPR compliance in your marketing efforts.');
                }
                
                // Category-specific recommendations
                if (category === 'ecommerce') {
                    addRecommendation('Implement retargeting ads to capture abandoned carts and boost conversions.');
                } else if (category === 'saas') {
                    addRecommendation('Develop a lead nurturing sequence to convert free trials to paid subscriptions.');
                }
            }
            
            function addRecommendation(text, type = 'info') {
                const rec = document.createElement('div');
                rec.className = `flex items-start p-3 rounded-lg ${type === 'warning' ? 'bg-yellow-50 text-yellow-800' : 'bg-blue-50 text-blue-800'}`;
                
                const icon = document.createElement('i');
                icon.className = `fas ${type === 'warning' ? 'fa-exclamation-circle mt-1 mr-3' : 'fa-info-circle mt-1 mr-3'}`;
                
                rec.appendChild(icon);
                
                const textNode = document.createElement('span');
                textNode.textContent = text;
                rec.appendChild(textNode);
                
                document.getElementById('recommendations').appendChild(rec);
            }
            
            function getGeoName(geo) {
                const geoMap = {
                    'global': 'Global',
                    'north_america': 'North America',
                    'europe': 'Europe',
                    'asia': 'Asia',
                    'latin_america': 'Latin America',
                    'middle_east': 'Middle East'
                };
                return geoMap[geo] || geo;
            }
            
            function getAudienceName(target) {
                const audienceMap = {
                    'millennials': 'Millennials (25-40)',
                    'gen_z': 'Gen Z (18-24)',
                    'gen_x': 'Gen X (41-56)',
                    'boomers': 'Boomers (57-75)',
                    'women': 'Women',
                    'men': 'Men',
                    'business': 'Business Professionals'
                };
                return audienceMap[target] || target;
            }
            
            function getPaidNotes(category, geo, target, budget) {
                let notes = '';
                
                if (budget < 500) {
                    notes = 'Focus on search ads for high-intent traffic. Consider remarketing to maximize impact.';
                } else {
                    notes = 'Test multiple ad formats (search, display, video) and optimize based on performance.';
                    
                    if (category === 'ecommerce') {
                        notes += ' Prioritize shopping ads and dynamic remarketing.';
                    }
                    
                    if (target === 'gen_z') {
                        notes += ' Allocate a portion to TikTok ads for maximum reach with younger audiences.';
                    }
                }
                
                return notes;
            }
            
            function getSocialNotes(category, target, budget) {
                let notes = '';
                
                if (budget < 300) {
                    notes = 'Focus on organic growth and 1-2 paid social campaigns. User-generated content works well.';
                } else {
                    notes = 'Test different content formats (images, videos, stories) and analyze engagement.';
                    
                    if (target === 'business') {
                        notes += ' LinkedIn sponsored content can be highly effective for B2B.';
                    }
                    
                    if (category === 'education') {
                        notes += ' Educational content and live Q&A sessions perform well in this category.';
                    }
                }
                
                return notes;
            }
            
            function getSeoNotes(category, budget) {
                let notes = '';
                
                if (budget < 500) {
                    notes = 'Focus on on-page SEO improvements and basic technical fixes.';
                } else {
                    notes = 'Consider investing in content creation and link building for long-term growth.';
                    
                    if (category === 'saas') {
                        notes += ' Create comprehensive guides and tutorials targeting relevant keywords.';
                    }
                }
                
                return notes;
            }
            
            function getContentNotes(target, budget) {
                let notes = '';
                
                if (budget < 300) {
                    notes = 'Repurpose content across multiple platforms to maximize reach.';
                } else {
                    notes = 'Invest in high-quality, professional content that showcases your expertise.';
                    
                    if (target === 'gen_z') {
                        notes += ' Short, engaging video content works best for this audience.';
                    }
                }
                
                return notes;
            }
        });
    </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=jaypatch/myhftools" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>