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

// Tab switching functionality
function switchTab(tabName) {
    // Hide all tab contents
    const tabContents = document.querySelectorAll('.tab-content');
    tabContents.forEach(content => {
        content.classList.add('hidden');
    });
    
    // Show selected tab
    const selectedTab = document.getElementById(tabName);
    if (selectedTab) {
        selectedTab.classList.remove('hidden');
    }
    
    // Update tab button colors
    const tabButtons = document.querySelectorAll('.tab-btn');
    tabButtons.forEach(btn => {
        btn.classList.remove('text-green-600');
        btn.classList.add('text-gray-600');
    });
    
    // Highlight active tab button
    const activeBtn = document.querySelector(`button[onclick="switchTab('${tabName}')"]`);
    if (activeBtn) {
        activeBtn.classList.remove('text-gray-600');
        activeBtn.classList.add('text-green-600');
    }
    
    // Re-initialize feather icons
    feather.replace();
    
    // Initialize chart if graph tab is selected
    if (tabName === 'graph') {
        setTimeout(() => initChart(), 100);
    }
}

// Chart functionality
let healthChart = null;

function initChart() {
    const canvas = document.getElementById('healthChart');
    if (!canvas) return;
    
    const ctx = canvas.getContext('2d');
    
    // Sample data for 7 days
    const labels = ['จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.', 'อา.'];
    const fatData = [29.1, 28.9, 28.8, 28.7, 28.6, 28.5, 28.4];
    const muscleData = [30.2, 30.4, 30.5, 30.8, 30.9, 31.0, 31.2];
    const weightData = [67.0, 66.8, 66.7, 66.6, 66.5, 66.4, 66.4];
    
    // Simple line chart drawing
    drawLineChart(ctx, canvas.width, canvas.height, labels, [
        { data: fatData, color: '#3B82F6', label: 'ไขมัน %' },
        { data: muscleData, color: '#10B981', label: 'กล้ามเนื้อ kg' },
        { data: weightData, color: '#8B5CF6', label: 'น้ำหนัก kg' }
    ]);
}

function drawLineChart(ctx, width, height, labels, datasets) {
    // Clear canvas
    ctx.clearRect(0, 0, width, height);
    
    const padding = 40;
    const graphWidth = width - padding * 2;
    const graphHeight = height - padding * 2;
    const dataPoints = labels.length;
    
    // Draw axes
    ctx.strokeStyle = '#E5E7EB';
    ctx.lineWidth = 1;
    ctx.beginPath();
    ctx.moveTo(padding, padding);
    ctx.lineTo(padding, height - padding);
    ctx.lineTo(width - padding, height - padding);
    ctx.stroke();
    
    // Draw grid lines
    ctx.strokeStyle = '#F3F4F6';
    for (let i = 0; i <= 5; i++) {
        const y = padding + (graphHeight / 5) * i;
        ctx.beginPath();
        ctx.moveTo(padding, y);
        ctx.lineTo(width - padding, y);
        ctx.stroke();
    }
    
    // Draw labels
    ctx.fillStyle = '#6B7280';
    ctx.font = '12px Prompt';
    labels.forEach((label, i) => {
        const x = padding + (graphWidth / (dataPoints - 1)) * i;
        ctx.fillText(label, x - 10, height - padding + 20);
    });
    
    // Draw data lines
    datasets.forEach(dataset => {
        ctx.strokeStyle = dataset.color;
        ctx.lineWidth = 2;
        ctx.beginPath();
        
        dataset.data.forEach((value, i) => {
            const x = padding + (graphWidth / (dataPoints - 1)) * i;
            const normalizedValue = (value - Math.min(...dataset.data)) / (Math.max(...dataset.data) - Math.min(...dataset.data));
            const y = height - padding - (normalizedValue * graphHeight * 0.8 + graphHeight * 0.1);
            
            if (i === 0) {
                ctx.moveTo(x, y);
            } else {
                ctx.lineTo(x, y);
            }
        });
        
        ctx.stroke();
        
        // Draw data points
        dataset.data.forEach((value, i) => {
            const x = padding + (graphWidth / (dataPoints - 1)) * i;
            const normalizedValue = (value - Math.min(...dataset.data)) / (Math.max(...dataset.data) - Math.min(...dataset.data));
            const y = height - padding - (normalizedValue * graphHeight * 0.8 + graphHeight * 0.1);
            
            ctx.fillStyle = dataset.color;
            ctx.beginPath();
            ctx.arc(x, y, 3, 0, Math.PI * 2);
            ctx.fill();
        });
    });
}

