File size: 102,842 Bytes
71b90ee 61444f5 d96d7ff 71b90ee 61444f5 71b90ee 61444f5 d96d7ff 61444f5 71b90ee 61444f5 d96d7ff 71b90ee 19cfe26 71b90ee 19cfe26 71b90ee 19cfe26 71b90ee 19cfe26 71b90ee d96d7ff 71b90ee d96d7ff 71b90ee 19cfe26 d96d7ff 61444f5 71b90ee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | <!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Whoop Thailand - ติดตามสุขภาพ 24 ชั่วโมง</title>
<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>
<style>
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');
* {
font-family: 'Kanit', sans-serif;
}
.gradient-bg {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.card-shadow {
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.health-metric-card {
transition: all 0.3s ease;
}
.health-metric-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.progress-ring {
transform: rotate(-90deg);
}
.tab-active {
border-bottom: 3px solid #667eea;
color: #667eea;
}
.scroll-hidden::-webkit-scrollbar {
display: none;
}
.scroll-hidden {
-ms-overflow-style: none;
scrollbar-width: none;
}
@keyframes pulse-dot {
0%, 60%, 100% {
opacity: 0.3;
}
30% {
opacity: 1;
}
}
.pulse-dot {
animation: pulse-dot 2s infinite;
}
.metric-trend-up {
color: #10b981;
}
.metric-trend-down {
color: #ef4444;
}
.metric-trend-neutral {
color: #6b7280;
}
</style>
</head>
<body class="bg-gray-50">
<!-- Mobile Container -->
<div class="max-w-md mx-auto bg-white min-h-screen relative">
<!-- Header -->
<div class="gradient-bg text-white p-4 pb-6">
<div class="flex justify-between items-center mb-4">
<div class="flex items-center space-x-2">
<div class="w-10 h-10 bg-white rounded-full flex items-center justify-center">
<span class="text-purple-600 font-bold text-xl">W</span>
</div>
<div>
<h1 class="text-lg font-semibold">Whoop</h1>
<p class="text-xs opacity-90">สวัสดี, สมชาย 👋</p>
</div>
</div>
<div class="flex items-center space-x-3">
<button onclick="showNotifications()" class="relative">
<i data-feather="bell" class="w-5 h-5"></i>
<span class="absolute -top-1 -right-1 w-2 h-2 bg-red-500 rounded-full pulse-dot"></span>
</button>
<button onclick="showProfile()">
<img src="http://static.photos/people/40x40/45" alt="Profile" class="w-8 h-8 rounded-full border-2 border-white">
</button>
</div>
</div>
<!-- Score Overview -->
<div class="bg-white/20 backdrop-blur rounded-2xl p-4">
<div class="grid grid-cols-3 gap-4 text-center">
<div>
<p class="text-2xl font-bold">87</p>
<p class="text-xs opacity-90">คะแนนสุขภาพ</p>
</div>
<div>
<p class="text-2xl font-bold">72%</p>
<p class="text-xs opacity-90">การฟื้นตัว</p>
</div>
<div>
<p class="text-2xl font-bold">8.2</p>
<p class="text-xs opacity-90">ชั่วโมงนอน</p>
</div>
</div>
</div>
</div>
<!-- Navigation Tabs -->
<div class="bg-white sticky top-0 z-10 border-b">
<div class="flex justify-around p-2">
<button onclick="switchTab('dashboard')" class="tab-btn px-4 py-2 text-sm font-medium tab-active transition-all" data-tab="dashboard">
แดชบอร์ด
</button>
<button onclick="switchTab('metrics')" class="tab-btn px-4 py-2 text-sm font-medium text-gray-600 transition-all" data-tab="metrics">
สถิติ 160+
</button>
<button onclick="switchTab('insights')" class="tab-btn px-4 py-2 text-sm font-medium text-gray-600 transition-all" data-tab="insights">
ข้อมูลเชิงลึก
</button>
<button onclick="switchTab('if-training')" class="tab-btn px-4 py-2 text-sm font-medium text-gray-600 transition-all" data-tab="if-training">
ฝึก IF
</button>
<button onclick="switchTab('impacts')" class="tab-btn px-4 py-2 text-sm font-medium text-gray-600 transition-all" data-tab="impacts">
Impacts
</button>
<button onclick="switchTab('goals')" class="tab-btn px-4 py-2 text-sm font-medium text-gray-600 transition-all" data-tab="goals">
เป้าหมาย
</button>
</div>
</div>
<!-- Content Area -->
<div class="pb-20">
<!-- Dashboard Tab -->
<div id="dashboard" class="tab-content p-4">
<!-- Quick Stats -->
<div class="grid grid-cols-2 gap-3 mb-4">
<div class="bg-gradient-to-br from-purple-500 to-pink-500 rounded-xl p-4 text-white">
<div class="flex items-center justify-between mb-2">
<i data-feather="heart" class="w-5 h-5"></i>
<span class="text-xs bg-white/20 px-2 py-1 rounded-full">ขณะนี้</span>
</div>
<p class="text-2xl font-bold">68</p>
<p class="text-xs opacity-90">ชีพจร BPM</p>
</div>
<div class="bg-gradient-to-br from-blue-500 to-cyan-500 rounded-xl p-4 text-white">
<div class="flex items-center justify-between mb-2">
<i data-feather="zap" class="w-5 h-5"></i>
<span class="text-xs bg-white/20 px-2 py-1 rounded-full metric-trend-up">↑ 12%</span>
</div>
<p class="text-2xl font-bold">425</p>
<p class="text-xs opacity-90">แคลอรีที่เผา</p>
</div>
</div>
<!-- Today's Activities -->
<div class="mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="activity" class="w-4 h-4 mr-2 text-purple-600"></i>
กิจกรรมวันนี้
</h3>
<div class="space-y-2">
<div class="bg-white rounded-lg p-3 card-shadow flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center">
<i data-feather="moon" class="w-5 h-5 text-green-600"></i>
</div>
<div>
<p class="font-medium text-sm">การนอนหลับ</p>
<p class="text-xs text-gray-500">คุณภาพดีมาก</p>
</div>
</div>
<div class="text-right">
<p class="text-sm font-semibold">8.2 ชม.</p>
<p class="text-xs text-gray-500">คะแนน 92</p>
</div>
</div>
<div class="bg-white rounded-lg p-3 card-shadow flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center">
<i data-feather="droplet" class="w-5 h-5 text-blue-600"></i>
</div>
<div>
<p class="font-medium text-sm">การดื่มน้ำ</p>
<p class="text-xs text-gray-500">เหลืออีก 500 มล.</p>
</div>
</div>
<div class="text-right">
<p class="text-sm font-semibold">1.5 ลิตร</p>
<p class="text-xs text-gray-500">75%</p>
</div>
</div>
<div class="bg-white rounded-lg p-3 card-shadow flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 bg-orange-100 rounded-full flex items-center justify-center">
<i data-feather="trending-up" class="w-5 h-5 text-orange-600"></i>
</div>
<div>
<p class="font-medium text-sm">การออกกำลังกาย</p>
<p class="text-xs text-gray-500">วิ่ง 5 กม.</p>
</div>
</div>
<div class="text-right">
<p class="text-sm font-semibold">32 นาที</p>
<p class="text-xs text-gray-500">คะแนน 88</p>
</div>
</div>
</div>
</div>
<!-- Weekly Progress -->
<div>
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="calendar" class="w-4 h-4 mr-2 text-purple-600"></i>
ความคืบหน้ารายสัปดาห์
</h3>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="grid grid-cols-7 gap-2 mb-3">
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">จ</p>
<div class="h-16 bg-gray-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-500 rounded" style="height: 60%"></div>
</div>
</div>
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">อ</p>
<div class="h-16 bg-gray-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-500 rounded" style="height: 80%"></div>
</div>
</div>
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">พ</p>
<div class="h-16 bg-gray-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-500 rounded" style="height: 70%"></div>
</div>
</div>
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">พฤ</p>
<div class="h-16 bg-gray-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-500 rounded" style="height: 90%"></div>
</div>
</div>
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">ศ</p>
<div class="h-16 bg-gray-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-500 rounded" style="height: 65%"></div>
</div>
</div>
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">ส</p>
<div class="h-16 bg-gray-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-300 rounded" style="height: 40%"></div>
</div>
</div>
<div class="text-center">
<p class="text-xs text-gray-500 mb-1">อา</p>
<div class="h-16 bg-purple-100 rounded-lg flex items-end justify-center p-1">
<div class="w-full bg-purple-300 rounded animate-pulse" style="height: 30%"></div>
</div>
</div>
</div>
<div class="flex justify-between text-sm">
<span class="text-gray-600">ค่าเฉลี่ยคะแนน</span>
<span class="font-semibold text-purple-600">73.5 / 100</span>
</div>
</div>
</div>
</div>
<!-- Metrics Tab (160+ Health Metrics) -->
<div id="metrics" class="tab-content hidden p-4">
<!-- Search Bar -->
<div class="mb-4">
<div class="relative">
<i data-feather="search" class="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"></i>
<input type="text" placeholder="ค้นหาสถิติทั้งหมด 160+ รายการ..."
class="w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:border-purple-500">
</div>
</div>
<!-- Metric Categories -->
<div class="mb-4">
<div class="flex space-x-2 overflow-x-auto scroll-hidden pb-2">
<button class="px-4 py-1 bg-purple-600 text-white rounded-full text-sm whitespace-nowrap">ทั้งหมด</button>
<button class="px-4 py-1 bg-gray-200 text-gray-700 rounded-full text-sm whitespace-nowrap">หัวใจ</button>
<button class="px-4 py-1 bg-gray-200 text-gray-700 rounded-full text-sm whitespace-nowrap">การนอน</button>
<button class="px-4 py-1 bg-gray-200 text-gray-700 rounded-full text-sm whitespace-nowrap">การออกกำลังกาย</button>
<button class="px-4 py-1 bg-gray-200 text-gray-700 rounded-full text-sm whitespace-nowrap">อาหาร</button>
<button class="px-4 py-1 bg-gray-200 text-gray-700 rounded-full text-sm whitespace-nowrap">ความเครียด</button>
</div>
</div>
<!-- Health Metrics Grid -->
<div class="space-y-4">
<!-- Heart Metrics -->
<div class="bg-white rounded-xl p-4 card-shadow">
<h4 class="font-semibold mb-3 flex items-center text-purple-600">
<i data-feather="heart" class="w-4 h-4 mr-2"></i>
หัวใจและไหลเลือด (12 รายการ)
</h4>
<div class="grid grid-cols-2 gap-3">
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ชีพจรขณะพัก</p>
<p class="text-lg font-bold">58 BPM</p>
<span class="text-xs metric-trend-up">↓ 2 จากเมื่อวาน</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ความดันซิสโทล</p>
<p class="text-lg font-bold">120 mmHg</p>
<span class="text-xs metric-trend-neutral">ปกติ</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ความดันไดแอสโทล</p>
<p class="text-lg font-bold">80 mmHg</p>
<span class="text-xs metric-trend-neutral">ปกติ</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">HRV</p>
<p class="text-lg font-bold">42 ms</p>
<span class="text-xs metric-trend-up">↑ 5 จากเมื่อวาน</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ออกซิเจนในเลือด</p>
<p class="text-lg font-bold">98%</p>
<span class="text-xs metric-trend-neutral">ดีมาก</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ชีพจรสูงสุด</p>
<p class="text-lg font-bold">165 BPM</p>
<span class="text-xs metric-trend-neutral">85% ของสูงสุด</span>
</div>
</div>
</div>
<!-- Sleep Metrics -->
<div class="bg-white rounded-xl p-4 card-shadow">
<h4 class="font-semibold mb-3 flex items-center text-purple-600">
<i data-feather="moon" class="w-4 h-4 mr-2"></i>
การนอนหลับ (18 รายการ)
</h4>
<div class="grid grid-cols-2 gap-3">
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ระยะเวลานอน</p>
<p class="text-lg font-bold">8.2 ชม.</p>
<span class="text-xs metric-trend-up">↑ 0.5 ชม.</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">คุณภาพการนอน</p>
<p class="text-lg font-bold">85%</p>
<span class="text-xs metric-trend-up">ดีมาก</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">REM Sleep</p>
<p class="text-lg font-bold">1.8 ชม.</p>
<span class="text-xs metric-trend-neutral">22% ของทั้งหมด</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">Deep Sleep</p>
<p class="text-lg font-bold">2.1 ชม.</p>
<span class="text-xs metric-trend-neutral">26% ของทั้งหมด</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">Light Sleep</p>
<p class="text-lg font-bold">4.3 ชม.</p>
<span class="text-xs metric-trend-neutral">52% ของทั้งหมด</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ตื่นขึ้นมา</p>
<p class="text-lg font-bold">3 ครั้ง</p>
<span class="text-xs metric-trend-down">↓ 1 ครั้ง</span>
</div>
</div>
</div>
<!-- Exercise Metrics -->
<div class="bg-white rounded-xl p-4 card-shadow">
<h4 class="font-semibold mb-3 flex items-center text-purple-600">
<i data-feather="trending-up" class="w-4 h-4 mr-2"></i>
การออกกำลังกาย (25 รายการ)
</h4>
<div class="grid grid-cols-2 gap-3">
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ก้าวเดินวันนี้</p>
<p class="text-lg font-bold">12,847</p>
<span class="text-xs metric-trend-up">↑ 23%</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ระยะทาง</p>
<p class="text-lg font-bold">8.2 กม.</p>
<span class="text-xs metric-trend-up">↑ 1.2 กม.</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">แคลอรีที่เผา</p>
<p class="text-lg font-bold">425 kcal</p>
<span class="text-xs metric-trend-up">↑ 15%</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">เวลาออกกำลังกาย</p>
<p class="text-lg font-bold">32 นาที</p>
<span class="text-xs metric-trend-neutral">ถึงเป้า</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ความเข้มข้น</p>
<p class="text-lg font-bold">75%</p>
<span class="text-xs metric-trend-neutral">ปานกลาง</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ชั้นขั้น</p>
<p class="text-lg font-bold">45 ชั้น</p>
<span class="text-xs metric-trend-up">↑ 10 ชั้น</span>
</div>
</div>
</div>
<!-- Nutrition Metrics -->
<div class="bg-white rounded-xl p-4 card-shadow">
<h4 class="font-semibold mb-3 flex items-center text-purple-600">
<i data-feather="coffee" class="w-4 h-4 mr-2"></i>
โภชนาการ (22 รายการ)
</h4>
<div class="grid grid-cols-2 gap-3">
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">แคลอรีรับประทาน</p>
<p class="text-lg font-bold">1,850 kcal</p>
<span class="text-xs metric-trend-neutral">92% ของเป้า</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">โปรตีน</p>
<p class="text-lg font-bold">85 กรัม</p>
<span class="text-xs metric-trend-up">เพียงพอ</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">คาร์โบไฮเดรต</p>
<p class="text-lg font-bold">230 กรัม</p>
<span class="text-xs metric-trend-neutral">ปกติ</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ไขมัน</p>
<p class="text-lg font-bold">65 กรัม</p>
<span class="text-xs metric-trend-neutral">ปกติ</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">น้ำตาล</p>
<p class="text-lg font-bold">42 กรัม</p>
<span class="text-xs metric-trend-down">↓ 5 กรัม</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ไฟเบอร์</p>
<p class="text-lg font-bold">28 กรัม</p>
<span class="text-xs metric-trend-up">↑ 2 กรัม</span>
</div>
</div>
</div>
<!-- Stress Metrics -->
<div class="bg-white rounded-xl p-4 card-shadow">
<h4 class="font-semibold mb-3 flex items-center text-purple-600">
<i data-feather="alert-circle" class="w-4 h-4 mr-2"></i>
ความเครียดและจิตใจ (15 รายการ)
</h4>
<div class="grid grid-cols-2 gap-3">
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ระดับความเครียด</p>
<p class="text-lg font-bold">28%</p>
<span class="text-xs metric-trend-down">ต่ำ</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">คอร์ติซอล</p>
<p class="text-lg font-bold">12 nmol/L</p>
<span class="text-xs metric-trend-down">↓ 2</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">ความผ่อนคลาย</p>
<p class="text-lg font-bold">85%</p>
<span class="text-xs metric-trend-up">ดีมาก</span>
</div>
<div class="health-metric-card bg-gray-50 rounded-lg p-3">
<p class="text-xs text-gray-600">โฟกัส</p>
<p class="text-lg font-bold">78%</p>
<span class="text-xs metric-trend-neutral">ดี</span>
</div>
</div>
</div>
<!-- Load More -->
<div class="text-center py-4">
<button class="text-purple-600 font-medium text-sm">แสดงเพิ่มเติม 93 รายการ ↓</button>
</div>
</div>
</div>
<!-- Insights Tab -->
<div id="insights" class="tab-content hidden p-4">
<!-- AI Insights -->
<div class="bg-gradient-to-br from-purple-500 to-pink-500 rounded-xl p-4 text-white mb-4">
<div class="flex items-center mb-2">
<i data-feather="cpu" class="w-5 h-5 mr-2"></i>
<h3 class="font-semibold">ข้อมูลเชิงลึกจาก AI</h3>
</div>
<p class="text-sm leading-relaxed">
จากการวิเคราะห์ข้อมูล 7 วันที่ผ่านมา พบว่าคุณมีการฟื้นตัวดีขึ้น 15% เนื่องจากการนอนหลับที่เพิ่มขึ้นและการจัดการความเครียดที่ดีขึ้น แนะนำให้รักษากำหนดการนอนต่อเนื่อง
</p>
</div>
<!-- Trends -->
<div class="bg-white rounded-xl p-4 card-shadow mb-4">
<h3 class="font-semibold mb-3">แนวโน้มสำคัญ</h3>
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-green-50 rounded-lg">
<div class="flex items-center">
<i data-feather="trending-up" class="w-4 h-4 text-green-600 mr-3"></i>
<div>
<p class="font-medium text-sm">คุณภาพการนอนดีขึ้น</p>
<p class="text-xs text-gray-600">เพิ่มขึ้น 12% ใน 7 วัน</p>
</div>
</div>
<span class="text-green-600 font-bold text-sm">+12%</span>
</div>
<div class="flex items-center justify-between p-3 bg-blue-50 rounded-lg">
<div class="flex items-center">
<i data-feather="activity" class="w-4 h-4 text-blue-600 mr-3"></i>
<div>
<p class="font-medium text-sm">HRV ดีขึ้น</p>
<p class="text-xs text-gray-600">ระบบภูมิคุ้มกันแข็งแกร่ง</p>
</div>
</div>
<span class="text-blue-600 font-bold text-sm">+8ms</span>
</div>
<div class="flex items-center justify-between p-3 bg-orange-50 rounded-lg">
<div class="flex items-center">
<i data-feather="alert-triangle" class="w-4 h-4 text-orange-600 mr-3"></i>
<div>
<p class="font-medium text-sm">ความเครียดสูงขึ้น</p>
<p class="text-xs text-gray-600">หลังเที่ยงวันทุกวัน</p>
</div>
</div>
<span class="text-orange-600 font-bold text-sm">+5%</span>
</div>
</div>
</div>
<!-- Recommendations -->
<div class="bg-white rounded-xl p-4 card-shadow mb-4">
<h3 class="font-semibold mb-3">คำแนะนำส่วนตัว</h3>
<div class="space-y-3">
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center flex-shrink-0 mt-1">
<span class="text-purple-600 font-bold text-sm">1</span>
</div>
<div>
<p class="font-medium text-sm">เพิ่มการพักผ่อนหลังเที่ยง</p>
<p class="text-xs text-gray-600">5-10 นาที จะช่วยลดความเครียดได้</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center flex-shrink-0 mt-1">
<span class="text-purple-600 font-bold text-sm">2</span>
</div>
<div>
<p class="font-medium text-sm">ดื่มน้ำมากขึ้น</p>
<p class="text-xs text-gray-600">เพิ่ม 200 มล. ในช่วงเช้า</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center flex-shrink-0 mt-1">
<span class="text-purple-600 font-bold text-sm">3</span>
</div>
<div>
<p class="font-medium text-sm">ออกกำลังกายแบบ HIIT</p>
<p class="text-xs text-gray-600">2 ครั้งต่อสัปดาห์ เพื่อเพิ่มสมรรถภาพ</p>
</div>
</div>
</div>
</div>
</div>
<!-- IF Training Tab -->
<div id="if-training" class="tab-content hidden p-4">
<!-- IF Status Card -->
<div class="bg-gradient-to-br from-orange-500 to-red-500 rounded-xl p-4 text-white mb-4">
<div class="flex justify-between items-start mb-3">
<div>
<h3 class="font-semibold text-lg">Intermittent Fasting</h3>
<p class="text-sm opacity-90">วันที่ 15 ของเดือนนี้</p>
</div>
<div class="bg-white/20 backdrop-blur rounded-full px-3 py-1">
<span class="text-sm font-medium">16:8</span>
</div>
</div>
<!-- Current Fast Timer -->
<div class="bg-white/10 backdrop-blur rounded-lg p-3 mb-3">
<div class="flex justify-between items-center mb-2">
<span class="text-sm">ระยะเวลาที่ทำไปแล้ว</span>
<span class="text-xs bg-green-400 text-green-900 px-2 py-1 rounded-full">กำลังทำอยู่</span>
</div>
<div class="text-3xl font-bold mb-1">14:32:45</div>
<div class="w-full bg-white/20 rounded-full h-2">
<div class="bg-white h-2 rounded-full transition-all duration-1000" style="width: 91%"></div>
</div>
<div class="flex justify-between text-xs mt-2 opacity-90">
<span>เริ่ม 20:00</span>
<span>สิ้นสุด 12:00</span>
</div>
</div>
<!-- Quick Stats -->
<div class="grid grid-cols-3 gap-3 text-center">
<div>
<p class="text-xl font-bold">15</p>
<p class="text-xs opacity-90">วันทำต่อเนื่อง</p>
</div>
<div>
<p class="text-xl font-bold">68</p>
<p class="text-xs opacity-90">ชั่วโมงรวม</p>
</div>
<div>
<p class="text-xl font-bold">2.1</p>
<p class="text-xs opacity-90">กก. ลดน้ำหนัก</p>
</div>
</div>
</div>
<!-- IF Plans -->
<div class="mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="clock" class="w-4 h-4 mr-2 text-purple-600"></i>
แผนการทำ IF
</h3>
<div class="grid grid-cols-2 gap-3">
<button onclick="selectIFPlan('16:8')" class="bg-white rounded-xl p-3 card-shadow border-2 border-purple-500">
<div class="text-center">
<p class="font-bold text-purple-600">16:8</p>
<p class="text-xs text-gray-600 mt-1">16 ชม. อด 8 ชม. กิน</p>
<p class="text-xs text-green-600 mt-2">✓ กำลังใช้งาน</p>
</div>
</button>
<button onclick="selectIFPlan('18:6')" class="bg-white rounded-xl p-3 card-shadow">
<div class="text-center">
<p class="font-bold">18:6</p>
<p class="text-xs text-gray-600 mt-1">18 ชม. อด 6 ชม. กิน</p>
<p class="text-xs text-gray-500 mt-2">ขั้นสูง</p>
</div>
</button>
<button onclick="selectIFPlan('20:4')" class="bg-white rounded-xl p-3 card-shadow">
<div class="text-center">
<p class="font-bold">20:4</p>
<p class="text-xs text-gray-600 mt-1">20 ชม. อด 4 ชม. กิน</p>
<p class="text-xs text-gray-500 mt-2">ผู้เชี่ยวชาญ</p>
</div>
</button>
<button onclick="selectIFPlan('OMAD')" class="bg-white rounded-xl p-3 card-shadow">
<div class="text-center">
<p class="font-bold">OMAD</p>
<p class="text-xs text-gray-600 mt-1">มื้อเดียวต่อวัน</p>
<p class="text-xs text-gray-500 mt-2">สุดขั้ว</p>
</div>
</button>
</div>
</div>
<!-- Weekly Schedule -->
<div class="bg-white rounded-xl p-4 card-shadow mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="calendar" class="w-4 h-4 mr-2 text-purple-600"></i>
ตารางทำ IF รายสัปดาห์
</h3>
<div class="space-y-2">
<div class="flex items-center justify-between p-2 bg-green-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white text-xs font-bold">จ</div>
<span class="ml-3 text-sm font-medium">จันทร์</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold">สำเร็จ</p>
<p class="text-xs text-gray-600">16:08 ชม.</p>
</div>
</div>
<div class="flex items-center justify-between p-2 bg-green-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white text-xs font-bold">อ</div>
<span class="ml-3 text-sm font-medium">อังคาร</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold">สำเร็จ</p>
<p class="text-xs text-gray-600">16:12 ชม.</p>
</div>
</div>
<div class="flex items-center justify-between p-2 bg-green-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white text-xs font-bold">พ</div>
<span class="ml-3 text-sm font-medium">พุธ</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold">สำเร็จ</p>
<p class="text-xs text-gray-600">16:05 ชม.</p>
</div>
</div>
<div class="flex items-center justify-between p-2 bg-orange-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-orange-500 rounded-full flex items-center justify-center text-white text-xs font-bold">พฤ</div>
<span class="ml-3 text-sm font-medium">พฤหัส</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold text-orange-600">กำลังทำ</p>
<p class="text-xs text-gray-600">14:32 ชม.</p>
</div>
</div>
<div class="flex items-center justify-between p-2 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center text-white text-xs font-bold">ศ</div>
<span class="ml-3 text-sm font-medium">ศุกร์</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold">รอดำเนินการ</p>
<p class="text-xs text-gray-600">20:00 - 12:00</p>
</div>
</div>
<div class="flex items-center justify-between p-2 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center text-white text-xs font-bold">ส</div>
<span class="ml-3 text-sm font-medium">เสาร์</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold">วันหยุดพัก</p>
<p class="text-xs text-gray-600">กินตามปกติ</p>
</div>
</div>
<div class="flex items-center justify-between p-2 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center text-white text-xs font-bold">อา</div>
<span class="ml-3 text-sm font-medium">อาทิตย์</span>
</div>
<div class="text-right">
<p class="text-sm font-semibold">วันหยุดพัก</p>
<p class="text-xs text-gray-600">กินตามปกติ</p>
</div>
</div>
</div>
</div>
<!-- IF Tips -->
<div class="bg-white rounded-xl p-4 card-shadow mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="info" class="w-4 h-4 mr-2 text-purple-600"></i>
เคล็ดลับการทำ IF
</h3>
<div class="space-y-3">
<div class="flex items-start space-x-3">
<div class="w-6 h-6 bg-blue-100 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5">
<i data-feather="droplet" class="w-3 h-3 text-blue-600"></i>
</div>
<div>
<p class="font-medium text-sm">ดื่มน้ำมากๆ</p>
<p class="text-xs text-gray-600">ช่วยลดความหิวและรักษาสมดุลร่างกาย</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-6 h-6 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5">
<i data-feather="coffee" class="w-3 h-3 text-green-600"></i>
</div>
<div>
<p class="font-medium text-sm">ดื่มกาแฟ/ชาได้</p>
<p class="text-xs text-gray-600">ไม่ใส่นมและน้ำตาล ช่วยไม่ให้หิวง่าย</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-6 h-6 bg-purple-100 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5">
<i data-feather="moon" class="w-3 h-3 text-purple-600"></i>
</div>
<div>
<p class="font-medium text-sm">นอนหลับให้เพียงพอ</p>
<p class="text-xs text-gray-600">ช่วยควบคุมฮอร์โมนความหิว</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-6 h-6 bg-orange-100 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5">
<i data-feather="activity" class="w-3 h-3 text-orange-600"></i>
</div>
<div>
<p class="font-medium text-sm">ออกกำลังกายเบาๆ</p>
<p class="text-xs text-gray-600">การเดินหรือยิมเบาๆ ช่วยเผาผลาญได้ดี</p>
</div>
</div>
</div>
</div>
<!-- Start/End Fast Button -->
<button onclick="toggleFast()" id="fastToggleBtn" class="w-full bg-red-500 text-white rounded-xl p-4 font-semibold hover:bg-red-600 transition-colors">
<i data-feather="square" class="w-5 h-5 inline mr-2"></i>
หยุดการทำ IF วันนี้
</button>
</div>
<!-- Impacts Tab -->
<div id="impacts" class="tab-content hidden p-4">
<!-- Impact Overview Card -->
<div class="bg-gradient-to-br from-indigo-500 to-purple-600 rounded-xl p-4 text-white mb-4">
<div class="flex items-center mb-3">
<i data-feather="trending-up" class="w-6 h-6 mr-3"></i>
<div>
<h3 class="font-semibold text-lg">Impacts Analysis</h3>
<p class="text-sm opacity-90">การวิเคราะห์ผลกระทบของพฤติกรรมต่อการฟื้นตัว</p>
</div>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="bg-white/20 backdrop-blur rounded-lg p-3">
<p class="text-2xl font-bold">+23%</p>
<p class="text-xs opacity-90">การเพิ่มขึ้นของ Recovery Score</p>
</div>
<div class="bg-white/20 backdrop-blur rounded-lg p-3">
<p class="text-2xl font-bold">8.5</p>
<p class="text-xs opacity-90">คะแนนความสัมพันธ์โดยรวม</p>
</div>
</div>
</div>
<!-- Top Positive Impacts -->
<div class="mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="arrow-up-circle" class="w-4 h-4 mr-2 text-green-600"></i>
พฤติกรรมที่ส่งผลดีต่อการฟื้นตัว
</h3>
<div class="space-y-3">
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-start mb-2">
<div class="flex items-center">
<div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center mr-3">
<i data-feather="moon" class="w-5 h-5 text-green-600"></i>
</div>
<div>
<p class="font-medium text-sm">ไม่ใช้หน้าจอก่อนนอน</p>
<p class="text-xs text-gray-600">พบใน 12 จาก 14 คืนที่ฟื้นตัวดี</p>
</div>
</div>
<div class="text-right">
<span class="text-green-600 font-bold text-lg">+32%</span>
<p class="text-xs text-gray-500">Recovery Score</p>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-2 mt-3">
<div class="flex justify-between text-xs mb-1">
<span>ความสัมพันธ์</span>
<span class="font-semibold">0.89 (สูงมาก)</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: 89%"></div>
</div>
</div>
</div>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-start mb-2">
<div class="flex items-center">
<div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center mr-3">
<i data-feather="droplet" class="w-5 h-5 text-green-600"></i>
</div>
<div>
<p class="font-medium text-sm">อาบน้ำเย็น</p>
<p class="text-xs text-gray-600">ลดการอักเสบและเร่งการฟื้นตัว</p>
</div>
</div>
<div class="text-right">
<span class="text-green-600 font-bold text-lg">+28%</span>
<p class="text-xs text-gray-500">Sleep Quality</p>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-2 mt-3">
<div class="flex justify-between text-xs mb-1">
<span>ความสัมพันธ์</span>
<span class="font-semibold">0.76 (สูง)</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: 76%"></div>
</div>
</div>
</div>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-start mb-2">
<div class="flex items-center">
<div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center mr-3">
<i data-feather="book-open" class="w-5 h-5 text-green-600"></i>
</div>
<div>
<p class="font-medium text-sm">อ่านหนังสือบนเตียง</p>
<p class="text-xs text-gray-600">ช่วยผ่อนคลายก่อนนอน</p>
</div>
</div>
<div class="text-right">
<span class="text-green-600 font-bold text-lg">+21%</span>
<p class="text-xs text-gray-500">HRV</p>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-2 mt-3">
<div class="flex justify-between text-xs mb-1">
<span>ความสัมพันธ์</span>
<span class="font-semibold">0.72 (สูง)</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: 72%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Negative Impacts -->
<div class="mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="arrow-down-circle" class="w-4 h-4 mr-2 text-red-600"></i>
พฤติกรรมที่ส่งผลเสียต่อการฟื้นตัว
</h3>
<div class="space-y-3">
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-start mb-2">
<div class="flex items-center">
<div class="w-10 h-10 bg-red-100 rounded-full flex items-center justify-center mr-3">
<i data-feather="smartphone" class="w-5 h-5 text-red-600"></i>
</div>
<div>
<p class="font-medium text-sm">รับประทานอาหารดึก</p>
<p class="text-xs text-gray-600">หลัง 21:00 น.</p>
</div>
</div>
<div class="text-right">
<span class="text-red-600 font-bold text-lg">-35%</span>
<p class="text-xs text-gray-500">Recovery Score</p>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-2 mt-3">
<div class="flex justify-between text-xs mb-1">
<span>ความสัมพันธ์</span>
<span class="font-semibold">-0.82 (สูงมาก)</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-red-500 h-2 rounded-full" style="width: 82%"></div>
</div>
</div>
</div>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-start mb-2">
<div class="flex items-center">
<div class="w-10 h-10 bg-red-100 rounded-full flex items-center justify-center mr-3">
<i data-feather="coffee" class="w-5 h-5 text-red-600"></i>
</div>
<div>
<p class="font-medium text-sm">คาเฟอีนหลัง 14:00 น.</p>
<p class="text-xs text-gray-600">กระตุ้นระบบประสาท</p>
</div>
</div>
<div class="text-right">
<span class="text-red-600 font-bold text-lg">-28%</span>
<p class="text-xs text-gray-500">Sleep Quality</p>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-2 mt-3">
<div class="flex justify-between text-xs mb-1">
<span>ความสัมพันธ์</span>
<span class="font-semibold">-0.74 (สูง)</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-red-500 h-2 rounded-full" style="width: 74%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Impact Categories -->
<div class="mb-4">
<h3 class="font-semibold mb-3">ผลกระทบตามหมวดหมู่</h3>
<div class="grid grid-cols-2 gap-3">
<div class="bg-white rounded-xl p-3 card-shadow">
<div class="flex items-center mb-2">
<i data-feather="moon" class="w-4 h-4 text-blue-600 mr-2"></i>
<span class="font-medium text-sm">การนอน</span>
</div>
<p class="text-lg font-bold text-blue-600">+18%</p>
<p class="text-xs text-gray-600">จากพฤติกรรมที่ดี</p>
</div>
<div class="bg-white rounded-xl p-3 card-shadow">
<div class="flex items-center mb-2">
<i data-feather="activity" class="w-4 h-4 text-green-600 mr-2"></i>
<span class="font-medium text-sm">การออกกำลังกาย</span>
</div>
<p class="text-lg font-bold text-green-600">+12%</p>
<p class="text-xs text-gray-600">เมื่อทำเวลาเหมาะสม</p>
</div>
<div class="bg-white rounded-xl p-3 card-shadow">
<div class="flex items-center mb-2">
<i data-feather="coffee" class="w-4 h-4 text-orange-600 mr-2"></i>
<span class="font-medium text-sm">โภชนาการ</span>
</div>
<p class="text-lg font-bold text-red-600">-15%</p>
<p class="text-xs text-gray-600">จากพฤติกรรมที่ผิด</p>
</div>
<div class="bg-white rounded-xl p-3 card-shadow">
<div class="flex items-center mb-2">
<i data-feather="brain" class="w-4 h-4 text-purple-600 mr-2"></i>
<span class="font-medium text-sm">จิตใจ</span>
</div>
<p class="text-lg font-bold text-purple-600">+8%</p>
<p class="text-xs text-gray-600">จากการ meditate</p>
</div>
</div>
</div>
<!-- Recommendations Based on Impacts -->
<div class="bg-white rounded-xl p-4 card-shadow mb-4">
<h3 class="font-semibold mb-3 flex items-center">
<i data-feather="lightbulb" class="w-4 h-4 mr-2 text-yellow-500"></i>
คำแนะนำจากการวิเคราะห์ Impacts
</h3>
<div class="space-y-3">
<div class="flex items-start space-x-3 p-3 bg-blue-50 rounded-lg">
<div class="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0">!</div>
<div>
<p class="font-medium text-sm text-blue-900">ระมัดระวังอาหารดึก</p>
<p class="text-xs text-blue-700 mt-1">ข้อมูลแสดงว่าการทานอาหารหลัง 21:00 น. ลดคะแนนการฟื้นตัวถึง 35%</p>
</div>
</div>
<div class="flex items-start space-x-3 p-3 bg-green-50 rounded-lg">
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0">✓</div>
<div>
<p class="font-medium text-sm text-green-900">ทำต่อไปเลย: ไม่ใช้หน้าจอก่อนนอน</p>
<p class="text-xs text-green-700 mt-1">พฤติกรรมนี้เพิ่มคะแนนการฟื้นตัว 32% - ทำได้ดีมาก!</p>
</div>
</div>
<div class="flex items-start space-x-3 p-3 bg-yellow-50 rounded-lg">
<div class="w-8 h-8 bg-yellow-500 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0">→</div>
<div>
<p class="font-medium text-sm text-yellow-900">ลองเพิ่ม: อาบน้ำเย็น</p>
<p class="text-xs text-yellow-700 mt-1">จากข้อมูลผู้ใช้รายอื่น พบว่าช่วยเพิ่มคุณภาพการนอน 28%</p>
</div>
</div>
</div>
</div>
<!-- View Detailed Insights Button -->
<button onclick="showDetailedImpacts()" class="w-full bg-purple-100 text-purple-600 rounded-xl p-4 font-medium text-sm hover:bg-purple-200 transition-colors">
<i data-feather="bar-chart-2" class="w-4 h-4 inline mr-2"></i>
ดูการวิเคราะห์แบบละเอียด
</button>
</div>
<!-- Goals Tab -->
<div id="goals" class="tab-content hidden p-4">
<!-- Active Goals -->
<div class="mb-4">
<h3 class="font-semibold mb-3">เป้าหมายประจำเดือน</h3>
<div class="space-y-3">
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-center mb-2">
<div class="flex items-center">
<i data-feather="target" class="w-5 h-5 text-purple-600 mr-2"></i>
<span class="font-medium">ลดน้ำหนัก 3 กก.</span>
</div>
<span class="text-sm font-bold text-purple-600">60%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2 mb-2">
<div class="bg-gradient-to-r from-purple-500 to-pink-500 h-2 rounded-full" style="width: 60%"></div>
</div>
<p class="text-xs text-gray-600">ลดไปแล้ว 1.8 กก. เหลืออีก 1.2 กก. • 12 วันที่เหลือ</p>
</div>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-center mb-2">
<div class="flex items-center">
<i data-feather="moon" class="w-5 h-5 text-blue-600 mr-2"></i>
<span class="font-medium">นอน 8 ชั่วโมงต่อวัน</span>
</div>
<span class="text-sm font-bold text-blue-600">75%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2 mb-2">
<div class="bg-gradient-to-r from-blue-500 to-cyan-500 h-2 rounded-full" style="width: 75%"></div>
</div>
<p class="text-xs text-gray-600">ทำได้ 22 จาก 30 วัน • 8 วันที่เหลือ</p>
</div>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="flex justify-between items-center mb-2">
<div class="flex items-center">
<i data-feather="trending-up" class="w-5 h-5 text-green-600 mr-2"></i>
<span class="font-medium">วิ่ง 100 กม. ต่อเดือน</span>
</div>
<span class="text-sm font-bold text-green-600">82%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2 mb-2">
<div class="bg-gradient-to-r from-green-500 to-emerald-500 h-2 rounded-full" style="width: 82%"></div>
</div>
<p class="text-xs text-gray-600">วิ่งไปแล้ว 82 กม. • เหลือ 18 กม. • 8 วันที่เหลือ</p>
</div>
</div>
</div>
<!-- Daily Journal -->
<div class="mb-4">
<h3 class="font-semibold mb-3">บันทึกประจำวัน</h3>
<div class="bg-white rounded-xl p-4 card-shadow">
<div class="mb-3">
<label class="text-sm font-medium text-gray-700 mb-2 block">พฤติกรรมวันนี้</label>
<div class="space-y-2 max-h-40 overflow-y-auto">
<!-- Behaviors will be populated here -->
</div>
</div>
<button onclick="showBehaviorSelector()" class="w-full bg-purple-100 text-purple-600 rounded-lg p-3 font-medium text-sm hover:bg-purple-200 transition-colors">
<i data-feather="plus-circle" class="w-4 h-4 inline mr-2"></i>
เพิ่มพฤติกรรม
</button>
</div>
</div>
<!-- Add New Goal -->
<button class="w-full bg-purple-100 text-purple-600 rounded-xl p-4 font-medium text-sm hover:bg-purple-200 transition-colors">
<i data-feather="plus-circle" class="w-4 h-4 inline mr-2"></i>
เพิ่มเป้าหมายใหม่
</button>
</div>
</div>
<!-- Bottom Navigation -->
<div class="fixed bottom-0 left-0 right-0 bg-white border-t max-w-md mx-auto">
<div class="grid grid-cols-5 py-2">
<button class="flex flex-col items-center py-2 text-purple-600">
<i data-feather="home" class="w-5 h-5"></i>
<span class="text-xs mt-1">หน้าแรก</span>
</button>
<button class="flex flex-col items-center py-2 text-gray-500">
<i data-feather="bar-chart-2" class="w-5 h-5"></i>
<span class="text-xs mt-1">กราฟ</span>
</button>
<button class="flex flex-col items-center py-2 text-gray-500">
<div class="w-12 h-12 bg-purple-600 rounded-full flex items-center justify-center -mt-2">
<i data-feather="plus" class="w-6 h-6 text-white"></i>
</div>
</button>
<button class="flex flex-col items-center py-2 text-gray-500">
<i data-feather="award" class="w-5 h-5"></i>
<span class="text-xs mt-1">ความสำเร็จ</span>
</button>
<button class="flex flex-col items-center py-2 text-gray-500">
<i data-feather="settings" class="w-5 h-5"></i>
<span class="text-xs mt-1">ตั้งค่า</span>
</button>
</div>
</div>
</div>
<!-- Behavior Selector Modal -->
<div id="behaviorModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden">
<div class="flex items-center justify-center min-h-screen p-4">
<div class="bg-white rounded-2xl max-w-md w-full max-h-[80vh] overflow-hidden">
<div class="p-4 border-b sticky top-0 bg-white">
<div class="flex justify-between items-center">
<h3 class="font-semibold text-lg">เลือกพฤติกรรม</h3>
<button onclick="closeBehaviorSelector()" class="p-1">
<i data-feather="x" class="w-5 h-5"></i>
</button>
</div>
</div>
<div class="p-4 overflow-y-auto max-h-[60vh]">
<div id="behaviorCategories" class="space-y-4">
<!-- Categories will be populated here -->
</div>
</div>
</div>
</div>
</div>
<script>
// Initialize Feather Icons
feather.replace();
// Tab Switching
function switchTab(tabName) {
// Hide all tab contents
document.querySelectorAll('.tab-content').forEach(tab => {
tab.classList.add('hidden');
});
// Remove active class from all tab buttons
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.classList.remove('tab-active');
btn.classList.add('text-gray-600');
});
// Show selected tab
document.getElementById(tabName).classList.remove('hidden');
// Add active class to selected tab button
const activeBtn = document.querySelector(`[data-tab="${tabName}"]`);
activeBtn.classList.add('tab-active');
activeBtn.classList.remove('text-gray-600');
}
// Mock data updates
function updateMetrics() {
// Simulate real-time heart rate update
const heartRate = 55 + Math.floor(Math.random() * 20);
const heartRateElement = document.querySelector('.health-metric-card p.text-lg');
if (heartRateElement && heartRateElement.textContent.includes('BPM')) {
heartRateElement.textContent = heartRate + ' BPM';
}
// Update calories
const calories = 400 + Math.floor(Math.random() * 50);
const caloriesElements = document.querySelectorAll('.health-metric-card p.text-lg');
caloriesElements.forEach(el => {
if (el.textContent.includes('kcal')) {
el.textContent = calories + ' kcal';
}
});
}
// Show notifications
function showNotifications() {
alert('🔔 มีการแจ้งเตือนใหม่\n\n• ถึงเวลาดื่มน้ำแล้ว\n• คุณออกกำลังกายไปแล้ว 75% ของเป้าหมายวันนี้\n• คุณภาพการนอนเมื่อคืนดีขึ้น 10%');
}
// Show profile
function showProfile() {
alert('👤 โปรไฟล์\n\nชื่อ: สมชาย ใจดี\nอายุ: 28 ปี\nเป้าหมาย: สุขภาพแข็งแรง\nสมาชิกตั้งแต่: มกราคม 2024');
}
// Simulate real-time updates
setInterval(updateMetrics, 5000);
// Add swipe gestures for mobile
let touchStartX = 0;
let touchEndX = 0;
document.addEventListener('touchstart', (e) => {
touchStartX = e.changedTouches[0].screenX;
});
document.addEventListener('touchend', (e) => {
touchEndX = e.changedTouches[0].screenX;
handleSwipe();
});
function handleSwipe() {
const tabs = ['dashboard', 'metrics', 'insights', 'if-training', 'impacts', 'goals'];
const currentTab = document.querySelector('.tab-content:not(.hidden)').id;
const currentIndex = tabs.indexOf(currentTab);
if (touchEndX < touchStartX - 50 && currentIndex < tabs.length - 1) {
// Swipe left - next tab
switchTab(tabs[currentIndex + 1]);
}
if (touchEndX > touchStartX + 50 && currentIndex > 0) {
// Swipe right - previous tab
switchTab(tabs[currentIndex - 1]);
}
}
function showDetailedImpacts() {
alert('📊 การวิเคราะห์ Impacts แบบละเอียด\n\n• วิเคราะห์ข้อมูล 30 วันล่าสุด\n• ความสัมพันธ์ระหว่างพฤติกรรมกับ HRV\n• กราฟแสดงแนวโน้มการฟื้นตัว\n• เปรียบเทียบกับข้อมูลผู้ใช้รายอื่น\n• คำแนะนำส่วนตัวแบบ AI\n\n🔍 Premium Feature - อัปเกรดเพื่อดูข้อมูลเพิ่มเติม');
}
// Add haptic feedback (vibration) on button clicks for mobile
document.querySelectorAll('button').forEach(button => {
button.addEventListener('click', () => {
if ('vibrate' in navigator) {
navigator.vibrate(10);
}
});
});
// Behavior Database
const behaviorDatabase = {
"การนอนและสุขภาพรอบวัน": [
"แว่นกันแสงสีฟ้า",
"เครื่องเสียง",
"อ่านหนังสือบนเตียง",
"นอนร่วมกับผู้อื่น",
"แมวอยู่ในห้องนอน",
"สุนัขอยู่ในห้องนอน",
"หน้ากากปิดตา",
"นอนในห้องมืด",
"แสงแดดตอนเช้า",
"รับประทานอาหารดึก",
"เครื่อง CPAP",
"เทปปิดปาก",
"แผ่นแปะจมูก",
"ผ้าห่มมีน้ำหนัก",
"แสงประดิษฐ์",
"นอนกลางวัน",
"เวลานอนสม่ำเสมอ",
"เวลาตื่นสม่ำเสมอ",
"อุปกรณ์ติดตามการนอน",
"เสียงคลื่นความถี่ขาว",
"เครื่องเพิ่มความชื้น",
"ไม่ใช้หน้าจอก่อนนอน",
"กายกรรมตอนเย็น",
"ชาสมุนไพรก่อนนอน",
"อาบน้ำอุ่นก่อนนอน"
],
"การฟื้นตัว": [
"นวดบำบัด",
"อาบน้ำเย็น",
"การยืดกล้ามเนื้อ",
"ซาวน่า",
"ห้องไอน้ำ",
"ฝังเข็ม",
"ถ้วยฝาครอบ",
"อัดอากาศ",
"การ meditate",
"การฝึกหายใจ",
"อาบน้ำอุ่น",
"อาบน้ำเย็น",
"โฟมรอลลิ่ง",
"อาบน้ำสลับ",
"การฟื้นตัวแบบ active",
"วันพัก",
"CBD ภายนอก",
"อาบน้ำเกลือ Epsom",
"บำบัดแสงแดง",
"ถังลอย",
"การปรับสันหลัง",
"กายภาพบำบัด",
"ซาวน่าอินฟราเรด",
"ครีโอเทอราพี",
"เสื้อผ้าบีบอัด"
],
"โภชนาการ": [
"การลดน้ำหนักแบบ Intermittent Fasting",
"อาหาร Paleo",
"อาหารพืช",
"อาหาร Keto",
"อาหาร Mediterranean",
"คาเฟอีน",
"การดื่มแอลกอฮอล์",
"ไม่ดื่มแอลกอฮอล์",
"การติดตามการบริโภคน้ำ",
"การเตรียมอาหารล่วงหน้า",
"อาหารออร์แกนิก",
"ปราศจากกลูเตน",
"ปราศจากแล็กโทส",
"น้ำตาลต่ำ",
"โปรตีนสูง",
"มื้ออาหารก่อนออกกำลังกาย",
"มื้ออาหารหลังออกกำลังกาย",
"การจัดเวลามื้ออาหาร",
"การติดตามแคลอรี่",
"การติดตามแมโคร",
"การจำกัดพลังงานแบบ Intermittent",
"การรับประทานแบบจำกัดเวลา",
"การจัดเวลาธาตุอาหาร",
"เครื่องดื่มกีฬา",
"อาหารเสริมอิเล็กโทรไลต์"
],
"ยาและอาหารเสริม": [
"อาหารเสริมแมกนีเซียม",
"เมลาโทนิน",
"วิตามินรวม",
"วิตามิน B-12",
"วิตามิน C",
"วิตามิน D",
"สังกะสี",
"โปรไบโอติกส์",
"CBD",
"กัญชา",
"ยาแก้ปวดตามใบสั่งแพทย์",
"ยาต้านการอักเสบ NSAIDs",
"ยาลดน้ำหนัก",
"ยา AD(H)D",
"ครีเอทีน",
"ผงโปรตีน",
"BCAA",
"อาหารเสริมก่อนออกกำลังกาย",
"บีตาอะลานีน",
"อาชวากันดา",
"โรดิโอล่า",
"น้ำมันปลา",
"อาหารเสริมเหล็ก",
"อาหารเสริมแคลเซียม",
"การสนับสนุนข้อต่อ"
],
"ไลฟ์สไตล์และสุขภาพจิต": [
"ความวิตกกังวล",
"ความเครียด",
"ทำงานที่บ้าน",
"เวลาหน้าจอ",
"เดินทางโดยเครื่องบิน",
"เพศสัมพันธ์",
"เลี้ยงดูเด็กทารก",
"กอดเด็ก",
"การบำบัด",
"การเขียนบันทึก",
"เวลาทางสังคม",
"เดินเที่ยวในธรรมชาติ",
"การ detox จากดิจิทัล",
"การฝึกความขอบคุณ",
"การสัมผัสความเย็น",
"การสัมผัสความร้อน",
"การออกกำลังกายการหายใจ",
"การตั้งสติ",
"โยคะ",
"ไท่จี",
"บำบัดการลอยตัว",
"บำบัดศิลปะ",
"บำบัดดนตรี",
"บำบัดสัตว์เลี้ยง",
"บริการชุมชน"
],
"สุขภาพการสืบพันธุ์": [
"ประจำเดือน",
"การตั้งครรภ์",
"หลังคลอด",
"ให้นมบุตร",
"การคุมกำเนิด",
"ฮอร์โมนบำบัด",
"การรักษาภาวะมีบุตรยาก",
"วัยทอง",
"การติดตามการตกไข่",
"อาการ PMS",
"ภาวะถุงน้ำในรังไข่",
"เยื่อบุโพรงมดลูกเจริญผิดที่",
"การเปลี่ยนแปลงฮอร์โมน",
"พยายามมีบุตร"
],
"สิ่งแวดล้อม": [
"เครื่องตรวจสอบคุณภาพอากาศ",
"ตัวกรองน้ำ",
"การป้องกัน EMF",
"อากาศบริสุทธิ์",
"แสงธรรมชาติ",
"พื้นที่สีเขียว",
"ไม้ในร่ม",
"ที่นอนออร์แกนิก",
"การทำความสะอาดปราศจากสารพิษ",
"การบำบัดน้ำ",
"การควบคุมความชื้น",
"การควบคุมอุณหภูมิ",
"การลดเสียงรบกวน",
"การจัดการสิ่งอำนวยความสะดวก"
],
"ประสิทธิภาพ": [
"การฝึกกำลัง",
"การออกกำลังกายแบบคาร์ดิโอ",
"การออกกำลังกาย HIIT",
"การฝึกความอดทน",
"การฝึกความยืดหยุ่น",
"การฝึกกีฬา",
"การแข่งขัน",
"ภาระการฝึก",
"การติดตามประสิทธิภาพ",
"การตั้งเป้าหมาย",
"การสร้างภาพในใจ",
"การฝึกทักษะ",
"การฝึกข้าม",
"ฟิตเนสเชิงฟังก์ชัน"
]
};
// Daily Journal Behaviors
let selectedBehaviors = [];
function showBehaviorSelector() {
const modal = document.getElementById('behaviorModal');
const categoriesContainer = document.getElementById('behaviorCategories');
categoriesContainer.innerHTML = '';
Object.entries(behaviorDatabase).forEach(([category, behaviors]) => {
const categoryDiv = document.createElement('div');
categoryDiv.className = 'bg-gray-50 rounded-lg p-3';
const categoryTitle = document.createElement('h4');
categoryTitle.className = 'font-semibold text-sm mb-2 text-purple-600';
categoryTitle.textContent = category;
categoryDiv.appendChild(categoryTitle);
const behaviorsGrid = document.createElement('div');
behaviorsGrid.className = 'grid grid-cols-2 gap-2';
behaviors.forEach(behavior => {
const behaviorLabel = document.createElement('label');
behaviorLabel.className = 'flex items-center space-x-2 cursor-pointer';
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.className = 'rounded text-purple-600';
checkbox.value = behavior;
checkbox.checked = selectedBehaviors.includes(behavior);
const label = document.createElement('span');
label.className = 'text-xs';
label.textContent = behavior;
behaviorLabel.appendChild(checkbox);
behaviorLabel.appendChild(label);
behaviorsGrid.appendChild(behaviorLabel);
});
categoryDiv.appendChild(behaviorsGrid);
categoriesContainer.appendChild(categoryDiv);
});
modal.classList.remove('hidden');
feather.replace();
}
function closeBehaviorSelector() {
const modal = document.getElementById('behaviorModal');
// Save selected behaviors
const checkboxes = modal.querySelectorAll('input[type="checkbox"]:checked');
selectedBehaviors = Array.from(checkboxes).map(cb => cb.value);
// Update journal display
updateJournalDisplay();
modal.classList.add('hidden');
}
function updateJournalDisplay() {
const journalContainer = document.querySelector('#goals .bg-white .space-y-2');
if (selectedBehaviors.length > 0) {
journalContainer.innerHTML = selectedBehaviors.map(behavior => `
<div class="flex items-center justify-between bg-purple-50 rounded-lg p-2">
<span class="text-sm">${behavior}</span>
<button onclick="removeBehavior('${behavior}')" class="text-red-500">
<i data-feather="x" class="w-4 h-4"></i>
</button>
</div>
`).join('');
} else {
journalContainer.innerHTML = '<p class="text-xs text-gray-500 text-center py-4">ยังไม่ได้เพิ่มพฤติกรรมวันนี้</p>';
}
feather.replace();
}
function removeBehavior(behavior) {
selectedBehaviors = selectedBehaviors.filter(b => b !== behavior);
updateJournalDisplay();
}
// Initialize journal display
updateJournalDisplay();
// IF Training Functions
let currentIFPlan = '16:8';
let fastStartTime = null;
let fastInterval = null;
let isCurrentlyFasting = true;
function selectIFPlan(plan) {
currentIFPlan = plan;
// Update UI to show selected plan
document.querySelectorAll('#if-training .grid button').forEach(btn => {
btn.classList.remove('border-2', 'border-purple-500');
});
event.target.closest('button').classList.add('border-2', 'border-purple-500');
// Show confirmation
showNotification(`เปลี่ยนแผนเป็น ${plan} แล้ว ✅`);
}
function toggleFast() {
const btn = document.getElementById('fastToggleBtn');
if (isCurrentlyFasting) {
// End fast
isCurrentlyFasting = false;
clearInterval(fastInterval);
btn.innerHTML = '<i data-feather="play" class="w-5 h-5 inline mr-2"></i>เริ่มทำ IF ใหม่';
btn.classList.remove('bg-red-500', 'hover:bg-red-600');
btn.classList.add('bg-green-500', 'hover:bg-green-600');
// Update status
document.querySelector('#if-training .bg-white\\/10 .bg-green-400').textContent = 'สิ้นสุดแล้ว';
document.querySelector('#if-training .bg-white\\/10 .bg-green-400').classList.remove('bg-green-400', 'text-green-900');
document.querySelector('#if-training .bg-white\\/10 .bg-green-400').classList.add('bg-gray-400', 'text-gray-900');
showNotification('สิ้นสุดการทำ IF วันนี้แล้ว! 🎉');
} else {
// Start fast
isCurrentlyFasting = true;
startFastTimer();
btn.innerHTML = '<i data-feather="square" class="w-5 h-5 inline mr-2"></i>หยุดการทำ IF วันนี้';
btn.classList.remove('bg-green-500', 'hover:bg-green-600');
btn.classList.add('bg-red-500', 'hover:bg-red-600');
showNotification('เริ่มทำ IF แล้ว! 💪');
}
feather.replace();
}
function startFastTimer() {
fastStartTime = new Date();
fastInterval = setInterval(() => {
if (!isCurrentlyFasting) return;
const now = new Date();
const elapsed = now - fastStartTime;
// Calculate target time (16 hours from start for 16:8)
const targetHours = 16;
const targetMs = targetHours * 60 * 60 * 1000;
const hours = Math.floor(elapsed / (1000 * 60 * 60));
const minutes = Math.floor((elapsed % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((elapsed % (1000 * 60)) / 1000);
const timeString = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
// Update timer display
const timerElement = document.querySelector('#if-training .text-3xl');
if (timerElement) {
timerElement.textContent = timeString;
}
// Update progress bar
const progress = Math.min((elapsed / targetMs) * 100, 100);
const progressBar = document.querySelector('#if-training .bg-white\\/10 .bg-white');
if (progressBar) {
progressBar.style.width = `${progress}%`;
}
// Update status
const statusElement = document.querySelector('#if-training .bg-white\\/10 span');
if (statusElement && progress < 100) {
statusElement.textContent = 'กำลังทำอยู่';
statusElement.classList.remove('bg-gray-400', 'text-gray-900', 'bg-green-400', 'text-green-900');
statusElement.classList.add('bg-green-400', 'text-green-900');
} else if (statusElement && progress >= 100) {
statusElement.textContent = 'เกินเป้าแล้ว!';
statusElement.classList.remove('bg-green-400', 'text-green-900');
statusElement.classList.add('bg-yellow-400', 'text-yellow-900');
// Show completion notification
if (!window.completionShown) {
showNotification('🎊 ทำ IF ครบ 16 ชั่วโมงแล้ว! สามารถเริ่มทานอาหารได้');
window.completionShown = true;
}
}
}, 1000);
}
function showNotification(message) {
// Create a simple toast notification
const toast = document.createElement('div');
toast.className = 'fixed top-4 right-4 bg-purple-600 text-white px-4 py-3 rounded-lg shadow-lg z-50 max-w-xs';
toast.innerHTML = `
<div class="flex items-center">
<i data-feather="check-circle" class="w-5 h-5 mr-2"></i>
<span class="text-sm">${message}</span>
</div>
`;
document.body.appendChild(toast);
feather.replace();
// Auto remove after 3 seconds
setTimeout(() => {
toast.style.transition = 'opacity 0.3s';
toast.style.opacity = '0';
setTimeout(() => toast.remove(), 300);
}, 3000);
}
// Initialize IF timer on page load
document.addEventListener('DOMContentLoaded', () => {
if (isCurrentlyFasting) {
// Simulate that fast started at 20:00
const now = new Date();
fastStartTime = new Date();
fastStartTime.setHours(20, 0, 0, 0);
// If it's after 20:00, start the timer
if (now.getHours() >= 20 || now.getHours() < 12) {
startFastTimer();
}
}
});
</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html> |