File size: 29,974 Bytes
0a99bd2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Guía Completa de Medicamentos y Posología</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">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3b82f6',
                        secondary: '#10b981',
                        accent: '#f59e0b',
                        dark: '#1e293b',
                        light: '#f8fafc'
                    }
                }
            }
        }
    </script>
    <style>
        .med-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .dosage-table {
            border-collapse: separate;
            border-spacing: 0;
        }
        .dosage-table th {
            position: sticky;
            top: 0;
            background-color: #3b82f6;
            color: white;
        }
        .search-highlight {
            background-color: #fef08a;
        }
        .floating-btn {
            animation: float 3s ease-in-out infinite;
        }
        @keyframes float {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- Header -->
    <header class="bg-gradient-to-r from-primary to-secondary text-white shadow-lg">
        <div class="container mx-auto px-4 py-6">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="flex items-center mb-4 md:mb-0">
                    <img src="https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg" alt="Medicamentos" class="w-16 h-16 rounded-full object-cover mr-4 border-2 border-white">
                    <div>
                        <h1 class="text-3xl font-bold">Guía Farmacéutica</h1>
                        <p class="text-sm opacity-90">Información detallada sobre medicamentos</p>
                    </div>
                </div>
                <div class="relative w-full md:w-64">
                    <input type="text" id="searchInput" placeholder="Buscar medicamento..." class="w-full px-4 py-2 rounded-full text-dark focus:outline-none focus:ring-2 focus:ring-accent">
                    <button class="absolute right-3 top-2 text-gray-500">
                        <i class="fas fa-search"></i>
                    </button>
                </div>
            </div>
        </div>
    </header>

    <!-- Hero Section -->
    <section class="bg-white py-12">
        <div class="container mx-auto px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-8 md:mb-0">
                    <h2 class="text-4xl font-bold text-dark mb-4">Información Farmacológica Completa</h2>
                    <p class="text-lg text-gray-600 mb-6">Accede a datos detallados sobre nombres comerciales, principios activos, posologías recomendadas, interacciones y efectos secundarios de los medicamentos más comunes.</p>
                    <div class="flex flex-wrap gap-3">
                        <button class="bg-primary hover:bg-blue-700 text-white px-6 py-2 rounded-full flex items-center">
                            <i class="fas fa-book-medical mr-2"></i> Ver Guía Completa
                        </button>
                        <button class="border border-primary text-primary hover:bg-blue-50 px-6 py-2 rounded-full flex items-center">
                            <i class="fas fa-file-pdf mr-2"></i> Descargar PDF
                        </button>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <img src="https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg" alt="Medicamentos" class="rounded-lg shadow-xl max-w-full h-auto md:max-w-md border-4 border-white">
                </div>
            </div>
        </div>
    </section>

    <!-- Categories -->
    <section class="bg-gray-100 py-10">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center text-dark mb-10">Categorías de Medicamentos</h2>
            <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
                <div class="bg-white p-6 rounded-xl shadow-md text-center hover:bg-primary hover:text-white transition-all cursor-pointer">
                    <i class="fas fa-heartbeat text-4xl mb-3 text-accent"></i>
                    <h3 class="font-semibold">Cardiovasculares</h3>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md text-center hover:bg-primary hover:text-white transition-all cursor-pointer">
                    <i class="fas fa-brain text-4xl mb-3 text-accent"></i>
                    <h3 class="font-semibold">Neurológicos</h3>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md text-center hover:bg-primary hover:text-white transition-all cursor-pointer">
                    <i class="fas fa-allergies text-4xl mb-3 text-accent"></i>
                    <h3 class="font-semibold">Antialérgicos</h3>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md text-center hover:bg-primary hover:text-white transition-all cursor-pointer">
                    <i class="fas fa-virus text-4xl mb-3 text-accent"></i>
                    <h3 class="font-semibold">Antibióticos</h3>
                </div>
            </div>
        </div>
    </section>

    <!-- Featured Medications -->
    <section class="py-12 bg-white">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center text-dark mb-10">Medicamentos Destacados</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8" id="medicationsContainer">
                <!-- Medication cards will be inserted here by JavaScript -->
            </div>
            
            <div class="text-center mt-10">
                <button id="loadMoreBtn" class="bg-primary hover:bg-blue-700 text-white px-6 py-3 rounded-full font-medium">
                    Cargar más medicamentos <i class="fas fa-chevron-down ml-2"></i>
                </button>
            </div>
        </div>
    </section>

    <!-- Dosage Guide -->
    <section class="py-12 bg-gray-100">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center text-dark mb-10">Guía de Posología</h2>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="overflow-x-auto">
                    <table class="dosage-table w-full">
                        <thead>
                            <tr class="text-left">
                                <th class="px-6 py-4">Medicamento</th>
                                <th class="px-6 py-4">Principio Activo</th>
                                <th class="px-6 py-4">Dosis Adultos</th>
                                <th class="px-6 py-4">Dosis Niños</th>
                                <th class="px-6 py-4">Frecuencia</th>
                            </tr>
                        </thead>
                        <tbody id="dosageTableBody">
                            <!-- Table rows will be inserted here by JavaScript -->
                        </tbody>
                    </table>
                </div>
            </div>
            
            <div class="mt-8 bg-white p-6 rounded-xl shadow-md">
                <h3 class="text-xl font-semibold text-dark mb-4"><i class="fas fa-exclamation-triangle text-accent mr-2"></i> Consideraciones Importantes</h3>
                <ul class="list-disc pl-6 space-y-2 text-gray-700">
                    <li>Las dosis indicadas son generales y pueden variar según criterio médico.</li>
                    <li>Consulte siempre con un profesional de la salud antes de iniciar cualquier tratamiento.</li>
                    <li>No exceda las dosis recomendadas sin supervisión médica.</li>
                    <li>Algunos medicamentos pueden requerir ajustes en pacientes con insuficiencia hepática o renal.</li>
                    <li>Informe a su médico sobre todos los medicamentos que esté tomando para evitar interacciones.</li>
                </ul>
            </div>
        </div>
    </section>

    <!-- Resources Section -->
    <section class="py-12 bg-white">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center text-dark mb-10">Recursos Adicionales</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <div class="bg-gray-100 p-6 rounded-xl shadow-md hover:shadow-lg transition-shadow">
                    <div class="bg-primary text-white p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
                        <i class="fas fa-link"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">Enlaces Oficiales</h3>
                    <ul class="space-y-2">
                        <li><a href="https://www.aemps.gob.es/" class="text-primary hover:underline" target="_blank">AEMPS (España)</a></li>
                        <li><a href="https://www.fda.gov/" class="text-primary hover:underline" target="_blank">FDA (EE.UU.)</a></li>
                        <li><a href="https://www.who.int/" class="text-primary hover:underline" target="_blank">OMS</a></li>
                    </ul>
                </div>
                
                <div class="bg-gray-100 p-6 rounded-xl shadow-md hover:shadow-lg transition-shadow">
                    <div class="bg-secondary text-white p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
                        <i class="fas fa-book"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">Bibliografía</h3>
                    <ul class="space-y-2">
                        <li>Guía Farmacológica Vademécum</li>
                        <li>Martindale: The Complete Drug Reference</li>
                        <li>Goodman & Gilman's Pharmacological Basis of Therapeutics</li>
                    </ul>
                </div>
                
                <div class="bg-gray-100 p-6 rounded-xl shadow-md hover:shadow-lg transition-shadow">
                    <div class="bg-accent text-white p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
                        <i class="fas fa-phone-alt"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">Contacto de Emergencia</h3>
                    <ul class="space-y-2">
                        <li>Servicio de Información Toxicológica: <span class="font-semibold">915 620 420</span></li>
                        <li>Urgencias: <span class="font-semibold">112</span></li>
                        <li>Farmacias de Guardia: <a href="tel:098" class="text-primary hover:underline">098</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </section>

    <!-- FAQ Section -->
    <section class="py-12 bg-gray-100">
        <div class="container mx-auto px-4">
            <h2 class="text-3xl font-bold text-center text-dark mb-10">Preguntas Frecuentes</h2>
            
            <div class="max-w-3xl mx-auto space-y-4" id="faqAccordion">
                <!-- FAQ items will be inserted here by JavaScript -->
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-dark text-white py-10">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4">Guía Farmacéutica</h3>
                    <p class="text-gray-400">Información verificada por profesionales de la salud. Actualizada en julio 2023.</p>
                </div>
                <div>
                    <h4 class="font-semibold mb-4">Enlaces Rápidos</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Inicio</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Medicamentos</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Posología</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Recursos</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="font-semibold mb-4">Legal</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Aviso Legal</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Política de Privacidad</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Cookies</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="font-semibold mb-4">Síguenos</h4>
                    <div class="flex space-x-4">
                        <a href="#" class="bg-gray-700 hover:bg-gray-600 w-10 h-10 rounded-full flex items-center justify-center">
                            <i class="fab fa-facebook-f"></i>
                        </a>
                        <a href="#" class="bg-gray-700 hover:bg-gray-600 w-10 h-10 rounded-full flex items-center justify-center">
                            <i class="fab fa-twitter"></i>
                        </a>
                        <a href="#" class="bg-gray-700 hover:bg-gray-600 w-10 h-10 rounded-full flex items-center justify-center">
                            <i class="fab fa-instagram"></i>
                        </a>
                        <a href="#" class="bg-gray-700 hover:bg-gray-600 w-10 h-10 rounded-full flex items-center justify-center">
                            <i class="fab fa-linkedin-in"></i>
                        </a>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
                <p>© 2023 Guía Farmacéutica. Todos los derechos reservados.</p>
                <p class="mt-2 text-sm">La información proporcionada no sustituye el consejo médico profesional.</p>
            </div>
        </div>
    </footer>

    <!-- Floating Action Button -->
    <div class="fixed bottom-8 right-8">
        <button class="floating-btn bg-primary hover:bg-blue-700 text-white w-14 h-14 rounded-full shadow-lg flex items-center justify-center text-xl">
            <i class="fas fa-question"></i>
        </button>
    </div>

    <!-- JavaScript -->
    <script>
        // Sample medication data
        const medications = [
            {
                name: "Paracetamol",
                brandNames: ["Termalgin", "Efferalgan", "Gelocatil", "Panadol"],
                activeIngredient: "Paracetamol",
                dosageAdults: "500-1000 mg cada 6-8 horas",
                dosageChildren: "10-15 mg/kg/dosis cada 6 horas",
                frequency: "Cada 4-6 horas (máx 4g/día)",
                category: "Analgésico/Antipirético",
                image: "https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg",
                description: "Analgésico y antipirético utilizado para el alivio del dolor leve a moderado y la fiebre."
            },
            {
                name: "Ibuprofeno",
                brandNames: ["Nurofen", "Espidifen", "Dalsy", "Algiasdin"],
                activeIngredient: "Ibuprofeno",
                dosageAdults: "400-600 mg cada 6-8 horas",
                dosageChildren: "5-10 mg/kg/dosis cada 6-8 horas",
                frequency: "Cada 6-8 horas (máx 2400mg/día)",
                category: "AINE/Antiinflamatorio",
                image: "https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg",
                description: "Antiinflamatorio no esteroideo (AINE) utilizado para el dolor, inflamación y fiebre."
            },
            {
                name: "Omeprazol",
                brandNames: ["Losec", "Prilosec", "Mepral", "Zoltar"],
                activeIngredient: "Omeprazol",
                dosageAdults: "20-40 mg/día",
                dosageChildren: "0.7-3.5 mg/kg/día",
                frequency: "Una vez al día (mañana)",
                category: "Inhibidor bomba protones",
                image: "https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg",
                description: "Inhibidor de la bomba de protones que reduce la producción de ácido gástrico."
            },
            {
                name: "Amoxicilina",
                brandNames: ["Clamoxyl", "Augmentine", "Amoxil", "Amoxicilina Normon"],
                activeIngredient: "Amoxicilina",
                dosageAdults: "250-500 mg cada 8 horas",
                dosageChildren: "20-50 mg/kg/día dividido cada 8 horas",
                frequency: "Cada 8 horas",
                category: "Antibiótico",
                image: "https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg",
                description: "Antibiótico betalactámico de amplio espectro para infecciones bacterianas."
            },
            {
                name: "Atorvastatina",
                brandNames: ["Lipitor", "Tahor", "Cardyl", "Atorvastatina Cinfa"],
                activeIngredient: "Atorvastatina cálcica",
                dosageAdults: "10-80 mg/día",
                dosageChildren: "No recomendado <10 años",
                frequency: "Una vez al día (noche)",
                category: "Hipolipemiante",
                image: "https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg",
                description: "Estatinas para reducir el colesterol LDL y prevenir eventos cardiovasculares."
            },
            {
                name: "Loratadina",
                brandNames: ["Clarityne", "Alergil", "Loratadina Cinfa", "Loratadina Stada"],
                activeIngredient: "Loratadina",
                dosageAdults: "10 mg/día",
                dosageChildren: "5 mg/día (2-12 años)",
                frequency: "Una vez al día",
                category: "Antihistamínico",
                image: "https://pbs.twimg.com/media/GpSS6oRXMAAd32g?format=jpg",
                description: "Antihistamínico no sedante para el tratamiento de alergias."
            }
        ];

        // FAQ data
        const faqs = [
            {
                question: "¿Cómo debo tomar los medicamentos con alimentos?",
                answer: "Algunos medicamentos deben tomarse con alimentos para reducir la irritación gástrica (como el ibuprofeno), mientras que otros deben tomarse en ayunas para una mejor absorción (como la levotiroxina). Consulte siempre el prospecto o consulte con su farmacéutico."
            },
            {
                question: "¿Qué hago si olvidé una dosis?",
                answer: "Si olvida una dosis, tómela tan pronto como lo recuerde. Sin embargo, si es casi la hora de la siguiente dosis, salte la dosis olvidada y continúe con su horario regular. No duplique las dosis para compensar la olvidada."
            },
            {
                question: "¿Puedo triturar o partir las pastillas?",
                answer: "No todas las pastillas pueden triturarse o partirse. Algunas tienen cubiertas especiales o son de liberación prolongada. Consulte con su farmacéutico antes de alterar la forma farmacéutica."
            },
            {
                question: "¿Qué significa 'tomar cada 8 horas'?",
                answer: "Significa que debe distribuir las dosis uniformemente a lo largo del día. Por ejemplo, si toma la primera dosis a las 8:00 am, las siguientes serían a las 4:00 pm y a las 12:00 am."
            },
            {
                question: "¿Cómo almacenar correctamente los medicamentos?",
                answer: "La mayoría de medicamentos deben almacenarse en un lugar fresco y seco, lejos de la luz directa y la humedad. Algunos requieren refrigeración. Verifique siempre las instrucciones de almacenamiento en el envase."
            }
        ];

        // Initialize the page
        document.addEventListener('DOMContentLoaded', function() {
            // Render medication cards
            renderMedicationCards();
            
            // Render dosage table
            renderDosageTable();
            
            // Render FAQ accordion
            renderFAQAccordion();
            
            // Set up search functionality
            setupSearch();
            
            // Set up load more button
            document.getElementById('loadMoreBtn').addEventListener('click', loadMoreMedications);
        });

        // Render medication cards
        function renderMedicationCards(limit = 3) {
            const container = document.getElementById('medicationsContainer');
            container.innerHTML = '';
            
            medications.slice(0, limit).forEach(med => {
                const card = document.createElement('div');
                card.className = 'bg-white rounded-xl shadow-md overflow-hidden med-card transition-all duration-300';
                card.innerHTML = `
                    <img src="${med.image}" alt="${med.name}" class="w-full h-48 object-cover">
                    <div class="p-6">
                        <div class="flex justify-between items-start mb-2">
                            <h3 class="text-xl font-bold text-dark">${med.name}</h3>
                            <span class="bg-blue-100 text-primary text-xs px-2 py-1 rounded-full">${med.category}</span>
                        </div>
                        <p class="text-gray-600 mb-4">${med.description}</p>
                        
                        <div class="mb-4">
                            <h4 class="font-semibold text-dark mb-1">Marcas comerciales:</h4>
                            <div class="flex flex-wrap gap-2">
                                ${med.brandNames.map(brand => `<span class="bg-gray-100 text-dark text-sm px-2 py-1 rounded">${brand}</span>`).join('')}
                            </div>
                        </div>
                        
                        <div class="grid grid-cols-2 gap-2 mb-4">
                            <div>
                                <h4 class="font-semibold text-sm text-dark">Dosis adultos:</h4>
                                <p class="text-sm">${med.dosageAdults}</p>
                            </div>
                            <div>
                                <h4 class="font-semibold text-sm text-dark">Dosis niños:</h4>
                                <p class="text-sm">${med.dosageChildren}</p>
                            </div>
                        </div>
                        
                        <button class="w-full bg-primary hover:bg-blue-700 text-white py-2 rounded-lg flex items-center justify-center">
                            <i class="fas fa-info-circle mr-2"></i> Ver detalles completos
                        </button>
                    </div>
                `;
                container.appendChild(card);
            });
        }

        // Render dosage table
        function renderDosageTable() {
            const tbody = document.getElementById('dosageTableBody');
            tbody.innerHTML = '';
            
            medications.forEach(med => {
                const row = document.createElement('tr');
                row.className = 'hover:bg-gray-50 border-b border-gray-200';
                row.innerHTML = `
                    <td class="px-6 py-4 font-medium">${med.name}</td>
                    <td class="px-6 py-4">${med.activeIngredient}</td>
                    <td class="px-6 py-4">${med.dosageAdults}</td>
                    <td class="px-6 py-4">${med.dosageChildren}</td>
                    <td class="px-6 py-4">${med.frequency}</td>
                `;
                tbody.appendChild(row);
            });
        }

        // Render FAQ accordion
        function renderFAQAccordion() {
            const container = document.getElementById('faqAccordion');
            container.innerHTML = '';
            
            faqs.forEach((faq, index) => {
                const item = document.createElement('div');
                item.className = 'bg-white rounded-lg shadow-md overflow-hidden';
                item.innerHTML = `
                    <button class="w-full text-left px-6 py-4 flex justify-between items-center focus:outline-none" onclick="toggleFAQ(${index})">
                        <span class="font-semibold text-dark">${faq.question}</span>
                        <i class="fas fa-chevron-down transition-transform duration-300" id="faqIcon${index}"></i>
                    </button>
                    <div class="px-6 pb-0 max-h-0 overflow-hidden transition-all duration-300" id="faqAnswer${index}">
                        <div class="pb-4 text-gray-700">${faq.answer}</div>
                    </div>
                `;
                container.appendChild(item);
            });
        }

        // Toggle FAQ item
        window.toggleFAQ = function(index) {
            const answer = document.getElementById(`faqAnswer${index}`);
            const icon = document.getElementById(`faqIcon${index}`);
            
            if (answer.classList.contains('max-h-0')) {
                answer.classList.remove('max-h-0');
                answer.classList.add('max-h-96', 'pb-4');
                icon.classList.remove('fa-chevron-down');
                icon.classList.add('fa-chevron-up');
            } else {
                answer.classList.add('max-h-0');
                answer.classList.remove('max-h-96', 'pb-4');
                icon.classList.add('fa-chevron-down');
                icon.classList.remove('fa-chevron-up');
            }
        };

        // Set up search functionality
        function setupSearch() {
            const searchInput = document.getElementById('searchInput');
            
            searchInput.addEventListener('input', function() {
                const searchTerm = this.value.toLowerCase();
                
                if (searchTerm.length > 2) {
                    // Highlight in medication cards
                    document.querySelectorAll('#medicationsContainer .med-card h3').forEach(title => {
                        const text = title.textContent;
                        const highlighted = text.replace(new RegExp(searchTerm, 'gi'), match => 
                            `<span class="search-highlight">${match}</span>`
                        );
                        title.innerHTML = highlighted;
                    });
                    
                    // Highlight in dosage table
                    document.querySelectorAll('#dosageTableBody tr').forEach(row => {
                        const cells = row.querySelectorAll('td');
                        let found = false;
                        
                        cells.forEach(cell => {
                            const text = cell.textContent;
                            if (text.toLowerCase().includes(searchTerm)) {
                                found = true;
                                const highlighted = text.replace(new RegExp(searchTerm, 'gi'), match => 
                                    `<span class="search-highlight">${match}</span>`
                                );
                                cell.innerHTML = highlighted;
                            }
                        });
                        
                        // Show/hide rows based on search
                        row.style.display = found ? '' : 'none';
                    });
                } else {
                    // Remove highlights if search term is too short
                    document.querySelectorAll('.search-highlight').forEach(el => {
                        const parent = el.parentNode;
                        parent.textContent = parent.textContent;
                    });
                    
                    // Show all rows
                    document.querySelectorAll('#dosageTableBody tr').forEach(row => {
                        row.style.display = '';
                    });
                }
            });
        }

        // Load more medications
        function loadMoreMedications() {
            const currentCount = document.querySelectorAll('#medicationsContainer .med-card').length;
            renderMedicationCards(currentCount + 3);
            
            // Hide button if all medications are shown
            if (currentCount + 3 >= medications.length) {
                document.getElementById('loadMoreBtn').style.display = 'none';
            }
        }
    </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=Merlintxu/farma" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>