// Update graph based on time range
function updateGraph(days) {
    // Update button styles
    const buttons = document.querySelectorAll('[onclick^="updateGraph"]');
    buttons.forEach(btn => {
        btn.classList.remove('bg-green-500', 'text-white');
        btn.classList.add('bg-gray-200', 'text-gray-700');
    });
    
    event.target.classList.remove('bg-gray-200', 'text-gray-700');
    event.target.classList.add('bg-green-500', 'text-white');
    
    // Re-initialize chart with new data
    initChart();
}

// Add to cart functionality
function addToCart(productName, price) {
    // Create notification
    const notification = document.createElement('div');
    notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50';
    notification.textContent = `เพิ่ม ${productName} ลงตะกร้าแล้ว`;
    document.body.appendChild(notification);
    
    // Animate in
    notification.style.animation = 'slideIn 0.3s ease-out';
    
    // Remove after 2 seconds
    setTimeout(() => {
        notification.style.animation = 'slideOut 0.3s ease-out';
        setTimeout(() => {
            document.body.removeChild(notification);
        }, 300);
    }, 2000);
}

// Buy now functionality
function buyNow(productName, price) {
    // Create confirmation modal
    const modal = document.createElement('div');
    modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
    modal.innerHTML = `
        <div class="bg-white rounded-2xl p-6 m-4 max-w-sm w-full">
            <h3 class="text-lg font-bold mb-4">ยืนยันการสั่งซื้อ</h3>
            <p class="text-gray-600 mb-4">คุณต้องการสั่งซื้อ ${productName} ในราคา ${price} ใช่หรือไม่?</p>
            <div class="flex space-x-2">
                <button onclick="this.closest('.fixed').remove()" class="flex-1 bg-gray-200 text-gray-700 py-2 rounded-lg font-medium">ยกเลิก</button>
                <button onclick="confirmPurchase('${productName}')" class="flex-1 bg-green-500 text-white py-2 rounded-lg font-medium">ยืนยัน</button>
            </div>
        </div>
    `;
    document.body.appendChild(modal);
}

function confirmPurchase(productName) {
    // Remove modal
    document.querySelector('.fixed.inset-0').remove();
    
    // Show success notification
    const notification = document.createElement('div');
    notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50';
    notification.textContent = `สั่งซื้อ ${productName} สำเร็จแล้ว`;
    document.body.appendChild(notification);
    
    setTimeout(() => {
        notification.remove();
    }, 3000);
}

// Contact coach functionality
function contactCoach() {
    const modal = document.createElement('div');
    modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
    modal.innerHTML = `
        <div class="bg-white rounded-2xl p-6 m-4 max-w-sm w-full">
            <h3 class="text-lg font-bold mb-4">ติดต่อโค้ชแนต</h3>
            <p class="text-gray-600 mb-4">คุณสามารถติดต่อโค้ชได้ผ่านช่องทางต่อไปนี้:</p>
            <div class="space-y-2 mb-4">
                <div class="flex items-center space-x-2">
                    <i data-feather="message-circle" class="w-5 h-5 text-green-500"></i>
                    <span class="text-sm">LINE: @wpcoach</span>
                </div>
                <div class="flex items-center space-x-2">
                    <i data-feather="phone" class="w-5 h-5 text-green-500"></i>
                    <span class="text-sm">โทร: 099-123-4567</span>
                </div>
                <div class="flex items-center space-x-2">
                    <i data-feather="mail" class="w-5 h-5 text-green-500"></i>
                    <span class="text-sm">Email: coach@wpwellnet.com</span>
                </div>
            </div>
            <button onclick="this.closest('.fixed').remove()" class="w-full bg-green-500 text-white py-2 rounded-lg font-medium">ตกลง</button>
        </div>
    `;
    document.body.appendChild(modal);
    feather.replace();
}

