note7 commited on
Commit
fd70493
·
verified ·
1 Parent(s): 26f8296

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +159 -725
  2. prompts.txt +2 -1
index.html CHANGED
@@ -5,45 +5,9 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Menú Saludable para Mayores de 50</title>
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
 
8
  <style>
9
- /* Reset y estilos base */
10
- * {
11
- margin: 0;
12
- padding: 0;
13
- box-sizing: border-box;
14
- }
15
-
16
- body {
17
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18
- background-color: #f8f9fa;
19
- color: #333;
20
- line-height: 1.6;
21
- }
22
-
23
- .container {
24
- width: 100%;
25
- max-width: 1200px;
26
- margin: 0 auto;
27
- padding: 20px;
28
- }
29
-
30
- /* Header */
31
- .header {
32
- text-align: center;
33
- margin-bottom: 30px;
34
- }
35
-
36
- .header h1 {
37
- font-size: 2.5rem;
38
- color: #1a365d;
39
- margin-bottom: 10px;
40
- }
41
-
42
- .header h2 {
43
- font-size: 1.5rem;
44
- color: #4a5568;
45
- }
46
-
47
  .header-line {
48
  width: 100%;
49
  height: 2px;
@@ -52,125 +16,6 @@
52
  border-radius: 2px;
53
  }
54
 
55
- /* Controles */
56
- .controls {
57
- background-color: white;
58
- border-radius: 10px;
59
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
60
- padding: 20px;
61
- margin-bottom: 30px;
62
- }
63
-
64
- .controls-container {
65
- display: flex;
66
- flex-wrap: wrap;
67
- justify-content: space-between;
68
- align-items: center;
69
- gap: 15px;
70
- }
71
-
72
- .filter-group {
73
- display: flex;
74
- flex-direction: column;
75
- }
76
-
77
- .filter-label {
78
- font-weight: 500;
79
- color: #4a5568;
80
- margin-bottom: 8px;
81
- }
82
-
83
- .filter-buttons {
84
- display: flex;
85
- gap: 10px;
86
- }
87
-
88
- .button {
89
- padding: 8px 16px;
90
- border-radius: 8px;
91
- border: none;
92
- font-weight: 500;
93
- cursor: pointer;
94
- transition: all 0.3s ease;
95
- display: flex;
96
- align-items: center;
97
- gap: 8px;
98
- }
99
-
100
- .button:hover {
101
- transform: translateY(-2px);
102
- }
103
-
104
- .button-all {
105
- background-color: #4299e1;
106
- color: white;
107
- }
108
-
109
- .button-all:hover {
110
- background-color: #3182ce;
111
- }
112
-
113
- .button-breakfast {
114
- background-color: #48bb78;
115
- color: white;
116
- }
117
-
118
- .button-breakfast:hover {
119
- background-color: #38a169;
120
- }
121
-
122
- .button-dinner {
123
- background-color: #9f7aea;
124
- color: white;
125
- }
126
-
127
- .button-dinner:hover {
128
- background-color: #805ad5;
129
- }
130
-
131
- .button-generate {
132
- background-color: #ed8936;
133
- color: white;
134
- }
135
-
136
- .button-generate:hover {
137
- background-color: #dd6b20;
138
- }
139
-
140
- .button-shopping {
141
- background-color: #667eea;
142
- color: white;
143
- }
144
-
145
- .button-shopping:hover {
146
- background-color: #5a67d8;
147
- }
148
-
149
- .button-pdf {
150
- background-color: #f56565;
151
- color: white;
152
- }
153
-
154
- .button-pdf:hover {
155
- background-color: #e53e3e;
156
- }
157
-
158
- .button-csv {
159
- background-color: #38a169;
160
- color: white;
161
- }
162
-
163
- .button-csv:hover {
164
- background-color: #2f855a;
165
- }
166
-
167
- /* Loading */
168
- .loading {
169
- display: none;
170
- flex-direction: column;
171
- align-items: center;
172
- }
173
-
174
  .loading-spinner {
175
  border: 5px solid #f3f3f3;
176
  border-top: 5px solid #4299e1;
@@ -186,337 +31,16 @@
186
  100% { transform: rotate(360deg); }
187
  }
188
 
