File size: 31,067 Bytes
2641420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cc0fb04
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MediMate AI - Your Health Companion</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.waves.min.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        accent: '#8B5CF6',
                        dark: '#1E293B',
                        light: '#F8FAFC'
                    }
                }
            }
        }
    </script>
    <style>
        .chat-container {
            height: calc(100vh - 200px);
        }
        .typing-indicator span {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #3B82F6;
            margin: 0 2px;
            animation: typingAnimation 1.4s infinite ease-in-out;
        }
        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }
        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }
        @keyframes typingAnimation {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-5px); }
        }
        .progress-ring__circle {
            transition: stroke-dashoffset 0.35s;
            transform: rotate(-90deg);
            transform-origin: 50% 50%;
        }
    </style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans">
    <div id="vanta-bg" class="fixed inset-0 z-0"></div>
    <div class="relative min-h-screen flex flex-col">
        <!-- Header -->
        <header class="bg-white bg-opacity-90 shadow-sm z-10">
            <div class="container mx-auto px-4 py-4 flex items-center justify-between">
                <div class="flex items-center space-x-3">
                    <div class="bg-primary p-2 rounded-full">
                        <i data-feather="heart" class="text-white"></i>
                    </div>
                    <h1 class="text-xl font-bold text-dark">MediMate AI</h1>
                </div>
                <nav>
                    <ul class="flex space-x-6">
                        <li><a href="index.html" class="text-primary font-medium">Home</a></li>
                        <li><a href="health-records.html" class="text-gray-600 hover:text-primary transition">Health Records</a></li>
                        <li><a href="wellness-tracker.html" class="text-gray-600 hover:text-primary transition">Wellness Tracker</a></li>
                        <li><a href="#" class="text-gray-600 hover:text-primary transition">About</a></li>
</ul>
                </nav>
                <button class="bg-primary text-white px-4 py-2 rounded-full hover:bg-blue-600 transition flex items-center">
                    <i data-feather="user" class="mr-2"></i>
                    Sign In
                </button>
            </div>
        </header>

        <!-- Main Content -->
        <main class="flex-grow container mx-auto px-4 py-8 z-10">
            <div class="max-w-6xl mx-auto bg-white bg-opacity-90 rounded-xl shadow-lg overflow-hidden">
                <div class="grid grid-cols-1 lg:grid-cols-3">
                    <!-- Left Panel - User Info -->
                    <div class="bg-dark text-white p-6 lg:p-8">
                        <div class="flex flex-col items-center mb-8">
                            <div class="relative mb-4">
                                <img src="http://static.photos/medical/200x200/42" alt="User" class="w-24 h-24 rounded-full border-4 border-primary">
                                <div class="absolute bottom-0 right-0 bg-secondary rounded-full p-1 border-2 border-white">
                                    <i data-feather="edit-2" class="w-4 h-4 text-white"></i>
                                </div>
                            </div>
                            <h2 class="text-xl font-bold">Alex Johnson</h2>
                            <p class="text-gray-300">Age: 32 | Male</p>
                        </div>

                        <div class="space-y-6">
                            <div>
                                <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-2">Vital Stats</h3>
                                <div class="grid grid-cols-2 gap-4">
                                    <div class="bg-gray-800 p-3 rounded-lg">
                                        <p class="text-sm text-gray-400">Weight</p>
                                        <p class="text-lg font-bold">72 kg</p>
                                    </div>
                                    <div class="bg-gray-800 p-3 rounded-lg">
                                        <p class="text-sm text-gray-400">Height</p>
                                        <p class="text-lg font-bold">175 cm</p>
                                    </div>
                                    <div class="bg-gray-800 p-3 rounded-lg">
                                        <p class="text-sm text-gray-400">BP</p>
                                        <p class="text-lg font-bold">120/80</p>
                                    </div>
                                    <div class="bg-gray-800 p-3 rounded-lg">
                                        <p class="text-sm text-gray-400">Glucose</p>
                                        <p class="text-lg font-bold">96 mg/dL</p>
                                    </div>
                                </div>
                            </div>

                            <div>
                                <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-2">Health Goals</h3>
                                <div class="space-y-3">
                                    <div class="flex items-center justify-between">
                                        <span>Weight Loss</span>
                                        <div class="w-16 h-2 bg-gray-700 rounded-full">
                                            <div class="h-full bg-secondary rounded-full" style="width: 45%"></div>
                                        </div>
                                    </div>
                                    <div class="flex items-center justify-between">
                                        <span>Cardio Fitness</span>
                                        <div class="w-16 h-2 bg-gray-700 rounded-full">
                                            <div class="h-full bg-secondary rounded-full" style="width: 65%"></div>
                                        </div>
                                    </div>
                                    <div class="flex items-center justify-between">
                                        <span>Stress Management</span>
                                        <div class="w-16 h-2 bg-gray-700 rounded-full">
                                            <div class="h-full bg-secondary rounded-full" style="width: 30%"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div>
                                <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-2">Current Recommendations</h3>
                                <div class="space-y-2">
                                    <div class="flex items-start space-x-2">
                                        <div class="mt-1">
                                            <i data-feather="check-circle" class="text-secondary"></i>
                                        </div>
                                        <p class="text-sm">Daily 30-min walk</p>
                                    </div>
                                    <div class="flex items-start space-x-2">
                                        <div class="mt-1">
                                            <i data-feather="check-circle" class="text-secondary"></i>
                                        </div>
                                        <p class="text-sm">Meditation 10 min/day</p>
                                    </div>
                                    <div class="flex items-start space-x-2">
                                        <div class="mt-1">
                                            <i data-feather="check-circle" class="text-secondary"></i>
                                        </div>
                                        <p class="text-sm">Increase water intake</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Right Panel - Chat Interface -->
                    <div class="lg:col-span-2 flex flex-col">
                        <div class="p-6 border-b border-gray-200">
                            <h2 class="text-xl font-bold text-dark">Health Assistant</h2>
                            <p class="text-gray-600">Ask me anything about your health and wellness</p>
                        </div>
        <div class="chat-container overflow-y-auto p-6 space-y-4" id="chat-container">
            <!-- Chat messages will be dynamically inserted here -->
        </div>