// Animation styles
const style = document.createElement('style');
style.textContent = `
    @keyframes slideIn {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
    
    @keyframes slideOut {
        from {
            transform: translateX(0);
            opacity: 1;
        }
        to {
            transform: translateX(100%);
            opacity: 0;
        }
    }
`;
document.head.appendChild(style);

// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
    feather.replace();
    
    // Add click handlers to product buttons
    const addButtons = document.querySelectorAll('button:not([onclick])');
    addButtons.forEach(btn => {
        if (btn.textContent.includes('เพิ่มลงตะกร้า')) {
            const card = btn.closest('.bg-white');
            const productName = card.querySelector('h3')?.textContent || 'สินค้า';
            btn.onclick = () => addToCart(productName);
        } else if (btn.textContent.includes('ซื้อทันที')) {
            const card = btn.closest('.bg-white');
            const productName = card.querySelector('h3')?.textContent || 'สินค้า';
            const price = card.querySelector('.text-green-600')?.textContent || '฿0';
            btn.onclick = () => buyNow(productName, price);
        } else if (btn.textContent.includes('ปรึกษา')) {
            btn.onclick = contactCoach;
        } else if (btn.textContent.includes('ซื้อซ้ำ')) {
            const product = btn.closest('.flex').querySelector('p.font-medium')?.textContent || 'สินค้า';
            btn.onclick = () => buyNow(product, 'ราคาพิเศษ');
        }
    });
    
    // Mission toggle functionality
    const missionItems = document.querySelectorAll('.flex.items-center.justify-between.p-4');
    missionItems.forEach(item => {
        if (item.textContent.includes('ไม่สำเร็จ')) {
            item.style.cursor = 'pointer';
            item.onclick = function() {
                if (confirm('ต้องการทำภารกิจนี้ใหม่ใช่หรือไม่?')) {
                    location.reload();
                }
            };
        }
    });
    
    // Subscription reminder buttons
    const reminderButtons = document.querySelectorAll('.bg-blue-50 button');
    reminderButtons.forEach(btn => {
        btn.onclick = function() {
            reminderButtons.forEach(b => {
                b.classList.remove('bg-green-500', 'text-white');
                b.classList.add('bg-white');
            });
            this.classList.remove('bg-white');
            this.classList.add('bg-green-500', 'text-white');
            
            const notification = document.createElement('div');
            notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50';
            notification.textContent = `ตั้งเตือน ${this.textContent} แล้ว`;
            document.body.appendChild(notification);
            
            setTimeout(() => {
                notification.remove();
            }, 2000);
        };
    });
});
<!-- Header -->
    <header class="bg-white shadow-sm fixed top-0 w-full z-40">
        <div class="container mx-auto px-4 py-3 flex items-center justify-between">
            <div class="flex items-center space-x-2">
                <div class="w-10 h-10 bg-green-300 rounded-full flex items-center justify-center">
                    <span class="text-white font-bold text-xl">W</span>
                </div>
                <span class="font-semibold text-lg">WP WELLNET</span>
            </div>
            <div class="flex items-center space-x-4">
                <button class="relative">
                    <i data-feather="bell" class="w-6 h-6 text-gray-600"></i>
                    <span class="absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full"></span>
                </button>
                <div class="w-10 h-10 bg-gradient-to-r from-green-300 to-green-400 rounded-full flex items-center justify-center">
                    <span class="text-white font-semibold">ก</span>
                </div>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="pt-16 pb-20 min-h-screen">
        <div class="container mx-auto px-4 py-4">
            <!-- Tab Content -->
            <div id="tab-content">
                <!-- Dashboard Tab -->
                <div id="dashboard" class="tab-content">
                    <div class="bg-gradient-to-r from-green-200 to-green-300 rounded-2xl p-6 mb-6 text-white">
                        <h2 class="text-2xl font-bold mb-2">ยินดีต้อนรับกลับมา</h2>
                        <p class="text-lg">คุณมีเป้าหมาย: ลดไขมัน 3% ใน 60 วัน</p>
                    </div>

                    <!-- Today's Stats -->
                    <div class="bg-white rounded-2xl p-4 mb-6 shadow-sm">
                        <h3 class="font-semibold text-lg mb-4">ข้อมูลวันนี้</h3>
                        <div class="grid grid-cols-2 gap-4">
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <div class="flex items-center justify-between">
                                    <span class="text-gray-600 text-sm">ไขมัน</span>
                                    <i data-feather="trending-down" class="w-4 h-4 text-green-500"></i>
                                </div>
                                <p class="text-xl font-bold">28.5%</p>
                                <p class="text-xs text-gray-500">เป้าหมาย: 25%</p>
                            </div>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <div class="flex items-center justify-between">
                                    <span class="text-gray-600 text-sm">กล้ามเนื้อ</span>
                                    <i data-feather="check-circle" class="w-4 h-4 text-green-500"></i>
                                </div>
                                <p class="text-xl font-bold">31.2 กก.</p>
                                <p class="text-xs text-green-500">ตามเป้าหมาย</p>
                            </div>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <span class="text-gray-600 text-sm">น้ำหนัก</span>
                                <p class="text-xl font-bold">66.4 กก.</p>
                            </div>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <span class="text-gray-600 text-sm">BMR</span>
                                <p class="text-xl font-bold">1,540 kcal</p>
                            </div>
                        </div>
                    </div>

                    <!-- Status Today -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm">
                        <h3 class="font-semibold text-lg mb-4">สถานะวันนี้</h3>
                        <div class="space-y-3">
                            <div class="flex items-center justify-between p-3 bg-orange-50 rounded-lg">
                                <div class="flex items-center space-x-3">
                                    <span class="text-2xl">🔋</span>
                                    <div>
                                        <p class="font-medium">เผาผลาญแล้ว</p>
                                        <p class="text-sm text-gray-500">เป้าหมาย 2,000 kcal</p>
                                    </div>
                                </div>
                                <span class="font-bold text-orange-600">1,830 kcal</span>
                            </div>
                            <div class="flex items-center justify-between p-3 bg-blue-50 rounded-lg">
                                <div class="flex items-center space-x-3">
                                    <span class="text-2xl">🏃‍♀️</span>
                                    <div>
                                        <p class="font-medium">เดินแล้ว</p>
                                        <p class="text-sm text-gray-500">เป้าหมาย 8,000 ก้าว</p>
                                    </div>
                                </div>
                                <span class="font-bold text-blue-600">6,200 ก้าว</span>
                            </div>
                            <div class="p-3 bg-green-50 rounded-lg">
                                <p class="font-medium mb-2">Meal Plan วันนี้</p>
                                <div class="flex space-x-4">
                                    <span class="flex items-center space-x-1">
                                        <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                        <span class="text-sm">เช้า</span>
                                    </span>
                                    <span class="flex items-center space-x-1">
                                        <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                        <span class="text-sm">กลางวัน</span>
                                    </span>
                                    <span class="flex items-center space-x-1">
                                        <i data-feather="x" class="w-4 h-4 text-red-500"></i>
                                        <span class="text-sm">เย็น</span>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Journey Tab -->
                <div id="journey" class="tab-content hidden">
                    <div class="bg-gradient-to-r from-purple-200 to-purple-300 rounded-2xl p-6 mb-6 text-white">
                        <h2 class="text-2xl font-bold mb-2">Fit Journey 60 วัน</h2>
                        <p class="text-lg">วันที่ 18 จาก 60</p>
                    </div>

                    <!-- Progress Bar -->
                    <div class="bg-white rounded-2xl p-4 mb-6 shadow-sm">
                        <div class="mb-4">
                            <div class="flex justify-between mb-2">
                                <span class="text-sm font-medium">ความคืบหน้า</span>
                                <span class="text-sm font-medium">18/60 วัน</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-3">
                                <div class="bg-gradient-to-r from-green-400 to-green-500 h-3 rounded-full" style="width: 30%"></div>
                            </div>
                        </div>
                        <div class="text-center">
                            <p class="text-sm text-gray-600">ทำภารกิจสะสม: 44 / 60 วัน</p>
                            <p class="font-semibold mt-2">เป้าหมาย: ลดไขมัน 3% ภายใน 60 วัน</p>
                        </div>
                    </div>

                    <!-- Today's Missions -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm">
                        <h3 class="font-semibold text-lg mb-4">ภารกิจวันนี้</h3>
                        <div class="space-y-3">
                            <div class="flex items-center justify-between p-4 bg-green-50 rounded-lg border border-green-200">
                                <div class="flex items-center space-x-3">
                                    <div class="w-10 h-10 bg-green-500 rounded-full flex items-center justify-center">
                                        <i data-feather="check" class="w-5 h-5 text-white"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium">กินโปรตีนเช้า 25g</p>
                                        <p class="text-sm text-gray-500">เวลา 07:00-09:00</p>
                                    </div>
                                </div>
                                <span class="text-green-600 font-semibold">✅ สำเร็จ</span>
                            </div>
                            <div class="flex items-center justify-between p-4 bg-green-50 rounded-lg border border-green-200">
                                <div class="flex items-center space-x-3">
                                    <div class="w-10 h-10 bg-green-500 rounded-full flex items-center justify-center">
                                        <i data-feather="check" class="w-5 h-5 text-white"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium">เดินเร็ว 30 นาที</p>
                                        <p class="text-sm text-gray-500">เวลา 17:00-19:00</p>
                                    </div>
                                </div>
                                <span class="text-green-600 font-semibold">✅ สำเร็จ</span>
                            </div>
                            <div class="flex items-center justify-between p-4 bg-red-50 rounded-lg border border-red-200">
                                <div class="flex items-center space-x-3">
                                    <div class="w-10 h-10 bg-red-500 rounded-full flex items-center justify-center">
                                        <i data-feather="x" class="w-5 h-5 text-white"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium">งดน้ำหวานทั้งวัน</p>
                                        <p class="text-sm text-gray-500">ตลอดทั้งวัน</p>
                                    </div>
                                </div>
                                <span class="text-red-600 font-semibold">❌ ไม่สำเร็จ</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Graph Tab -->
                <div id="graph" class="tab-content hidden">
                    <div class="bg-white rounded-2xl p-4 shadow-sm mb-4">
                        <h3 class="font-semibold text-lg mb-4">กราฟสุขภาพ</h3>
                        
                        <!-- Time Range Selector -->
                        <div class="flex space-x-2 mb-4">
                            <button onclick="updateGraph(7)" class="px-4 py-2 bg-green-500 text-white rounded-lg text-sm font-medium">7 วัน</button>
                            <button onclick="updateGraph(30)" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg text-sm font-medium">30 วัน</button>
                            <button onclick="updateGraph(60)" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg text-sm font-medium">60 วัน</button>
                        </div>

                        <!-- Graph Container -->
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <canvas id="healthChart" width="400" height="200"></canvas>
                        </div>

                        <!-- Stats Summary -->
                        <div class="grid grid-cols-3 gap-2 mt-4">
                            <div class="text-center p-2 bg-blue-50 rounded-lg">
                                <p class="text-xs text-gray-600">ไขมัน</p>
                                <p class="text-lg font-bold text-blue-600">28.4%</p>
                                <p class="text-xs text-green-500">-0.7%</p>
                            </div>
                            <div class="text-center p-2 bg-green-50 rounded-lg">
                                <p class="text-xs text-gray-600">กล้ามเนื้อ</p>
                                <p class="text-lg font-bold text-green-600">31.2kg</p>
                                <p class="text-xs text-green-500">+1.0kg</p>
                            </div>
                            <div class="text-center p-2 bg-purple-50 rounded-lg">
                                <p class="text-xs text-gray-600">น้ำหนัก</p>
                                <p class="text-lg font-bold text-purple-600">66.4kg</p>
                                <p class="text-xs text-green-500">-0.6kg</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Products Tab -->
                <div id="products" class="tab-content hidden">
                    <div class="bg-gradient-to-r from-blue-200 to-blue-300 rounded-2xl p-6 mb-6 text-white">
                        <h2 class="text-xl font-bold mb-2">แนะนำผลิตภัณฑ์</h2>
                        <p class="text-sm">จากข้อมูลของคุณ เราขอแนะนำแพ็กนี้:</p>
                    </div>

                    <!-- Product Cards -->
                    <div class="space-y-4">
                        <!-- FIT BURN Pack -->
                        <div class="bg-white rounded-2xl p-4 shadow-sm">
                            <div class="flex items-center justify-between mb-3">
                                <h3 class="font-bold text-lg">📦 แพ็ก FIT BURN</h3>
                                <span class="bg-orange-100 text-orange-600 px-2 py-1 rounded-full text-sm font-semibold">ยอดนิยม</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center space-x-2">
                                    <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                    <span class="text-sm">Whey-Fit 900g</span>
                                </div>
                                <div class="flex items-center space-x-2">
                                    <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                    <span class="text-sm">Magnesium Complex</span>
                                </div>
                                <div class="flex items-center space-x-2">
                                    <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                    <span class="text-sm">ADEK Vitamins</span>
                                </div>
                            </div>
                            <div class="flex items-center justify-between mb-4">
                                <div>
                                    <span class="text-gray-500 line-through text-sm">฿2,290</span>
                                    <p class="text-2xl font-bold text-green-600">฿1,690</p>
                                    <p class="text-xs text-gray-500">ประหยัด 26%</p>
                                </div>
                                <img src="http://static.photos/fitness/100x100/123" alt="Product" class="w-20 h-20 rounded-lg object-cover">
                            </div>
                            <div class="flex space-x-2">
                                <button class="flex-1 bg-green-500 text-white py-2 rounded-lg font-medium">เพิ่มลงตะกร้า</button>
                                <button class="flex-1 bg-blue-500 text-white py-2 rounded-lg font-medium">ซื้อทันที</button>
                            </div>
                        </div>

                        <!-- Build Lean Pack -->
                        <div class="bg-white rounded-2xl p-4 shadow-sm">
                            <div class="flex items-center justify-between mb-3">
                                <h3 class="font-bold text-lg">📦 แพ็ก Build Lean</h3>
                                <span class="bg-purple-100 text-purple-600 px-2 py-1 rounded-full text-sm font-semibold">เพิ่มกล้าม</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center space-x-2">
                                    <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                    <span class="text-sm">Creatine + CLA</span>
                                </div>
                                <div class="flex items-center space-x-2">
                                    <i data-feather="check" class="w-4 h-4 text-green-500"></i>
                                    <span class="text-sm">Meal Planner</span>
                                </div>
                            </div>
                            <div class="flex items-center justify-between mb-4">
                                <div>
                                    <span class="text-gray-500 line-through text-sm">฿2,490</span>
                                    <p class="text-2xl font-bold text-green-600">฿1,890</p>
                                    <p class="text-xs text-gray-500">ประหยัด 24%</p>
                                </div>
                                <img src="http://static.photos/fitness/100x100/456" alt="Product" class="w-20 h-20 rounded-lg object-cover">
                            </div>
                            <div class="flex space-x-2">
                                <button class="flex-1 bg-green-500 text-white py-2 rounded-lg font-medium">เพิ่มลงตะกร้า</button>
                                <button class="flex-1 bg-blue-500 text-white py-2 rounded-lg font-medium">ซื้อทันที</button>
                            </div>
                        </div>
                    </div>

                    <!-- Subscription Section -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm mt-4">
                        <h3 class="font-semibold text-lg mb-4">ซื้อซ้ำ / Subscription</h3>
                        <div class="space-y-3">
                            <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
                                <div>
                                    <p class="font-medium">Whey-Fit</p>
                                    <p class="text-xs text-gray-500">สั่งล่าสุด: 12 ก.ย.</p>
                                </div>
                                <button class="bg-green-500 text-white px-4 py-1 rounded-lg text-sm">ซื้อซ้ำ</button>
                            </div>
                            <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
                                <div>
                                    <p class="font-medium">MAG-5</p>
                                    <p class="text-xs text-gray-500">สั่งล่าสุด: 5 ก.ย.</p>
                                </div>
                                <button class="bg-green-500 text-white px-4 py-1 rounded-lg text-sm">ซื้อซ้ำ</button>
                            </div>
                        </div>
                        <div class="mt-4 p-3 bg-blue-50 rounded-lg">
                            <p class="text-sm font-medium mb-2">ตั้งเตือนซื้ออัตโนมัติ</p>
                            <div class="flex space-x-2">
                                <button class="px-3 py-1 bg-white rounded text-sm">30 วัน</button>
                                <button class="px-3 py-1 bg-green-500 text-white rounded text-sm">45 วัน</button>
                                <button class="px-3 py-1 bg-white rounded text-sm">60 วัน</button>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Profile Tab -->
                <div id="profile" class="tab-content hidden">
                    <!-- User Info -->
                    <div class="bg-gradient-to-r from-green-200 to-green-300 rounded-2xl p-6 mb-6">
                        <div class="flex items-center space-x-4">
                            <div class="w-20 h-20 bg-white rounded-full flex items-center justify-center">
                                <span class="text-3xl font-bold text-green-500">ก</span>
                            </div>
                            <div class="text-white">
                                <h2 class="text-xl font-bold">กฤติกา ศรีใจดี</h2>
                                <p class="text-sm opacity-90">อายุ 33 ปี</p>
                                <div class="flex items-center space-x-2 mt-2">
                                    <span class="bg-white/20 px-2 py-1 rounded-full text-xs">1,150 คะแนน</span>
                                    <span class="bg-white/20 px-2 py-1 rounded-full text-xs">Gold Member</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Goals -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm mb-4">
                        <h3 class="font-semibold text-lg mb-4">เป้าหมายของฉัน</h3>
                        <div class="space-y-3">
                            <div class="flex justify-between items-center p-3 bg-gray-50 rounded-lg">
                                <span class="text-gray-600">น้ำหนักเป้าหมาย</span>
                                <span class="font-bold">62 กก.</span>
                            </div>
                            <div class="flex justify-between items-center p-3 bg-gray-50 rounded-lg">
                                <span class="text-gray-600">ไขมันเป้าหมาย</span>
                                <span class="font-bold">&lt;25%</span>
                            </div>
                            <div class="flex justify-between items-center p-3 bg-gray-50 rounded-lg">
                                <span class="text-gray-600">กล้ามเนื้อเป้าหมาย</span>
                                <span class="font-bold">33 กก.</span>
                            </div>
                        </div>
                    </div>

                    <!-- Achievements -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm mb-4">
                        <h3 class="font-semibold text-lg mb-4">ความสำเร็จและรางวัล</h3>
                        <div class="space-y-3">
                            <div class="flex items-center space-x-3 p-3 bg-yellow-50 rounded-lg">
                                <span class="text-2xl">🏆</span>
                                <div>
                                    <p class="font-medium">ภารกิจ 7 วันติด</p>
                                    <p class="text-xs text-gray-500">สำเร็จเมื่อ 10 ก.ย.</p>
                                </div>
                            </div>
                            <div class="flex items-center space-x-3 p-3 bg-blue-50 rounded-lg">
                                <span class="text-2xl">🥈</span>
                                <div>
                                    <p class="font-medium">ลดน้ำหนัก 1 กก.แรก</p>
                                    <p class="text-xs text-gray-500">สำเร็จเมื่อ 5 ก.ย.</p>
                                </div>
                            </div>
                            <div class="flex items-center space-x-3 p-3 bg-purple-50 rounded-lg">
                                <span class="text-2xl">🎯</span>
                                <div>
                                    <p class="font-medium">อันดับ 6 กล้ามเพิ่มเร็วที่สุด</p>
                                    <p class="text-xs text-gray-500">ประจำเดือนกันยายน</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Order History -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm mb-4">
                        <h3 class="font-semibold text-lg mb-4">ประวัติการสั่งซื้อ</h3>
                        <div class="space-y-2">
                            <div class="flex justify-between items-center p-2 border-b">
                                <div>
                                    <p class="font-medium text-sm">Whey-Fit 900g</p>
                                    <p class="text-xs text-gray-500">12 ก.ย. 2567</p>
                                </div>
                                <span class="text-green-600 font-semibold">฿690</span>
                            </div>
                            <div class="flex justify-between items-center p-2 border-b">
                                <div>
                                    <p class="font-medium text-sm">MAG-5</p>
                                    <p class="text-xs text-gray-500">5 ก.ย. 2567</p>
                                </div>
                                <span class="text-green-600 font-semibold">฿450</span>
                            </div>
                            <div class="flex justify-between items-center p-2">
                                <div>
                                    <p class="font-medium text-sm">CLA 1000mg</p>
                                    <p class="text-xs text-gray-500">20 ส.ค. 2567</p>
                                </div>
                                <span class="text-green-600 font-semibold">฿890</span>
                            </div>
                        </div>
                    </div>

                    <!-- Coach Contact -->
                    <div class="bg-white rounded-2xl p-4 shadow-sm">
                        <h3 class="font-semibold text-lg mb-4">ติดต่อโค้ช</h3>
                        <div class="flex items-center space-x-3 p-4 bg-green-50 rounded-lg">
                            <div class="w-12 h-12 bg-green-500 rounded-full flex items-center justify-center">
                                <i data-feather="user" class="w-6 h-6 text-white"></i>
                            </div>
                            <div class="flex-1">
                                <p class="font-medium">โค้ชแนต</p>
                                <p class="text-xs text-gray-500">WP Certified FitCoach</p>
                            </div>
                            <button class="bg-green-500 text-white px-4 py-2 rounded-lg text-sm font-medium">ปรึกษา</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- Bottom Navigation -->
    <nav class="fixed bottom-0 w-full bg-white border-t z-40">
        <div class="container mx-auto px-4">
            <div class="flex justify-around items-center py-2">
                <button onclick="switchTab('dashboard')" class="tab-btn flex flex-col items-center p-2 text-green-600">
                    <i data-feather="home" class="w-6 h-6"></i>
                    <span class="text-xs mt-1">หน้าแรก</span>
                </button>
                <button onclick="switchTab('journey')" class="tab-btn flex flex-col items-center p-2 text-gray-600">
                    <i data-feather="calendar" class="w-6 h-6"></i>
                    <span class="text-xs mt-1">แผน 60 วัน</span>
                </button>
                <button onclick="switchTab('graph')" class="tab-btn flex flex-col items-center p-2 text-gray-600">
                    <i data-feather="bar-chart-2" class="w-6 h-6"></i>
                    <span class="text-xs mt-1">กราฟสุขภาพ</span>
                </button>
                <button onclick="switchTab('products')" class="tab-btn flex flex-col items-center p-2 text-gray-600">
                    <i data-feather="shopping-cart" class="w-6 h-6"></i>
                    <span class="text-xs mt-1">สินค้า</span>
                </button>
                <button onclick="switchTab('profile')" class="tab-btn flex flex-col items-center p-2 text-gray-600">
                    <i data-feather="user" class="w-6 h-6"></i>
                    <span class="text-xs mt-1">โปรไฟล์</span>
                </button>
            </div>
        </div>
    </nav>

    <script src="script.js"></script>
    <script>feather.replace();</script>
</body>
</html>