189
- .loading-text {
190
- text-align: center;
191
- color: #4a5568;
192
- margin-top: 10px;
193
- }
194
-
195
- /* Contenido principal */
196
- .main-content {
197
- display: flex;
198
- flex-direction: column;
199
- }
200
-
201
- @media (min-width: 1024px) {
202
- .main-content {
203
- flex-direction: row;
204
- }
205
- }
206
-
207
- /* Calendario */
208
- .calendar {
209
- width: 100%;
210
- background-color: white;
211
- border-radius: 10px;
212
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
213
- padding: 20px;
214
- margin-bottom: 20px;
215
- }
216
-
217
- @media (min-width: 1024px) {
218
- .calendar {
219
- width: 30%;
220
- margin-bottom: 0;
221
- margin-right: 20px;
222
- position: sticky;
223
- top: 20px;
224
- align-self: flex-start;
225
- }
226
- }
227
-
228
- .calendar-title {
229
- font-size: 1.25rem;
230
- font-weight: 600;
231
- color: #2d3748;
232
- margin-bottom: 15px;
233
- }
234
-
235
- .calendar-grid {
236
- display: grid;
237
- grid-template-columns: repeat(7, 1fr);
238
- gap: 8px;
239
- margin-bottom: 10px;
240
- }
241
-
242
- .calendar-day-header {
243
- text-align: center;
244
- font-weight: 500;
245
- color: #718096;
246
- font-size: 0.875rem;
247
- }
248
-
249
- .calendar-day {
250
- text-align: center;
251
- padding: 8px;
252
- border-radius: 8px;
253
- border: 1px solid #e2e8f0;
254
- cursor: pointer;
255
- transition: all 0.3s ease;
256
- }
257
-
258
- .calendar-day:hover {
259
- background-color: #ebf8ff;
260
- }
261
-
262
- .calendar-day.selected {
263
- background-color: #4299e1;
264
- color: white;
265
- border-color: #4299e1;
266
- }
267
-
268
- .nutrition-summary {
269
- margin-top: 20px;
270
- }
271
-
272
- .nutrition-title {
273
- font-weight: 500;
274
- color: #4a5568;
275
- margin-bottom: 10px;
276
- }
277
-
278
- .nutrition-card {
279
- background-color: #ebf8ff;
280
- border-radius: 8px;
281
- padding: 15px;
282
- }
283
-
284
- .nutrition-item {
285
- display: flex;
286
- justify-content: space-between;
287
- margin-bottom: 8px;
288
- }
289
-
290
- .nutrition-label {
291
- color: #4a5568;
292
- }
293
-
294
- .nutrition-value {
295
- font-weight: 500;
296
- }
297
-
298
- /* Recetas */
299
- .recipes-container {
300
- flex: 1;
301
- }
302
-
303
- .no-recipes {
304
- text-align: center;
305
- padding: 40px 0;
306
- }
307
-
308
- .no-recipes-icon {
309
- font-size: 3rem;
310
- color: #e2e8f0;
311
- margin-bottom: 15px;
312
- }
313
-
314
- .no-recipes-title {
315
- font-size: 1.25rem;
316
- color: #718096;
317
- margin-bottom: 10px;
318
- }
319
-
320
- .no-recipes-text {
321
- color: #a0aec0;
322
- }
323
-
324
- .recipes-list {
325
- display: flex;
326
- flex-direction: column;
327
- gap: 20px;
328
- }
329
-
330
- /* Tarjeta de receta */
331
- .recipe-card {
332
- background-color: white;
333
- border-radius: 10px;
334
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
335
- overflow: hidden;
336
- transition: all 0.3s ease;
337
- }
338
-
339
- .recipe-card:hover {
340
- transform: translateY(-5px);
341
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
342
- }
343
-
344
- .recipe-content {
345
- display: flex;
346
- flex-direction: column;
347
- }
348
-
349
- @media (min-width: 768px) {
350
- .recipe-content {
351
- flex-direction: row;
352
- }
353
- }
354
-
355
- .recipe-image {
356
- width: 100%;
357
- height: 200px;
358
- object-fit: cover;
359
- }
360
-
361
- @media (min-width: 768px) {
362
- .recipe-image {
363
- width: 33.333%;
364
- height: auto;
365
- }
366
- }
367
-
368
- .recipe-details {
369
- padding: 20px;
370
- flex: 1;
371
- }
372
-
373
- .recipe-header {
374
- display: flex;
375
- flex-direction: column;
376
- margin-bottom: 15px;
377
- }
378
-
379
- @media (min-width: 768px) {
380
- .recipe-header {
381
- flex-direction: row;
382
- justify-content: space-between;
383
- align-items: flex-start;
384
- }
385
- }
386
-
387
- .recipe-tag {
388
- display: inline-block;
389
- padding: 4px 12px;
390
- font-size: 0.875rem;
391
- font-weight: 600;
392
- border-radius: 999px;
393
- margin-bottom: 10px;
394
- }
395
-
396
- .tag-breakfast {
397
- background-color: #c6f6d5;
398
- color: #22543d;
399
- }
400
-
401
- .tag-dinner {
402
- background-color: #e9d8fd;
403
- color: #44337a;
404
- }
405
-
406
- .recipe-title {
407
- font-size: 1.25rem;
408
- font-weight: 700;
409
- color: #2d3748;
410
- margin-bottom: 5px;
411
- }
412
-
413
- .recipe-servings {
414
- display: flex;
415
- align-items: center;
416
- gap: 5px;
417
- font-size: 0.875rem;
418
- color: #718096;
419
- }
420
-
421
- .nutrition-badges {
422
- display: flex;
423
- flex-wrap: wrap;
424
- gap: 8px;
425
- margin: 15px 0;
426
- }
427
-
428
- .nutrition-badge {
429
- padding: 6px 12px;
430
- border-radius: 999px;
431
- font-size: 0.75rem;
432
- font-weight: 500;
433
- display: flex;
434
- align-items: center;
435
- gap: 5px;
436
- }
437
-
438
- .badge-calories {
439
- background-color: #fed7d7;
440
- color: #822727;
441
- }
442
-
443
- .badge-protein {
444
- background-color: #bee3f8;
445
- color: #2a4365;
446
- }
447
-
448
- .badge-carbs {
449
- background-color: #feebc8;
450
- color: #7b341e;
451
- }
452
-
453
- .badge-fat {
454
- background-color: #fed7e2;
455
- color: #702459;
456
- }
457
-
458
- .ingredients-title {
459
- font-weight: 500;
460
- color: #4a5568;
461
- margin-bottom: 10px;
462
- }
463
-
464
- .ingredients-list {
465
- display: grid;
466
- grid-template-columns: 1fr;
467
- gap: 8px;
468
- font-size: 0.875rem;
469
- color: #4a5568;
470
- }
471
-
472
- @media (min-width: 480px) {
473
- .ingredients-list {
474
- grid-template-columns: 1fr 1fr;
475
- }
476
- }
477
-
478
- .ingredient-item {
479
- display: flex;
480
- align-items: flex-start;
481
- }
482
-
483
- .ingredient-icon {
484
- color: #48bb78;
485
- margin-right: 8px;
486
- font-size: 0.75rem;
487
- margin-top: 3px;
488
- }
489
-
490
- .instructions-title {
491
- font-weight: 500;
492
- color: #4a5568;
493
- margin: 15px 0 10px;
494
- }
495
-
496
- .instructions-text {
497
- font-size: 0.875rem;
498
- color: #4a5568;
499
- }
500
-
501
- .recipe-source {
502
- font-size: 0.875rem;
503
- margin-top: 15px;
504
- }
505
-
506
- .source-label {
507
- color: #718096;
508
- }
509
-
510
- .source-link {
511
- color: #4299e1;
512
- text-decoration: none;
513
  }
514
 
515
- .source-link:hover {
516
- text-decoration: underline;
 
517
  }
518
 
519
- /* Modal de lista de compra */
520
  .modal {
521
  position: fixed;
522
  top: 0;
@@ -539,133 +63,47 @@
539
  overflow-y: auto;
540
  padding: 20px;
541
  }