<div class="p-4 border-t border-gray-200">
                            <form class="flex items-center space-x-2">
                                <div class="flex-grow relative">
                                    <input type="text" placeholder="Ask about your health..." class="w-full px-4 py-3 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
                                    <button type="button" class="absolute right-3 top-3 text-gray-500 hover:text-primary">
                                        <i data-feather="mic"></i>
                                    </button>
                                </div>
                                <button type="submit" class="bg-primary text-white p-3 rounded-full hover:bg-blue-600 transition">
                                    <i data-feather="send"></i>
                                </button>
                            </form>
                            <div class="mt-2 text-xs text-gray-500 flex items-center">
                                <i data-feather="info" class="w-3 h-3 mr-1"></i>
                                <span>MediMate AI provides health information but doesn't replace professional medical advice.</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Health Tracking Section -->
            <div class="mt-12 bg-white bg-opacity-90 rounded-xl shadow-lg p-8">
                <div class="flex items-center justify-between mb-6">
                    <h2 class="text-xl font-bold text-dark">Your Health Progress</h2>
                    <button class="text-primary font-medium flex items-center">
                        <i data-feather="plus" class="mr-2"></i>
                        Add Tracking
                    </button>
                </div>

                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <!-- Activity Tracking -->
                    <div class="bg-gray-50 rounded-lg p-6">
                        <div class="flex items-center justify-between mb-4">
                            <h3 class="font-semibold">Daily Activity</h3>
                            <div class="relative w-16 h-16">
                                <svg class="w-full h-full" viewBox="0 0 36 36">
                                    <path d="M18 2.0845
                                            a 15.9155 15.9155 0 0 1 0 31.831
                                            a 15.9155 15.9155 0 0 1 0 -31.831"
                                        fill="none"
                                        stroke="#E5E7EB"
                                        stroke-width="3"
                                        stroke-dasharray="100, 100" />
                                    <path d="M18 2.0845
                                            a 15.9155 15.9155 0 0 1 0 31.831
                                            a 15.9155 15.9155 0 0 1 0 -31.831"
                                        fill="none"
                                        stroke="#10B981"
                                        stroke-width="3"
                                        stroke-dasharray="70, 100" />
                                    <text x="18" y="20.5" text-anchor="middle" font-size="10" fill="#10B981">70%</text>
                                </svg>
                            </div>
                        </div>
                        <div class="space-y-3">
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Steps</span>
                                <span class="font-medium">6,843/10,000</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Active Minutes</span>
                                <span class="font-medium">28/30</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Distance</span>
                                <span class="font-medium">4.2/5 km</span>
                            </div>
                        </div>
                        <button class="mt-4 w-full py-2 bg-primary bg-opacity-10 text-primary rounded-lg text-sm font-medium hover:bg-opacity-20 transition">
                            View Details
                        </button>
                    </div>

                    <!-- Nutrition Tracking -->
                    <div class="bg-gray-50 rounded-lg p-6">
                        <div class="flex items-center justify-between mb-4">
                            <h3 class="font-semibold">Daily Nutrition</h3>
                            <div class="relative w-16 h-16">
                                <svg class="w-full h-full" viewBox="0 0 36 36">
                                    <path d="M18 2.0845
                                            a 15.9155 15.9155 0 0 1 0 31.831
                                            a 15.9155 15.9155 0 0 1 0 -31.831"
                                        fill="none"
                                        stroke="#E5E7EB"
                                        stroke-width="3"
                                        stroke-dasharray="100, 100" />
                                    <path d="M18 2.0845
                                            a 15.9155 15.9155 0 0 1 0 31.831
                                            a 15.9155 15.9155 0 0 1 0 -31.831"
                                        fill="none"
                                        stroke="#8B5CF6"
                                        stroke-width="3"
                                        stroke-dasharray="55, 100" />
                                    <text x="18" y="20.5" text-anchor="middle" font-size="10" fill="#8B5CF6">55%</text>
                                </svg>
                            </div>
                        </div>
                        <div class="space-y-3">
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Calories</span>
                                <span class="font-medium">1,450/2,000</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Protein</span>
                                <span class="font-medium">65/100g</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Water</span>
                                <span class="font-medium">5/8 glasses</span>
                            </div>
                        </div>
                        <button class="mt-4 w-full py-2 bg-accent bg-opacity-10 text-accent rounded-lg text-sm font-medium hover:bg-opacity-20 transition">
                            View Details
                        </button>
                    </div>

                    <!-- Mental Health Tracking -->
                    <div class="bg-gray-50 rounded-lg p-6">
                        <div class="flex items-center justify-between mb-4">
                            <h3 class="font-semibold">Mental Wellness</h3>
                            <div class="relative w-16 h-16">
                                <svg class="w-full h-full" viewBox="0 0 36 36">
                                    <path d="M18 2.0845
                                            a 15.9155 15.9155 0 0 1 0 31.831
                                            a 15.9155 15.9155 0 0 1 0 -31.831"
                                        fill="none"
                                        stroke="#E5E7EB"
                                        stroke-width="3"
                                        stroke-dasharray="100, 100" />
                                    <path d="M18 2.0845
                                            a 15.9155 15.9155 0 0 1 0 31.831
                                            a 15.9155 15.9155 0 0 1 0 -31.831"
                                        fill="none"
                                        stroke="#3B82F6"
                                        stroke-width="3"
                                        stroke-dasharray="40, 100" />
                                    <text x="18" y="20.5" text-anchor="middle" font-size="10" fill="#3B82F6">40%</text>
                                </svg>
                            </div>
                        </div>
                        <div class="space-y-3">
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Stress Level</span>
                                <span class="font-medium">Medium</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Sleep Quality</span>
                                <span class="font-medium">Fair</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-sm">Meditation</span>
                                <span class="font-medium">3/7 days</span>
                            </div>
                        </div>
                        <button class="mt-4 w-full py-2 bg-primary bg-opacity-10 text-primary rounded-lg text-sm font-medium hover:bg-opacity-20 transition">
                            View Details
                        </button>
                    </div>
                </div>
            </div>
        </main>

        <!-- Footer -->
        <footer class="bg-dark text-white py-8 z-10">
            <div class="container mx-auto px-4">
                <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                    <div>
                        <h3 class="text-lg font-semibold mb-4">MediMate AI</h3>
                        <p class="text-gray-400 text-sm">Your personalized health companion providing AI-powered medical insights and wellness tracking.</p>
                    </div>
                    <div>
                        <h4 class="text-md font-semibold mb-4">Quick Links</h4>
                        <ul class="space-y-2 text-sm text-gray-400">
                            <li><a href="#" class="hover:text-white transition">Health Assessment</a></li>
                            <li><a href="#" class="hover:text-white transition">Wellness Programs</a></li>
                            <li><a href="#" class="hover:text-white transition">Medical Resources</a></li>
                            <li><a href="#" class="hover:text-white transition">FAQ</a></li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="text-md font-semibold mb-4">Legal</h4>
                        <ul class="space-y-2 text-sm text-gray-400">
                            <li><a href="#" class="hover:text-white transition">Privacy Policy</a></li>
                            <li><a href="#" class="hover:text-white transition">Terms of Service</a></li>
                            <li><a href="#" class="hover:text-white transition">Medical Disclaimer</a></li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="text-md font-semibold mb-4">Contact</h4>
                        <ul class="space-y-2 text-sm text-gray-400">
                            <li class="flex items-center">
                                <i data-feather="mail" class="w-4 h-4 mr-2"></i>
                                <span>support@medimate.ai</span>
                            </li>
                            <li class="flex items-center">
                                <i data-feather="phone" class="w-4 h-4 mr-2"></i>
                                <span>+1 (555) 123-4567</span>
                            </li>
                            <li class="flex items-center">
                                <i data-feather="map-pin" class="w-4 h-4 mr-2"></i>
                                <span>San Francisco, CA</span>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="border-t border-gray-800 mt-8 pt-6 text-sm text-gray-400">
                    <div class="flex flex-col md:flex-row justify-between items-center">
                        <p>© 2023 MediMate AI. All rights reserved.</p>
                        <div class="flex space-x-4 mt-4 md:mt-0">
                            <a href="#" class="hover:text-white transition"><i data-feather="facebook"></i></a>
                            <a href="#" class="hover:text-white transition"><i data-feather="twitter"></i></a>
                            <a href="#" class="hover:text-white transition"><i data-feather="instagram"></i></a>
                            <a href="#" class="hover:text-white transition"><i data-feather="linkedin"></i></a>
                        </div>
                    </div>
                </div>
            </div>
        </footer>
    </div>

    <script>
        // Initialize Vanta.js background
        VANTA.WAVES({
            el: "#vanta-bg",
            mouseControls: true,
            touchControls: true,
            gyroControls: false,
            minHeight: 200.00,
            minWidth: 200.00,
            scale: 1.00,
            scaleMobile: 1.00,
            color: 0x3b82f6,
            shininess: 35.00,
            waveHeight: 15.00,
            waveSpeed: 0.75,
            zoom: 0.85
        });

        // Initialize Feather Icons
        feather.replace();

        // Chat functionality
        const chatContainer = document.querySelector('.chat-container');
        const chatForm = document.querySelector('form');
        const chatInput = chatForm.querySelector('input');

        chatForm.addEventListener('submit', function(e) {
            e.preventDefault();
            const message = chatInput.value.trim();
            if (message) {
                // Add user message
                addMessage(message, 'user');
                chatInput.value = '';
                
                // Show typing indicator
                showTypingIndicator();
                
                // Simulate AI response after delay
                setTimeout(() => {
                    removeTypingIndicator();
                    const aiResponse = getAIResponse(message);
                    addMessage(aiResponse, 'ai');
                    scrollToBottom();
                }, 1500);
            }
        });

        function addMessage(text, sender) {
            const messageDiv = document.createElement('div');
            messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
            
            const messageContent = document.createElement('div');
            messageContent.className = sender === 'user' 
                ? 'bg-primary text-white rounded-lg p-4 max-w-xs lg:max-w-md' 
                : 'bg-gray-100 rounded-lg p-4 max-w-xs lg:max-w-md';
            messageContent.innerHTML = `<p>${text}</p>`;
            
            messageDiv.appendChild(messageContent);
            chatContainer.appendChild(messageDiv);
            scrollToBottom();
        }

        function showTypingIndicator() {
            const typingDiv = document.createElement('div');
            typingDiv.className = 'flex justify-start';
            typingDiv.id = 'typing-indicator';
            
            const typingContent = document.createElement('div');
            typingContent.className = 'bg-gray-100 rounded-lg p-4 max-w-xs lg:max-w-md';
            typingContent.innerHTML = `
                <div class="typing-indicator flex items-center">
                    <span></span>
                    <span></span>
                    <span></span>
                </div>
            `;
            
            typingDiv.appendChild(typingContent);
            chatContainer.appendChild(typingDiv);
            scrollToBottom();
        }

        function removeTypingIndicator() {
            const typingIndicator = document.getElementById('typing-indicator');
            if (typingIndicator) {
                typingIndicator.remove();
            }
        }

        function scrollToBottom() {
            chatContainer.scrollTop = chatContainer.scrollHeight;
        }
        // Enhanced AI response with tracking capabilities
        function getAIResponse(userMessage) {
            const userData = {
                weight: 72,
                height: 175,
                bloodPressure: "120/80",
                lastCheckup: "2023-03-15",
                medications: ["Vitamin D3", "Omega-3 Fish Oil"]
            };

            userMessage = userMessage.toLowerCase();
            let response = "";
            let actionButtons = "";

            if (userMessage.includes("headache")) {
                response = `Based on your health profile (BP: ${userData.bloodPressure}, Weight: ${userData.weight}kg), headaches could be caused by:\n1. Stress (your last checkup was ${getDaysSince(userData.lastCheckup)} days ago)\n2. Dehydration\n3. Eye strain from screens\n\nRecommendations:\n1. Drink 2L water daily (currently tracking)\n2. Practice 5-min deep breathing 3x/day\n3. Take screen breaks every 30 mins`;
                actionButtons = `<div class="mt-4 flex flex-wrap gap-2">
                    <button onclick="trackRecommendation('water')" class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm flex items-center">
                        <i data-feather="droplet" class="w-3 h-3 mr-1"></i> Track Water
                    </button>
                    <button onclick="startBreathingExercise()" class="bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm flex items-center">
                        <i data-feather="activity" class="w-3 h-3 mr-1"></i> Start Breathing
                    </button>
                    <button onclick="showReminderSettings()" class="bg-purple-100 text-purple-800 px-3 py-1 rounded-full text-sm flex items-center">
                        <i data-feather="clock" class="w-3 h-3 mr-1"></i> Set Reminders
                    </button>
                </div>`;
            } 
            else if (userMessage.includes("sleep")) {
                response = `Sleep is crucial for recovery. Based on your activity data:\n1. Aim for 7-8 hours nightly\n2. Try going to bed by 10:30PM\n3. Limit caffeine after 2PM\n\nI can help track your sleep patterns and suggest wind-down routines.`;
                actionButtons = `<div class="mt-4 flex flex-wrap gap-2">
                    <button onclick="trackSleep()" class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm flex items-center">
                        <i data-feather="moon" class="w-3 h-3 mr-1"></i> Log Sleep
                    </button>
                    <button onclick="showSleepGuide()" class="bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm flex items-center">
                        <i data-feather="book-open" class="w-3 h-3 mr-1"></i> Sleep Guide
                    </button>
                </div>`;
            }
            else {
                response = "I'm analyzing your health profile to give personalized advice. Could you share more details about your concern?";
            }

            return {text: response, buttons: actionButtons};
        }

        // Helper function to get days since last checkup
        function getDaysSince(dateString) {
            const oneDay = 24 * 60 * 60 * 1000;
            const lastDate = new Date(dateString);
            const today = new Date();
            return Math.round(Math.abs((today - lastDate) / oneDay));
        }

        // Tracking functions
        function trackRecommendation(type) {
            addSystemMessage(`Started tracking your ${type} intake. I'll check in with you daily.`);
            // In a real app, would connect to backend tracking system
        }

        function startBreathingExercise() {
            addSystemMessage(`Let's begin a 5-minute breathing exercise. Breathe in... (2 sec) Hold... (2 sec) Breathe out... (4 sec)`);
            // Would trigger guided breathing animation
        }

        function addSystemMessage(text) {
            const messageDiv = document.createElement('div');
            messageDiv.className = 'flex justify-start';
            
            const messageContent = document.createElement('div');
            messageContent.className = 'bg-gray-100 rounded-lg p-4 max-w-xs lg:max-w-md';
            messageContent.innerHTML = `<p>${text}</p>`;
            
            messageDiv.appendChild(messageContent);
            document.getElementById('chat-container').appendChild(messageDiv);
            scrollToBottom();
        }
</script>
</body>
</html>