542
-
543
- .modal-header {
544
- display: flex;
545
- justify-content: space-between;
546
- align-items: center;
547
- margin-bottom: 20px;
548
- }
549
-
550
- .modal-title {
551
- font-size: 1.25rem;
552
- font-weight: 600;
553
- color: #2d3748;
554
- }
555
-
556
- .close-modal {
557
- color: #718096;
558
- font-size: 1.5rem;
559
- cursor: pointer;
560
- }
561
-
562
- .shopping-empty {
563
- text-align: center;
564
- padding: 40px 0;
565
- }
566
-
567
- .shopping-empty-icon {
568
- font-size: 3rem;
569
- color: #e2e8f0;
570
- margin-bottom: 15px;
571
- }
572
-
573
- .shopping-empty-text {
574
- color: #718096;
575
- }
576
-
577
- .aisle-section {
578
- margin-bottom: 25px;
579
- }
580
-
581
- .aisle-title {
582
- font-weight: 500;
583
- font-size: 1.125rem;
584
- color: #2d3748;
585
- margin-bottom: 15px;
586
- padding-bottom: 8px;
587
- border-bottom: 1px solid #e2e8f0;
588
- }
589
-
590
- .aisle-icon {
591
- color: #4299e1;
592
- margin-right: 8px;
593
- }
594
-
595
- .shopping-list {
596
- display: flex;
597
- flex-direction: column;
598
- gap: 10px;
599
- }
600
-
601
- .shopping-item {
602
- display: flex;
603
- justify-content: space-between;
604
- align-items: center;
605
- background-color: #f8fafc;
606
- padding: 12px 15px;
607
- border-radius: 8px;
608
- }
609
-
610
- .item-name {
611
- font-weight: 500;
612
- }
613
-
614
- .item-quantity {
615
- color: #718096;
616
- }
617
-
618
- .modal-footer {
619
- display: flex;
620
- justify-content: flex-end;
621
- gap: 10px;
622
- margin-top: 20px;
623
- }
624
-
625
- /* Animaciones */
626
- .fade-in {
627
- animation: fadeIn 0.5s ease-in;
628
- }
629
-
630
- @keyframes fadeIn {
631
- from { opacity: 0; }
632
- to { opacity: 1; }
633
- }
634
  </style>
635
  </head>
636
- <body>
637
- <div class="container">
638
  <!-- Header -->
639
- <header class="header">
640
- <h1>Menú Saludable</h1>
641
- <h2>Plan de 30 días para mayores de 50 años</h2>
642
  <div class="header-line"></div>
643
  </header>
644
 
645
  <!-- Controls -->
646
- <div class="controls">
647
- <div class="controls-container">
648
- <div class="filter-group">
649
- <span class="filter-label">Filtrar por:</span>
650
- <div class="filter-buttons">
651
- <button id="filter-all" class="button button-all">Todas</button>
652
- <button id="filter-breakfast" class="button button-breakfast">Desayunos</button>
653
- <button id="filter-dinner" class="button button-dinner">Cenas</button>
 
 
 
 
 
 
654
  </div>
655
  </div>
656
- <div class="filter-buttons">
657
- <button id="generate-menu" class="button button-generate">
658
  <i class="fas fa-sync-alt"></i> Nuevo Menú
659
  </button>
660
- <button id="shopping-list" class="button button-shopping">
661
  <i class="fas fa-shopping-basket"></i> Lista de Compra
662
  </button>
663
  </div>
664
- <div class="filter-buttons">
665
- <button id="export-pdf" class="button button-pdf">
666
  <i class="fas fa-file-pdf"></i> PDF
667
  </button>
668
- <button id="export-csv" class="button button-csv">
669
  <i class="fas fa-file-csv"></i> CSV
670
  </button>
671
  </div>
@@ -673,55 +111,55 @@
673
  </div>
674
 
675
  <!-- Loading State -->
676
- <div id="loading" class="loading">
677
  <div class="loading-spinner"></div>
678
- <p class="loading-text">Generando menú saludable...</p>
679
  </div>
680
 
681
  <!-- Main Content -->
682
- <div class="main-content">
683
  <!-- Calendar View -->
684
- <div id="calendar-view" class="calendar">
685
- <h3 class="calendar-title">Calendario del Menú</h3>
686
- <div class="calendar-grid">
687
- <div class="calendar-day-header">L</div>
688
- <div class="calendar-day-header">M</div>
689
- <div class="calendar-day-header">X</div>
690
- <div class="calendar-day-header">J</div>
691
- <div class="calendar-day-header">V</div>
692
- <div class="calendar-day-header">S</div>
693
- <div class="calendar-day-header">D</div>
694
  </div>
695
- <div id="calendar-days" class="calendar-grid">
696
  <!-- Calendar days will be populated here -->
697
  </div>
698
- <div class="nutrition-summary">
699
- <h4 class="nutrition-title">Resumen Nutricional</h4>
700
- <div class="nutrition-card">
701
- <div class="nutrition-item">
702
- <span class="nutrition-label">Calorías promedio:</span>
703
- <span id="avg-calories" class="nutrition-value">-</span>
704
  </div>
705
- <div class="nutrition-item">
706
- <span class="nutrition-label">Proteínas promedio:</span>
707
- <span id="avg-protein" class="nutrition-value">-</span>
708
  </div>
709
- <div class="nutrition-item">
710
- <span class="nutrition-label">Balance nutricional:</span>
711
- <span id="nutrition-score" class="nutrition-value">-</span>
712
  </div>
713
  </div>
714
  </div>
715
  </div>
716
 
717
  <!-- Recipes List -->
718
- <div id="recipes-container" class="recipes-container">
719
- <div id="no-recipes" class="no-recipes">
720
- <i class="fas fa-utensils no-recipes-icon"></i>
721
- <h3 class="no-recipes-title">No hay recetas cargadas</h3>
722
- <p class="no-recipes-text">Haz clic en "Generar Menú" para comenzar</p>
723
  </div>
724
- <div id="recipes-list" class="recipes-list">
725
  <!-- Recipe cards will be populated here -->
726
  </div>
727
  </div>
@@ -730,23 +168,23 @@
730
  <!-- Shopping List Modal -->
731
  <div id="shopping-modal" class="modal">
732
  <div class="modal-content">
733
- <div class="modal-header">
734
- <h3 class="modal-title">Lista de la Compra</h3>
735
- <button id="close-shopping-modal" class="close-modal">
736
  <i class="fas fa-times"></i>
737
  </button>
738
  </div>
739
  <div id="shopping-list-content">
740
- <div class="shopping-empty">
741
- <i class="fas fa-shopping-basket shopping-empty-icon"></i>
742
- <p class="shopping-empty-text">Genera un menú primero para ver la lista de compra</p>
743
  </div>
744
  </div>
745
- <div class="modal-footer">
746
- <button id="print-shopping-list" class="button button-generate">
747
  <i class="fas fa-print"></i> Imprimir
748
  </button>
749
- <button id="export-shopping-pdf" class="button button-pdf">
750
  <i class="fas fa-file-pdf"></i> PDF
751
  </button>
752
  </div>
@@ -755,9 +193,10 @@
755
  </div>
756
 
757
  <script>
758
- // API Configuration for Spoonacular
759
- const API_KEY = 'YOUR_SPOONACULAR_API_KEY'; // Reemplaza con tu API key de Spoonacular
760
- const API_URL = 'https://api.spoonacular.com/recipes';
 
761
 
762
  // Global variables
763
  let currentMenu = [];
@@ -805,18 +244,18 @@
805
  // Create 30 days (1 month)
806
  for (let i = 1; i <= 30; i++) {
807
  const dayElement = document.createElement('div');
808
- dayElement.className = 'calendar-day';
809
  dayElement.textContent = i;
810
  dayElement.dataset.day = i;
811
 
812
  dayElement.addEventListener('click', () => {
813
  // Remove highlight from all days
814
  document.querySelectorAll('.calendar-day').forEach(el => {
815
- el.classList.remove('selected');
816
  });
817
 
818
  // Highlight selected day
819
- dayElement.classList.add('selected');
820
  selectedDay = i;
821
 
822
  // Filter recipes for this day
@@ -829,8 +268,8 @@
829
 
830
  // Generate monthly menu
831
  async function generateMonthlyMenu() {
832
- loading.style.display = 'flex';
833
- noRecipes.style.display = 'none';
834
  recipesList.innerHTML = '';
835
 
836
  try {
@@ -861,61 +300,56 @@
861
  console.error('Error generating menu:', error);
862
  alert('Error al generar el menú. Por favor intenta nuevamente.');
863
  } finally {
864
- loading.style.display = 'none';
865
  }
866
  }
867
 
868
- // Fetch healthy recipe from Spoonacular API
869
  async function fetchHealthyRecipe(mealType) {
870
  const maxCalories = mealType === 'breakfast' ? 400 : 600;
871
  const minProtein = mealType === 'breakfast' ? 10 : 20;
872
 
873
- // First search for recipes that match our criteria
874
  const searchParams = new URLSearchParams({
875
- apiKey: API_KEY,
876
- type: mealType,
877
- maxCalories: maxCalories,
878
- minProtein: minProtein,
879
- diet: 'vegetarian,gluten free', // Puedes ajustar según necesidades
880
- intolerances: 'dairy,egg', // Puedes ajustar según necesidades
881
- number: 1,
882
- sort: 'random',
883
- addRecipeInformation: true,
884
- addRecipeNutrition: true
885
  });
886
 
887
  try {
888
- // Search for recipes
889
- const searchResponse = await fetch(`${API_URL}/complexSearch?${searchParams}`);
890
- const searchData = await searchResponse.json();
891
 
892
- if (searchData.results.length === 0) {
893
  console.warn(`No recipes found for ${mealType}`);
894
  return null;
895
  }
896
 
897
- const recipeId = searchData.results[0].id;
898
-
899
- // Get detailed information about the recipe
900
- const recipeResponse = await fetch(`${API_URL}/${recipeId}/information?apiKey=${API_KEY}&includeNutrition=true`);
901
- const recipeData = await recipeResponse.json();
902
 
903
- // Format recipe data for our app
904
  return {
905
- id: recipeData.id,
906
- title: recipeData.title,
907
- image: recipeData.image || 'https://spoonacular.com/recipeImages/' + recipeData.id + '-556x370.jpg',
908
- servings: recipeData.servings || 2,
909
- sourceUrl: recipeData.sourceUrl || recipeData.spoonacularSourceUrl,
910
- sourceName: recipeData.sourceName || 'Spoonacular',
911
- ingredients: recipeData.extendedIngredients || [],
912
  instructions: recipeData.instructions || 'Ver instrucciones en el enlace original',
913
  nutrition: {
914
- calories: Math.round(recipeData.nutrition.nutrients.find(n => n.name === 'Calories').amount),
915
- protein: Math.round(recipeData.nutrition.nutrients.find(n => n.name === 'Protein').amount),
916
- carbs: Math.round(recipeData.nutrition.nutrients.find(n => n.name === 'Carbohydrates').amount),
917
- fat: Math.round(recipeData.nutrition.nutrients.find(n => n.name === 'Fat').amount),
918
- fiber: Math.round(recipeData.nutrition.nutrients.find(n => n.name === 'Fiber').amount)
919
  }
920
  };
921
  } catch (error) {
@@ -927,9 +361,9 @@
927
  // Add ingredients to shopping list
928
  function addToShoppingList(ingredients) {
929
  ingredients.forEach(ingredient => {
930
- const name = ingredient.name.toLowerCase();
931
- const amount = ingredient.amount;
932
- const unit = ingredient.unit || 'unidad';
933
 
934
  if (shoppingList[name]) {
935
  shoppingList[name].amount += amount;
@@ -937,7 +371,7 @@
937
  shoppingList[name] = {
938
  amount,
939
  unit,
940
- aisle: getIngredientAisle(ingredient.name)
941
  };
942
  }
943
  });
@@ -960,7 +394,7 @@
960
  // Render recipes
961
  function renderRecipes(recipes) {
962
  if (recipes.length === 0) {
963
- noRecipes.style.display = 'block';
964
  return;
965
  }
966
 
@@ -968,63 +402,63 @@
968
 
969
  recipes.forEach(recipe => {
970
  const recipeCard = document.createElement('div');
971
- recipeCard.className = 'recipe-card fade-in';
972
  recipeCard.dataset.day = recipe.day;
973
  recipeCard.dataset.mealType = recipe.mealType;
974
 
975
  recipeCard.innerHTML = `
976
- <div class="recipe-content">
977
- <img class="recipe-image" src="${recipe.image}" alt="${recipe.title}" onerror="this.src='https://via.placeholder.com/400x300?text=Imagen+no+disponible'">
978
- <div class="recipe-details">
979
- <div class="recipe-header">
980
  <div>
981
- <span class="recipe-tag ${recipe.mealType === 'breakfast' ? 'tag-breakfast' : 'tag-dinner'}">
982
  ${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'} - Día ${recipe.day}
983
  </span>
984
- <h3 class="recipe-title">${recipe.title}</h3>
985
  </div>
986
- <div class="recipe-servings">
987
  <span>${recipe.servings} porciones</span>
988
  <i class="fas fa-utensils"></i>
989
  </div>
990
  </div>
991
 
992
- <div class="nutrition-badges">
993
- <div class="nutrition-badge badge-calories">
994
  <i class="fas fa-fire"></i> ${recipe.nutrition.calories} kcal
995
  </div>
996
- <div class="nutrition-badge badge-protein">
997
  <i class="fas fa-dumbbell"></i> ${recipe.nutrition.protein}g proteína
998
  </div>
999
- <div class="nutrition-badge badge-carbs">
1000
  <i class="fas fa-bread-slice"></i> ${recipe.nutrition.carbs}g carbos
1001
  </div>
1002
- <div class="nutrition-badge badge-fat">
1003
  <i class="fas fa-oil-can"></i> ${recipe.nutrition.fat}g grasas
1004
  </div>
1005
  </div>
1006
 
1007
- <div class="ingredients-section">
1008
- <h4 class="ingredients-title">Ingredientes (${recipe.servings} porciones):</h4>
1009
- <ul class="ingredients-list">
1010
  ${recipe.ingredients.map(ing =>
1011
- `<li class="ingredient-item">
1012
- <i class="fas fa-check-circle ingredient-icon"></i>
1013
- <span>${ing.original || `${ing.amount} ${ing.unit} ${ing.name}`}</span>
1014
  </li>`
1015
  ).join('')}
1016
  </ul>
1017
  </div>
1018
 
1019
  <div class="instructions-section">
1020
- <h4 class="instructions-title">Instrucciones:</h4>
1021
- <p class="instructions-text">${recipe.instructions || 'Para ver las instrucciones completas, visita el enlace original de la receta.'}</p>
1022
  </div>
1023
 
1024
  ${recipe.sourceUrl ? `
1025
- <div class="recipe-source">
1026
- <span class="source-label">Fuente: </span>
1027
- <a href="${recipe.sourceUrl}" target="_blank" class="source-link">
1028
  ${recipe.sourceName || 'Ver receta original'}
1029
  </a>
1030
  </div>
@@ -1042,12 +476,12 @@
1042
  const allRecipes = document.querySelectorAll('.recipe-card');
1043
 
1044
  allRecipes.forEach(recipe => {
1045
- recipe.style.display = 'none';
1046
 
1047
  if (type === 'all' ||
1048
  (type === 'breakfast' && recipe.dataset.mealType === 'breakfast') ||
1049
  (type === 'dinner' && recipe.dataset.mealType === 'dinner')) {
1050
- recipe.style.display = 'flex';
1051
  }
1052
  });
1053
  }
@@ -1057,7 +491,7 @@
1057
  const allRecipes = document.querySelectorAll('.recipe-card');
1058
 
1059
  allRecipes.forEach(recipe => {
1060
- recipe.style.display = recipe.dataset.day == day ? 'flex' : 'none';
1061
  });
1062
  }
1063
 
@@ -1065,9 +499,9 @@
1065
  function showShoppingList() {
1066
  if (Object.keys(shoppingList).length === 0) {
1067
  shoppingListContent.innerHTML = `
1068
- <div class="shopping-empty">
1069
- <i class="fas fa-shopping-basket shopping-empty-icon"></i>
1070
- <p class="shopping-empty-text">Genera un menú primero para ver la lista de compra</p>
1071
  </div>
1072
  `;
1073
  } else {
@@ -1096,15 +530,15 @@
1096
 
1097
  sortedAisles.forEach(aisle => {
1098
  html += `
1099
- <div class="aisle-section">
1100
- <h4 class="aisle-title">
1101
- <i class="fas fa-store-alt aisle-icon"></i>${aisle}
1102
  </h4>
1103
- <ul class="shopping-list">
1104
  ${aisles[aisle].map(item => `
1105
- <li class="shopping-item">
1106
- <span class="item-name">${item.name}</span>
1107
- <span class="item-quantity">${Math.round(item.amount * 10) / 10} ${item.unit}</span>
1108
  </li>
1109
  `).join('')}
1110
  </ul>
@@ -1129,12 +563,12 @@
1129
  const originalContent = document.body.innerHTML;
1130
 
1131
  document.body.innerHTML = `
1132
- <div style="padding: 40px; font-family: Arial, sans-serif;">
1133
- <h1 style="font-size: 24px; font-weight: bold; text-align: center; margin-bottom: 30px; color: #333;">
1134
  Lista de la Compra
1135
  </h1>
1136
  ${printContent}
1137
- <div style="margin-top: 40px; text-align: center; font-size: 12px; color: #666;">
1138
  Generado por Menú Saludable para Mayores de 50
1139
  </div>
1140
  </div>
@@ -1165,7 +599,7 @@
1165
  let csv = 'Día,Tipo,Receta,Calorías,Proteína (g),Carbohidratos (g),Grasas (g),Ingredientes,URL\n';
1166
 
1167
  currentMenu.forEach(recipe => {
1168
- const ingredients = recipe.ingredients.map(ing => ing.original || `${ing.amount} ${ing.unit} ${ing.name}`).join(' | ');
1169
 
1170
  csv += `"${recipe.day}","${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'}","${recipe.title}","${recipe.nutrition.calories}","${recipe.nutrition.protein}","${recipe.nutrition.carbs}","${recipe.nutrition.fat}","${ingredients}","${recipe.sourceUrl || ''}"\n`;
1171
  });
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Menú Saludable para Mayores de 50</title>
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
  <style>
10
+ /* Estilos personalizados que no se pueden lograr con Tailwind */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  .header-line {
12
  width: 100%;
13
  height: 2px;
 
16
  border-radius: 2px;
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  .loading-spinner {
20
  border: 5px solid #f3f3f3;
21
  border-top: 5px solid #4299e1;
 
31
  100% { transform: rotate(360deg); }
32
  }
33
 
34
+ .fade-in {
35
+ animation: fadeIn 0.5s ease-in;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
+ @keyframes fadeIn {
39
+ from { opacity: 0; }
40
+ to { opacity: 1; }
41
  }
42
 
43
+ /* Estilos para el modal */
44
  .modal {
45
  position: fixed;
46
  top: 0;
 
63
  overflow-y: auto;
64
  padding: 20px;
65
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  </style>
67
  </head>
68
+ <body class="bg-gray-100 text-gray-800 font-sans">
69
+ <div class="container mx-auto px-4 py-8">
70
  <!-- Header -->
71
+ <header class="header text-center mb-8">
72
+ <h1 class="text-4xl font-bold text-blue-900 mb-2">Menú Saludable</h1>
73
+ <h2 class="text-xl text-gray-700">Plan de 30 días para mayores de 50 años</h2>
74
  <div class="header-line"></div>
75
  </header>
76
 
77
  <!-- Controls -->
78
+ <div class="controls bg-white rounded-lg shadow-md p-6 mb-8">
79
+ <div class="controls-container flex flex-wrap justify-between items-center gap-4">
80
+ <div class="filter-group flex flex-col">
81
+ <span class="filter-label font-medium text-gray-700 mb-2">Filtrar por:</span>
82
+ <div class="filter-buttons flex gap-3">
83
+ <button id="filter-all" class="button button-all bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
84
+ Todas
85
+ </button>
86
+ <button id="filter-breakfast" class="button button-breakfast bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
87
+ Desayunos
88
+ </button>
89
+ <button id="filter-dinner" class="button button-dinner bg-purple-500 hover:bg-purple-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
90
+ Cenas
91
+ </button>
92
  </div>
93
  </div>
94
+ <div class="filter-buttons flex gap-3">
95
+ <button id="generate-menu" class="button button-generate bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
96
  <i class="fas fa-sync-alt"></i> Nuevo Menú
97
  </button>
98
+ <button id="shopping-list" class="button button-shopping bg-indigo-500 hover:bg-indigo-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
99
  <i class="fas fa-shopping-basket"></i> Lista de Compra
100
  </button>
101
  </div>
102
+ <div class="filter-buttons flex gap-3">
103
+ <button id="export-pdf" class="button button-pdf bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
104
  <i class="fas fa-file-pdf"></i> PDF
105
  </button>
106
+ <button id="export-csv" class="button button-csv bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300 hover:-translate-y-0.5">
107
  <i class="fas fa-file-csv"></i> CSV
108
  </button>
109
  </div>
 
111
  </div>
112
 
113
  <!-- Loading State -->
114
+ <div id="loading" class="loading hidden flex-col items-center">
115
  <div class="loading-spinner"></div>
116
+ <p class="loading-text text-gray-700 mt-3">Generando menú saludable...</p>
117
  </div>
118
 
119
  <!-- Main Content -->
120
+ <div class="main-content flex flex-col lg:flex-row">
121
  <!-- Calendar View -->
122
+ <div id="calendar-view" class="calendar bg-white rounded-lg shadow-md p-6 mb-6 lg:mb-0 lg:w-1/3 lg:mr-6 lg:sticky lg:top-6">
123
+ <h3 class="calendar-title text-xl font-semibold text-gray-800 mb-4">Calendario del Menú</h3>
124
+ <div class="calendar-grid grid grid-cols-7 gap-2 mb-3">
125
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">L</div>
126
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">M</div>
127
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">X</div>
128
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">J</div>
129
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">V</div>
130
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">S</div>
131
+ <div class="calendar-day-header text-center text-sm font-medium text-gray-500">D</div>
132
  </div>
133
+ <div id="calendar-days" class="calendar-grid grid grid-cols-7 gap-2">
134
  <!-- Calendar days will be populated here -->
135
  </div>
136
+ <div class="nutrition-summary mt-6">
137
+ <h4 class="nutrition-title font-medium text-gray-700 mb-3">Resumen Nutricional</h4>
138
+ <div class="nutrition-card bg-blue-50 rounded-lg p-4">
139
+ <div class="nutrition-item flex justify-between mb-2">
140
+ <span class="nutrition-label text-gray-700">Calorías promedio:</span>
141
+ <span id="avg-calories" class="nutrition-value font-medium">-</span>
142
  </div>
143
+ <div class="nutrition-item flex justify-between mb-2">
144
+ <span class="nutrition-label text-gray-700">Proteínas promedio:</span>
145
+ <span id="avg-protein" class="nutrition-value font-medium">-</span>
146
  </div>
147
+ <div class="nutrition-item flex justify-between">
148
+ <span class="nutrition-label text-gray-700">Balance nutricional:</span>
149
+ <span id="nutrition-score" class="nutrition-value font-medium">-</span>
150
  </div>
151
  </div>
152
  </div>
153
  </div>
154
 
155
  <!-- Recipes List -->
156
+ <div id="recipes-container" class="recipes-container flex-1">
157
+ <div id="no-recipes" class="no-recipes text-center py-10">
158
+ <i class="fas fa-utensils no-recipes-icon text-5xl text-gray-200 mb-4"></i>
159
+ <h3 class="no-recipes-title text-xl text-gray-500 mb-2">No hay recetas cargadas</h3>
160
+ <p class="no-recipes-text text-gray-400">Haz clic en "Generar Menú" para comenzar</p>
161
  </div>
162
+ <div id="recipes-list" class="recipes-list flex flex-col gap-6">
163
  <!-- Recipe cards will be populated here -->
164
  </div>
165
  </div>
 
168
  <!-- Shopping List Modal -->
169
  <div id="shopping-modal" class="modal">
170
  <div class="modal-content">
171
+ <div class="modal-header flex justify-between items-center mb-5">
172
+ <h3 class="modal-title text-xl font-semibold text-gray-800">Lista de la Compra</h3>
173
+ <button id="close-shopping-modal" class="close-modal text-gray-500 text-2xl">
174
  <i class="fas fa-times"></i>
175
  </button>
176
  </div>
177
  <div id="shopping-list-content">
178
+ <div class="shopping-empty text-center py-10">
179
+ <i class="fas fa-shopping-basket shopping-empty-icon text-5xl text-gray-200 mb-4"></i>
180
+ <p class="shopping-empty-text text-gray-500">Genera un menú primero para ver la lista de compra</p>
181
  </div>
182
  </div>
183
+ <div class="modal-footer flex justify-end gap-3 mt-5">
184
+ <button id="print-shopping-list" class="button button-generate bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300">
185
  <i class="fas fa-print"></i> Imprimir
186
  </button>
187
+ <button id="export-shopping-pdf" class="button button-pdf bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-all duration-300">
188
  <i class="fas fa-file-pdf"></i> PDF
189
  </button>
190
  </div>
 
193
  </div>
194
 
195
  <script>
196
+ // API Configuration for Edamam
197
+ const APP_ID = 'YOUR_EDAMAM_APP_ID'; // Reemplaza con tu App ID de Edamam
198
+ const APP_KEY = 'YOUR_EDAMAM_APP_KEY'; // Reemplaza con tu App Key de Edamam
199
+ const API_URL = 'https://api.edamam.com/api/recipes/v2';
200
 
201
  // Global variables
202
  let currentMenu = [];
 
244
  // Create 30 days (1 month)
245
  for (let i = 1; i <= 30; i++) {
246
  const dayElement = document.createElement('div');
247
+ dayElement.className = 'calendar-day text-center p-2 rounded-lg border border-gray-200 cursor-pointer transition-all duration-300 hover:bg-blue-50';
248
  dayElement.textContent = i;
249
  dayElement.dataset.day = i;
250
 
251
  dayElement.addEventListener('click', () => {
252
  // Remove highlight from all days
253
  document.querySelectorAll('.calendar-day').forEach(el => {
254
+ el.classList.remove('bg-blue-500', 'text-white', 'border-blue-500');
255
  });
256
 
257
  // Highlight selected day
258
+ dayElement.classList.add('bg-blue-500', 'text-white', 'border-blue-500');
259
  selectedDay = i;
260
 
261
  // Filter recipes for this day
 
268
 
269
  // Generate monthly menu
270
  async function generateMonthlyMenu() {
271
+ loading.classList.remove('hidden');
272
+ noRecipes.classList.add('hidden');
273
  recipesList.innerHTML = '';
274
 
275
  try {
 
300
  console.error('Error generating menu:', error);
301
  alert('Error al generar el menú. Por favor intenta nuevamente.');
302
  } finally {
303
+ loading.classList.add('hidden');
304
  }
305
  }
306
 
307
+ // Fetch healthy recipe from Edamam API
308
  async function fetchHealthyRecipe(mealType) {
309
  const maxCalories = mealType === 'breakfast' ? 400 : 600;
310
  const minProtein = mealType === 'breakfast' ? 10 : 20;
311
 
312
+ // Parámetros de búsqueda para Edamam
313
  const searchParams = new URLSearchParams({
314
+ type: 'public',
315
+ app_id: APP_ID,
316
+ app_key: APP_KEY,
317
+ mealType: mealType,
318
+ calories: `0-${maxCalories}`,
319
+ health: 'vegetarian,gluten-free', // Puedes ajustar según necesidades
320
+ diet: 'balanced', // Puedes ajustar según necesidades
321
+ random: 'true'
 
 
322
  });
323
 
324
  try {
325
+ // Buscar recetas en Edamam
326
+ const response = await fetch(`${API_URL}?${searchParams}`);
327
+ const data = await response.json();
328
 
329
+ if (data.hits.length === 0) {
330
  console.warn(`No recipes found for ${mealType}`);
331
  return null;
332
  }
333
 
334
+ // Tomamos la primera receta de los resultados
335
+ const recipeData = data.hits[0].recipe;
 
 
 
336
 
337
+ // Formateamos los datos de la receta para nuestra app
338
  return {
339
+ id: recipeData.uri.split('#')[1], // Extraemos el ID de la URI
340
+ title: recipeData.label,
341
+ image: recipeData.image || 'https://via.placeholder.com/400x300?text=Imagen+no+disponible',
342
+ servings: recipeData.yield || 2,
343
+ sourceUrl: recipeData.url,
344
+ sourceName: recipeData.source || 'Edamam',
345
+ ingredients: recipeData.ingredients || [],
346
  instructions: recipeData.instructions || 'Ver instrucciones en el enlace original',
347
  nutrition: {
348
+ calories: Math.round(recipeData.calories / (recipeData.yield || 1)),
349
+ protein: Math.round(recipeData.totalNutrients.PROCNT.quantity / (recipeData.yield || 1)),
350
+ carbs: Math.round(recipeData.totalNutrients.CHOCDF.quantity / (recipeData.yield || 1)),
351
+ fat: Math.round(recipeData.totalNutrients.FAT.quantity / (recipeData.yield || 1)),
352
+ fiber: Math.round(recipeData.totalNutrients.FIBTG.quantity / (recipeData.yield || 1))
353
  }
354
  };
355
  } catch (error) {
 
361
  // Add ingredients to shopping list
362
  function addToShoppingList(ingredients) {
363
  ingredients.forEach(ingredient => {
364
+ const name = ingredient.food.toLowerCase();
365
+ const amount = ingredient.quantity || 1;
366
+ const unit = ingredient.measure || 'unidad';
367
 
368
  if (shoppingList[name]) {
369
  shoppingList[name].amount += amount;
 
371
  shoppingList[name] = {
372
  amount,
373
  unit,
374
+ aisle: getIngredientAisle(ingredient.food)
375
  };
376
  }
377
  });
 
394
  // Render recipes
395
  function renderRecipes(recipes) {
396
  if (recipes.length === 0) {
397
+ noRecipes.classList.remove('hidden');
398
  return;
399
  }
400
 
 
402
 
403
  recipes.forEach(recipe => {
404
  const recipeCard = document.createElement('div');
405
+ recipeCard.className = 'recipe-card bg-white rounded-lg shadow-md overflow-hidden transition-all duration-300 hover:-translate-y-1 hover:shadow-lg fade-in';
406
  recipeCard.dataset.day = recipe.day;
407
  recipeCard.dataset.mealType = recipe.mealType;
408
 
409
  recipeCard.innerHTML = `
410
+ <div class="recipe-content flex flex-col lg:flex-row">
411
+ <img class="recipe-image w-full h-48 object-cover lg:w-1/3 lg:h-auto" src="${recipe.image}" alt="${recipe.title}" onerror="this.src='https://via.placeholder.com/400x300?text=Imagen+no+disponible'">
412
+ <div class="recipe-details p-5 flex-1">
413
+ <div class="recipe-header flex flex-col lg:flex-row lg:justify-between lg:items-start mb-4">
414
  <div>
415
+ <span class="recipe-tag ${recipe.mealType === 'breakfast' ? 'bg-green-100 text-green-800' : 'bg-purple-100 text-purple-800'} text-xs font-semibold px-3 py-1 rounded-full mb-2 inline-block">
416
  ${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'} - Día ${recipe.day}
417
  </span>
418
+ <h3 class="recipe-title text-xl font-bold text-gray-800 mb-1">${recipe.title}</h3>
419
  </div>
420
+ <div class="recipe-servings flex items-center gap-1 text-gray-500 text-sm mt-2 lg:mt-0">
421
  <span>${recipe.servings} porciones</span>
422
  <i class="fas fa-utensils"></i>
423
  </div>
424
  </div>
425
 
426
+ <div class="nutrition-badges flex flex-wrap gap-2 my-4">
427
+ <div class="nutrition-badge ${recipe.mealType === 'breakfast' ? 'bg-red-100 text-red-800' : 'bg-red-200 text-red-900'} px-3 py-1 rounded-full text-xs font-medium flex items-center gap-1">
428
  <i class="fas fa-fire"></i> ${recipe.nutrition.calories} kcal
429
  </div>
430
+ <div class="nutrition-badge bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs font-medium flex items-center gap-1">
431
  <i class="fas fa-dumbbell"></i> ${recipe.nutrition.protein}g proteína
432
  </div>
433
+ <div class="nutrition-badge bg-yellow-100 text-yellow-800 px-3 py-1 rounded-full text-xs font-medium flex items-center gap-1">
434
  <i class="fas fa-bread-slice"></i> ${recipe.nutrition.carbs}g carbos
435
  </div>
436
+ <div class="nutrition-badge bg-pink-100 text-pink-800 px-3 py-1 rounded-full text-xs font-medium flex items-center gap-1">
437
  <i class="fas fa-oil-can"></i> ${recipe.nutrition.fat}g grasas
438
  </div>
439
  </div>
440
 
441
+ <div class="ingredients-section mb-4">
442
+ <h4 class="ingredients-title font-medium text-gray-700 mb-2">Ingredientes (${recipe.servings} porciones):</h4>
443
+ <ul class="ingredients-list grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm text-gray-700">
444
  ${recipe.ingredients.map(ing =>
445
+ `<li class="ingredient-item flex items-start">
446
+ <i class="fas fa-check-circle text-green-500 text-xs mt-1 mr-2"></i>
447
+ <span>${ing.text || `${ing.quantity || 1} ${ing.measure || 'unidad'} ${ing.food}`}</span>
448
  </li>`
449
  ).join('')}
450
  </ul>
451
  </div>
452
 
453
  <div class="instructions-section">
454
+ <h4 class="instructions-title font-medium text-gray-700 mb-2">Instrucciones:</h4>
455
+ <p class="instructions-text text-sm text-gray-700">${recipe.instructions || 'Para ver las instrucciones completas, visita el enlace original de la receta.'}</p>
456
  </div>
457
 
458
  ${recipe.sourceUrl ? `
459
+ <div class="recipe-source mt-4 text-sm">
460
+ <span class="source-label text-gray-500">Fuente: </span>
461
+ <a href="${recipe.sourceUrl}" target="_blank" class="source-link text-blue-500 hover:text-blue-600 hover:underline">
462
  ${recipe.sourceName || 'Ver receta original'}
463
  </a>
464
  </div>
 
476
  const allRecipes = document.querySelectorAll('.recipe-card');
477
 
478
  allRecipes.forEach(recipe => {
479
+ recipe.classList.add('hidden');
480
 
481
  if (type === 'all' ||
482
  (type === 'breakfast' && recipe.dataset.mealType === 'breakfast') ||
483
  (type === 'dinner' && recipe.dataset.mealType === 'dinner')) {
484
+ recipe.classList.remove('hidden');
485
  }
486
  });
487
  }
 
491
  const allRecipes = document.querySelectorAll('.recipe-card');
492
 
493
  allRecipes.forEach(recipe => {
494
+ recipe.classList.toggle('hidden', recipe.dataset.day != day);
495
  });
496
  }
497
 
 
499
  function showShoppingList() {
500
  if (Object.keys(shoppingList).length === 0) {
501
  shoppingListContent.innerHTML = `
502
+ <div class="shopping-empty text-center py-10">
503
+ <i class="fas fa-shopping-basket text-5xl text-gray-200 mb-4"></i>
504
+ <p class="text-gray-500">Genera un menú primero para ver la lista de compra</p>
505
  </div>
506
  `;
507
  } else {
 
530
 
531
  sortedAisles.forEach(aisle => {
532
  html += `
533
+ <div class="aisle-section mb-6">
534
+ <h4 class="aisle-title text-lg font-medium text-gray-800 mb-4 pb-2 border-b border-gray-200">
535
+ <i class="fas fa-store-alt text-blue-500 mr-2"></i>${aisle}
536
  </h4>
537
+ <ul class="shopping-list flex flex-col gap-3">
538
  ${aisles[aisle].map(item => `
539
+ <li class="shopping-item flex justify-between items-center bg-gray-50 px-4 py-3 rounded-lg">
540
+ <span class="item-name font-medium">${item.name}</span>
541
+ <span class="item-quantity text-gray-500">${Math.round(item.amount * 10) / 10} ${item.unit}</span>
542
  </li>
543
  `).join('')}
544
  </ul>
 
563
  const originalContent = document.body.innerHTML;
564
 
565
  document.body.innerHTML = `
566
+ <div class="p-10 font-sans">
567
+ <h1 class="text-2xl font-bold text-center mb-8 text-gray-800">
568
  Lista de la Compra
569
  </h1>
570
  ${printContent}
571
+ <div class="mt-10 text-center text-sm text-gray-500">
572
  Generado por Menú Saludable para Mayores de 50
573
  </div>
574
  </div>
 
599
  let csv = 'Día,Tipo,Receta,Calorías,Proteína (g),Carbohidratos (g),Grasas (g),Ingredientes,URL\n';
600
 
601
  currentMenu.forEach(recipe => {
602
+ const ingredients = recipe.ingredients.map(ing => ing.text || `${ing.quantity || 1} ${ing.measure || 'unidad'} ${ing.food}`).join(' | ');
603
 
604
  csv += `"${recipe.day}","${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'}","${recipe.title}","${recipe.nutrition.calories}","${recipe.nutrition.protein}","${recipe.nutrition.carbs}","${recipe.nutrition.fat}","${ingredients}","${recipe.sourceUrl || ''}"\n`;
605
  });
prompts.txt CHANGED
@@ -2,4 +2,5 @@ Una aplicacion html y javascript en local sin node y con flexbox, que pida rece
2
  puedes adaptarlo para usar el api de edamam.com y con mi api key edamam 1b8ad4ca
3
  puedes hacerlo con flexbox y arreglar el siguiente error:
4
  NO USES tailwind USA FLEXBOX
5
- puedes adaptarla para usar spoonacular api?
 
 
2
  puedes adaptarlo para usar el api de edamam.com y con mi api key edamam 1b8ad4ca
3
  puedes hacerlo con flexbox y arreglar el siguiente error:
4
  NO USES tailwind USA FLEXBOX
5
+ puedes adaptarla para usar spoonacular api?
6
+ puedes usar edamam como api?