File size: 73,393 Bytes
8e4d763 431e60c 98bf0ca 9ccb560 4c2e4f6 a5b3bd3 98bf0ca d984c18 a5b3bd3 c3eacbf 11433ac a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 98bf0ca a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca 11433ac a5b3bd3 11433ac a5b3bd3 d984c18 a5b3bd3 d984c18 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 431e60c 11433ac a5b3bd3 11433ac 98bf0ca a5b3bd3 98bf0ca a5b3bd3 9e44621 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 a5b3bd3 8e4d763 a5b3bd3 9e44621 a5b3bd3 98bf0ca 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 a5b3bd3 9e44621 8e4d763 a5b3bd3 8e4d763 a5b3bd3 8e4d763 d984c18 8e4d763 11433ac 8e4d763 11433ac 98bf0ca a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 11433ac a5b3bd3 98bf0ca 11433ac d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 11433ac a5b3bd3 d984c18 a5b3bd3 11433ac d984c18 a5b3bd3 431e60c a5b3bd3 98bf0ca d984c18 98bf0ca a5b3bd3 d984c18 98bf0ca a5b3bd3 d984c18 98bf0ca a5b3bd3 98bf0ca a5b3bd3 d984c18 98bf0ca a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 431e60c a5b3bd3 98bf0ca a5b3bd3 98bf0ca d984c18 98bf0ca a5b3bd3 d984c18 a5b3bd3 98bf0ca a5b3bd3 98bf0ca d984c18 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 98bf0ca a5b3bd3 d984c18 98bf0ca a5b3bd3 d984c18 a5b3bd3 9e44621 a5b3bd3 d984c18 a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 98bf0ca a5b3bd3 d984c18 98bf0ca 9e44621 d984c18 a5b3bd3 4c2e4f6 a5b3bd3 4c2e4f6 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 9e44621 4c2e4f6 9e44621 4c2e4f6 d984c18 9e44621 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 609753a 98bf0ca d984c18 9e44621 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 2f7acc2 609753a 2f7acc2 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 609753a d984c18 a5b3bd3 d984c18 a5b3bd3 98bf0ca a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 609753a a5b3bd3 d984c18 a5b3bd3 d984c18 a5b3bd3 609753a a5b3bd3 d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca d984c18 a5b3bd3 98bf0ca a5b3bd3 2e203a3 a5b3bd3 431e60c a5b3bd3 431e60c a5b3bd3 98bf0ca a5b3bd3 8e4d763 |
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 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 |
# VisaTier 4.0 - Premium Immigration ROI Calculator (COMPLETE FIXED)
# Enhanced with advanced analytics, monetization, and enterprise features
import math
import numpy as np
import pandas as pd
import gradio as gr
import plotly.graph_objects as go
from typing import Dict, List, Tuple, Optional
import plotly.express as px
from plotly.subplots import make_subplots
import json
from datetime import datetime, timedelta
import hashlib
import secrets
import asyncio
from dataclasses import dataclass
# =========================
# ENHANCED STYLING SYSTEM - FIXED
# =========================
PREMIUM_CSS = """
/* Modern Design System */
:root {
--primary: #2563eb;
--primary-dark: #1d4ed8;
--secondary: #0f172a;
--accent: #f59e0b;
--success: #10b981;
--warning: #f59e0b;
--error: #ef4444;
--surface: #ffffff;
--surface-alt: #f8fafc;
--text: #1e293b;
--text-muted: #64748b;
--border: #e2e8f0;
--radius: 12px;
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
--gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
/* Global Styles */
.gradio-container {
max-width: 1400px !important;
margin: 0 auto !important;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}
/* Header Component */
.premium-header {
background: var(--gradient);
color: white;
padding: 2rem;
border-radius: var(--radius);
margin-bottom: 2rem;
position: relative;
overflow: hidden;
}
.premium-header::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
animation: float 6s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0px) rotate(0deg); }
50% { transform: translateY(-20px) rotate(180deg); }
}
.header-content {
position: relative;
z-index: 2;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.header-title {
font-size: 2rem;
font-weight: 800;
margin-bottom: 0.5rem;
}
.header-subtitle {
opacity: 0.9;
font-size: 1.1rem;
}
.header-stats {
text-align: right;
font-size: 0.9rem;
opacity: 0.8;
}
/* Profile Selection Cards */
.profile-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin: 1.5rem 0;
}
.profile-card {
background: var(--surface);
border: 2px solid var(--border);
border-radius: var(--radius);
padding: 1.5rem;
text-align: center;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
overflow: hidden;
}
.profile-card::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
transition: left 0.5s;
}
.profile-card:hover::before {
left: 100%;
}
.profile-card:hover {
border-color: var(--primary);
transform: translateY(-2px);
box-shadow: var(--shadow);
}
.profile-card.selected {
border-color: var(--primary);
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: white;
}
.profile-icon {
font-size: 2.5rem;
margin-bottom: 1rem;
display: block;
}
.profile-name {
font-weight: 600;
font-size: 1.1rem;
margin-bottom: 0.5rem;
}
.profile-revenue {
font-size: 0.9rem;
opacity: 0.8;
}
/* KPI Cards */
.kpi-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
margin: 2rem 0;
}
.kpi-card {
background: var(--surface);
border-radius: var(--radius);
padding: 1.5rem;
text-align: center;
box-shadow: var(--shadow);
position: relative;
overflow: hidden;
}
.kpi-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background: var(--gradient);
}
.kpi-label {
font-size: 0.9rem;
color: var(--text-muted);
margin-bottom: 0.5rem;
font-weight: 500;
}
.kpi-value {
font-size: 2rem;
font-weight: 800;
color: var(--primary);
margin-bottom: 0.5rem;
}
.kpi-note {
font-size: 0.8rem;
color: var(--text-muted);
line-height: 1.4;
}
.kpi-card.success .kpi-value { color: var(--success); }
.kpi-card.warning .kpi-value { color: var(--warning); }
.kpi-card.error .kpi-value { color: var(--error); }
/* Insight Cards */
.insights-grid {
display: grid;
gap: 1rem;
margin: 1.5rem 0;
}
.insight-card {
background: var(--surface);
border-left: 4px solid var(--primary);
border-radius: var(--radius);
padding: 1.5rem;
box-shadow: var(--shadow);
transition: transform 0.2s ease;
}
.insight-card:hover {
transform: translateX(4px);
}
.insight-header {
display: flex;
align-items: center;
margin-bottom: 1rem;
}
.insight-icon {
font-size: 1.5rem;
margin-right: 0.75rem;
}
.insight-title {
font-weight: 600;
font-size: 1.1rem;
margin: 0;
}
.insight-description {
color: var(--text-muted);
line-height: 1.5;
margin-bottom: 1rem;
}
/* CTA Buttons */
.cta-button {
background: var(--gradient) !important;
border: none !important;
border-radius: var(--radius) !important;
padding: 0.75rem 2rem !important;
font-weight: 600 !important;
font-size: 1rem !important;
color: white !important;
cursor: pointer !important;
transition: all 0.3s ease !important;
text-decoration: none !important;
display: inline-block !important;
}
.cta-button:hover {
transform: translateY(-2px) !important;
box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3) !important;
}
.cta-button:active {
transform: translateY(0) !important;
}
/* Progress Bar */
.progress-container {
background: var(--border);
border-radius: 50px;
height: 8px;
margin: 1rem 0;
overflow: hidden;
}
.progress-bar {
height: 100%;
background: var(--gradient);
border-radius: 50px;
transition: width 0.5s ease;
}
/* Testimonial */
.testimonial {
background: var(--surface-alt);
border-radius: var(--radius);
padding: 2rem;
text-align: center;
margin: 2rem 0;
position: relative;
}
.testimonial::before {
content: '"';
font-size: 4rem;
color: var(--primary);
position: absolute;
top: -1rem;
left: 1rem;
font-family: serif;
}
.testimonial-text {
font-style: italic;
font-size: 1.1rem;
line-height: 1.6;
margin-bottom: 1rem;
color: var(--text);
}
.testimonial-author {
font-weight: 600;
color: var(--primary);
}
/* Lead Capture Modal */
.lead-modal {
background: var(--surface);
border-radius: var(--radius);
padding: 2rem;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
margin: 2rem 0;
border: 1px solid var(--border);
}
.lead-modal h3 {
color: var(--primary);
margin-bottom: 1rem;
}
.value-badge {
background: var(--success);
color: white;
padding: 0.5rem 1rem;
border-radius: 20px;
display: inline-block;
font-weight: 600;
margin-bottom: 1rem;
}
.urgency-text {
background: var(--warning);
color: white;
padding: 0.5rem 1rem;
border-radius: var(--radius);
font-size: 0.9rem;
margin-bottom: 1rem;
text-align: center;
}
/* Form Elements */
.form-input {
width: 100%;
padding: 0.75rem;
border: 2px solid var(--border);
border-radius: var(--radius);
font-size: 1rem;
transition: border-color 0.2s ease;
margin-bottom: 1rem;
}
.form-input:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
/* Responsive Design */
@media (max-width: 768px) {
.header-content {
flex-direction: column;
text-align: center;
}
.profile-grid {
grid-template-columns: 1fr;
}
.kpi-grid {
grid-template-columns: 1fr;
}
.header-title {
font-size: 1.5rem;
}
}
/* Animation Classes */
.fadeIn {
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.slideUp {
animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
from { transform: translateY(100%); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
/* Country Comparison Table */
.comparison-table {
background: var(--surface);
border-radius: var(--radius);
overflow: hidden;
box-shadow: var(--shadow);
margin: 1rem 0;
}
/* Footer */
.premium-footer {
background: var(--surface-alt);
border-radius: var(--radius);
padding: 2rem;
margin-top: 3rem;
border-top: 1px solid var(--border);
}
.footer-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.footer-section h4 {
color: var(--primary);
margin-bottom: 1rem;
font-weight: 600;
}
.footer-section p {
color: var(--text-muted);
line-height: 1.5;
font-size: 0.9rem;
}
/* Notifications */
.notification-toast {
position: fixed;
top: 20px;
right: 20px;
background: var(--surface);
border-left: 4px solid var(--success);
padding: 1rem;
border-radius: var(--radius);
box-shadow: var(--shadow);
z-index: 1000;
animation: slideIn 0.3s ease;
}
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
"""
# Enhanced theme for Gradio
PREMIUM_THEME = gr.themes.Soft(
primary_hue="blue",
secondary_hue="slate",
neutral_hue="slate"
).set(
body_background_fill="#f8fafc",
body_text_color="#1e293b",
button_primary_background_fill="#2563eb",
button_primary_background_fill_hover="#1d4ed8",
input_background_fill="#ffffff",
input_border_width="2px",
block_background_fill="#ffffff"
)
# =========================
# ENHANCED DATA MODELS - FIXED
# =========================
@dataclass
class UserProfile:
id: str
name: str
icon: str
typical_revenue: float
risk_tolerance: int
key_concerns: List[str]
success_multiplier: float
margin_expectations: Tuple[float, float]
@dataclass
class CountryData:
name: str
corp_tax: float
pers_tax: float
living_cost: float
business_cost: float
setup_cost: float
currency: str
market_growth: float
ease_score: float
banking_score: float
partnership_score: float
visa_options: List[str]
market_insights: Dict[str, str]
risk_factors: Dict[str, float]
seasonality: List[float]
# Enhanced user profiles with FIXED emojis
ENHANCED_PROFILES = {
"tech_startup": UserProfile(
id="tech_startup",
name="Tech Startup Founder",
icon="🚀",
typical_revenue=45000,
risk_tolerance=80,
key_concerns=["talent_access", "ip_protection", "scaling"],
success_multiplier=1.4,
margin_expectations=(15, 35)
),
"crypto_defi": UserProfile(
id="crypto_defi",
name="Crypto/DeFi Entrepreneur",
icon="₿",
typical_revenue=85000,
risk_tolerance=90,
key_concerns=["regulatory_clarity", "banking", "tax_optimization"],
success_multiplier=1.8,
margin_expectations=(25, 60)
),
"consulting": UserProfile(
id="consulting",
name="Strategic Consultant",
icon="💼",
typical_revenue=35000,
risk_tolerance=50,
key_concerns=["client_proximity", "reputation", "networking"],
success_multiplier=1.1,
margin_expectations=(40, 70)
),
"ecommerce": UserProfile(
id="ecommerce",
name="E-commerce Owner",
icon="🛒",
typical_revenue=55000,
risk_tolerance=65,
key_concerns=["logistics", "market_access", "compliance"],
success_multiplier=1.3,
margin_expectations=(10, 25)
),
"real_estate": UserProfile(
id="real_estate",
name="Real Estate Investor",
icon="🏠",
typical_revenue=28000,
risk_tolerance=40,
key_concerns=["property_laws", "financing", "market_stability"],
success_multiplier=0.9,
margin_expectations=(8, 18)
),
"content_creator": UserProfile(
id="content_creator",
name="Content Creator/Influencer",
icon="📱",
typical_revenue=25000,
risk_tolerance=70,
key_concerns=["internet_infrastructure", "tax_treaties", "lifestyle"],
success_multiplier=1.2,
margin_expectations=(60, 85)
)
}
# Comprehensive country database with enhanced metrics - UPDATED FOR 2025
ENHANCED_COUNTRIES = {
"UAE": CountryData(
name="UAE (Dubai)",
corp_tax=0.09, # 9% above €95k threshold, 0% below
pers_tax=0.00, # Still 0% personal tax
living_cost=7500, # Updated for 2025 inflation
business_cost=2200, # Increased costs
setup_cost=55000, # More realistic with all costs
currency="AED",
market_growth=7.8, # Slightly reduced from oil volatility
ease_score=9.2,
banking_score=8.9,
partnership_score=95,
visa_options=["Golden Visa", "Investor Visa", "Freelancer Visa", "Green Visa"],
market_insights={
"tech_startup": "Leading fintech hub with 0% personal tax, but new 9% corporate tax above €95k",
"crypto_defi": "Clear crypto regulations with VARA oversight, strong DeFi ecosystem",
"consulting": "Premium consulting market, gateway to MENA and South Asia",
"ecommerce": "Strategic logistics hub, growing e-commerce infrastructure",
"real_estate": "Booming property market with strong rental yields, Golden visa options",
"content_creator": "Growing creator economy, no personal income tax advantage"
},
risk_factors={"political": 0.1, "economic": 0.18, "regulatory": 0.15}, # Higher regulatory risk
seasonality=[1.1, 1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.6, 0.8, 1.0, 1.2, 1.3]
),
"Singapore": CountryData(
name="Singapore",
corp_tax=0.17, # Flat 17%, but with exemptions
pers_tax=0.22, # Progressive, this is top rate
living_cost=7800, # Higher living costs
business_cost=2100,
setup_cost=42000, # More realistic setup costs
currency="SGD",
market_growth=6.5, # Stable growth
ease_score=9.7, # Still world's best
banking_score=9.8,
partnership_score=94,
visa_options=["Tech Pass", "Entrepreneur Pass", "Employment Pass", "One Pass"],
market_insights={
"tech_startup": "Asia's Silicon Valley with excellent government support and tax exemptions",
"crypto_defi": "Progressive crypto regulations, established fintech sector",
"consulting": "Premium Asian market with highest consulting rates",
"ecommerce": "Gateway to 650M ASEAN consumers, excellent logistics",
"real_estate": "Stable property market with strong fundamentals",
"content_creator": "Asian content hub with English proficiency advantage"
},
risk_factors={"political": 0.02, "economic": 0.08, "regulatory": 0.03},
seasonality=[0.9, 0.85, 0.9, 1.0, 1.05, 1.1, 1.2, 1.15, 1.05, 1.0, 0.95, 1.0]
),
"Estonia": CountryData(
name="Estonia",
corp_tax=0.20, # 20% on distributed profits only
pers_tax=0.20,
living_cost=3200, # Post-inflation adjustment
business_cost=750,
setup_cost=12000, # Higher due to compliance costs
currency="EUR",
market_growth=5.2,
ease_score=9.1,
banking_score=8.4,
partnership_score=88,
visa_options=["e-Residency", "Startup Visa", "Digital Nomad", "EU Passport"],
market_insights={
"tech_startup": "Digital-first society with deferred corporate tax model",
"crypto_defi": "Crypto licensing available, progressive digital framework",
"consulting": "EU market access at lower costs than Western Europe",
"ecommerce": "Strong digital infrastructure, EU single market access",
"real_estate": "Emerging market with EU citizenship pathway",
"content_creator": "Digital nomad friendly with excellent connectivity"
},
risk_factors={"political": 0.08, "economic": 0.15, "regulatory": 0.06},
seasonality=[0.8, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.3, 1.1, 1.0, 0.9, 0.8]
),
"Portugal": CountryData(
name="Portugal",
corp_tax=0.21, # Standard rate
pers_tax=0.48, # High personal tax rate
living_cost=2800, # Increased living costs
business_cost=650,
setup_cost=18000, # Higher setup costs
currency="EUR",
market_growth=4.2, # Slower growth
ease_score=7.6,
banking_score=7.8,
partnership_score=80,
visa_options=["D7 Visa", "Golden Visa", "Tech Visa", "HQA Tax Regime"],
market_insights={
"tech_startup": "Growing tech scene with NHR regime being phased out",
"crypto_defi": "Developing crypto framework, tax optimization opportunities reducing",
"consulting": "EU access with lower costs, but increasing tax burden",
"ecommerce": "Growing market with EU access advantages",
"real_estate": "Modified Golden visa program, property market pressures",
"content_creator": "Popular nomad destination but losing tax advantages"
},
risk_factors={"political": 0.05, "economic": 0.22, "regulatory": 0.12},
seasonality=[0.8, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.5, 1.2, 1.0, 0.9, 0.9]
),
"USA": CountryData(
name="USA (Delaware)",
corp_tax=0.21, # Federal rate
pers_tax=0.37, # Federal + state combined
living_cost=9500, # Higher due to inflation
business_cost=2800,
setup_cost=75000, # Realistic including legal costs
currency="USD",
market_growth=5.8,
ease_score=8.2,
banking_score=9.4,
partnership_score=82,
visa_options=["EB-5", "L-1", "E-2", "O-1", "EB-1A"],
market_insights={
"tech_startup": "Largest VC ecosystem globally, complex tax structure",
"crypto_defi": "Evolving regulations, large market opportunity",
"consulting": "Premium rates globally, extensive market access",
"ecommerce": "Largest consumer market, advanced infrastructure",
"real_estate": "Diverse markets with appreciation potential",
"content_creator": "Global content monetization hub"
},
risk_factors={"political": 0.18, "economic": 0.12, "regulatory": 0.15},
seasonality=[1.0, 0.95, 1.05, 1.15, 1.1, 1.05, 0.95, 0.9, 1.1, 1.2, 1.25, 1.4]
),
"UK": CountryData(
name="United Kingdom",
corp_tax=0.25, # Increased to 25% in 2023
pers_tax=0.45, # Top rate
living_cost=6200, # Post-Brexit inflation
business_cost=1600,
setup_cost=28000, # Higher compliance costs
currency="GBP",
market_growth=2.8, # Lower growth post-Brexit
ease_score=7.9,
banking_score=8.9,
partnership_score=75, # Reduced due to Brexit impact
visa_options=["Innovator Founder", "Scale-up", "Global Talent", "High Potential Individual"],
market_insights={
"tech_startup": "Strong fintech sector but higher taxes, R&D incentives available",
"crypto_defi": "Developing framework, traditional finance integration",
"consulting": "Premium market access but higher tax burden",
"ecommerce": "Mature market with Brexit trade complexities",
"real_estate": "Market adjustment period, some opportunities",
"content_creator": "English-speaking advantage but tax burden increased"
},
risk_factors={"political": 0.15, "economic": 0.18, "regulatory": 0.10},
seasonality=[0.9, 0.85, 0.9, 1.0, 1.1, 1.2, 1.3, 1.25, 1.1, 1.05, 1.0, 1.2]
)
}
# =========================
# CORRECTED CALCULATION ENGINE - COMPLETE
# =========================
class ROICalculator:
def __init__(self):
self.monte_carlo_iterations = 500 # Reduced for performance
self.confidence_intervals = [0.1, 0.25, 0.5, 0.75, 0.9]
def calculate_corporate_tax_uae(self, annual_profit_eur: float) -> float:
"""Calculate UAE corporate tax with correct progressive structure"""
threshold_eur = 95000 # €95,000 equivalent to AED 375,000
if annual_profit_eur <= threshold_eur:
return 0
else:
return (annual_profit_eur - threshold_eur) * 0.09
def calculate_enhanced_roi(
self,
profile: UserProfile,
country: CountryData,
current_revenue: float,
current_margin: float,
current_corp_tax: float,
current_pers_tax: float,
current_living: float,
current_business: float,
revenue_multiplier: float,
margin_improvement: float,
success_probability: float,
time_horizon: int,
discount_rate: float
) -> Dict:
"""Enhanced ROI calculation with CORRECTED tax formulas"""
try:
# Input validation and sanitization
current_revenue = max(1000, float(current_revenue or 45000))
current_margin = max(1, min(80, float(current_margin or 25)))
current_corp_tax = max(0, min(50, float(current_corp_tax or 25)))
current_pers_tax = max(0, min(50, float(current_pers_tax or 15)))
current_living = max(500, float(current_living or 4500))
current_business = max(100, float(current_business or 800))
revenue_multiplier = max(0.5, min(10, float(revenue_multiplier or 2.5)))
margin_improvement = max(-20, min(50, float(margin_improvement or 8)))
success_probability = max(10, min(100, float(success_probability or 75)))
time_horizon = max(12, min(120, int(time_horizon or 60)))
discount_rate = max(1, min(50, float(discount_rate or 12)))
# CURRENT SITUATION (MONTHLY BASIS)
current_profit = current_revenue * (current_margin / 100)
# CORRECTED current tax calculation
current_corp_tax_amount = current_profit * (current_corp_tax / 100)
current_after_corp_tax = current_profit - current_corp_tax_amount
current_pers_tax_amount = current_after_corp_tax * (current_pers_tax / 100)
current_after_tax = current_after_corp_tax - current_pers_tax_amount
current_net = current_after_tax - current_living - current_business
# NEW SITUATION WITH GROWTH
new_revenue = current_revenue * revenue_multiplier * profile.success_multiplier
new_margin = min(90, current_margin + margin_improvement)
new_profit = new_revenue * (new_margin / 100)
# CORRECTED new tax calculation with UAE special handling
if country.name == "UAE (Dubai)":
# Convert monthly to annual for UAE tax calculation
annual_profit = new_profit * 12
new_corp_tax_amount_annual = self.calculate_corporate_tax_uae(annual_profit)
new_corp_tax_amount = new_corp_tax_amount_annual / 12 # Back to monthly
else:
# CORRECTED formula - removed the *100 error
new_corp_tax_amount = new_profit * country.corp_tax
new_after_corp_tax = new_profit - new_corp_tax_amount
new_pers_tax_amount = new_after_corp_tax * country.pers_tax
new_after_tax = new_after_corp_tax - new_pers_tax_amount
new_net = new_after_tax - country.living_cost - country.business_cost
# CASH FLOW ANALYSIS
monthly_delta = (new_net - current_net) * (success_probability / 100)
setup_cost = country.setup_cost
# Calculate annual tax savings for reporting
annual_tax_savings = ((current_corp_tax_amount + current_pers_tax_amount) -
(new_corp_tax_amount + new_pers_tax_amount)) * 12
# Apply seasonality and create cash flow projection
monthly_flows = []
cumulative = -setup_cost
payback_month = None
for month in range(1, time_horizon + 1):
seasonal_factor = country.seasonality[(month - 1) % 12]
monthly_cf = monthly_delta * seasonal_factor
monthly_flows.append(monthly_cf)
cumulative += monthly_cf
if payback_month is None and cumulative >= 0:
payback_month = month
# NPV calculation
discount_monthly = (1 + discount_rate/100) ** (1/12) - 1
npv = -setup_cost + sum(cf / (1 + discount_monthly) ** month
for month, cf in enumerate(monthly_flows, 1))
# IRR calculation
def npv_at_rate(rate):
if rate <= -0.99:
return float('inf')
monthly_rate = (1 + rate) ** (1/12) - 1
return -setup_cost + sum(cf / (1 + monthly_rate) ** month
for month, cf in enumerate(monthly_flows, 1))
irr_annual = self._find_irr(npv_at_rate)
# ROI and other metrics
total_return = sum(monthly_flows)
roi = (total_return / setup_cost) * 100 if setup_cost > 0 else 0
payback_years = (payback_month / 12) if payback_month else float('inf')
# Monte Carlo simulation
monte_carlo_result = self._run_monte_carlo_simulation(
profile, country, current_revenue, current_margin,
revenue_multiplier, margin_improvement, time_horizon, discount_rate
)
# Sensitivity analysis
sensitivity_result = self._perform_sensitivity_analysis(
profile, country, current_revenue, current_margin,
revenue_multiplier, margin_improvement, time_horizon, discount_rate
)
# Risk assessment
risk_score = self._calculate_risk_score(country, profile)
opportunity_score = self._calculate_opportunity_score({
'roi': roi, 'npv': npv, 'irr_annual': irr_annual
}, country, profile)
return {
"npv": npv,
"roi": roi,
"irr_annual": irr_annual * 100 if irr_annual else 0,
"payback_months": payback_month or float('inf'),
"payback_years": payback_years,
"monthly_delta": monthly_delta,
"total_return": total_return,
"monthly_flows": monthly_flows,
"setup_cost": setup_cost,
"annual_tax_savings": annual_tax_savings,
"monte_carlo": monte_carlo_result,
"sensitivity": sensitivity_result,
"risk_score": risk_score,
"opportunity_score": opportunity_score,
"tax_breakdown": {
"current_corp_tax": current_corp_tax_amount * 12,
"new_corp_tax": new_corp_tax_amount * 12,
"current_personal_tax": current_pers_tax_amount * 12,
"new_personal_tax": new_pers_tax_amount * 12,
"total_tax_savings": annual_tax_savings
}
}
except Exception as e:
print(f"ROI Calculation Error: {e}")
return {
"npv": 0, "roi": 0, "irr_annual": 0,
"payback_months": float('inf'), "payback_years": float('inf'),
"monthly_delta": 0, "total_return": 0,
"monthly_flows": [0] * time_horizon, "setup_cost": country.setup_cost,
"annual_tax_savings": 0, "risk_score": 50, "opportunity_score": 50,
"tax_breakdown": {"error": str(e)}
}
def _run_monte_carlo_simulation(self, profile, country, *args) -> Dict:
"""Monte Carlo simulation for risk assessment"""
try:
results = []
for _ in range(self.monte_carlo_iterations):
# Add randomness to key variables
revenue_variance = max(0.3, np.random.normal(1.0, 0.15))
margin_variance = max(0.5, np.random.normal(1.0, 0.10))
success_variance = max(0.1, np.random.normal(1.0, 0.20))
# Modify inputs with variance
modified_args = list(args)
modified_args[0] *= revenue_variance # revenue
modified_args[1] *= margin_variance # margin
# Run simplified calculation
try:
result = self.calculate_enhanced_roi(profile, country, *modified_args)
if result and 'roi' in result and result['roi'] is not None:
results.append(result)
except:
continue
if not results:
return {"mean_roi": 0, "std_roi": 0, "probability_positive_roi": 0}
rois = [r['roi'] for r in results if 'roi' in r and r['roi'] is not None]
npvs = [r['npv'] for r in results if 'npv' in r and r['npv'] is not None]
if not rois:
return {"mean_roi": 0, "std_roi": 0, "probability_positive_roi": 0}
confidence_intervals = {}
for ci in self.confidence_intervals:
confidence_intervals[f'roi_{int(ci*100)}'] = np.percentile(rois, ci * 100)
if npvs:
confidence_intervals[f'npv_{int(ci*100)}'] = np.percentile(npvs, ci * 100)
return {
"mean_roi": np.mean(rois),
"std_roi": np.std(rois),
"mean_npv": np.mean(npvs) if npvs else 0,
"std_npv": np.std(npvs) if npvs else 0,
"confidence_intervals": confidence_intervals,
"probability_positive_roi": sum(1 for roi in rois if roi > 0) / len(rois)
}
except Exception as e:
print(f"Monte Carlo error: {e}")
return {"mean_roi": 0, "std_roi": 0, "probability_positive_roi": 0}
def _perform_sensitivity_analysis(self, profile, country, *args) -> Dict:
"""Simplified sensitivity analysis"""
try:
base_args = list(args)
base_result = self.calculate_enhanced_roi(profile, country, *base_args)
base_roi = base_result.get('roi', 0)
sensitivities = {}
# Test revenue sensitivity (10% increase)
test_args = base_args.copy()
test_args[0] *= 1.1
test_result = self.calculate_enhanced_roi(profile, country, *test_args)
sensitivities['revenue'] = (test_result.get('roi', 0) - base_roi) / 10
# Test margin sensitivity (5pp increase)
test_args = base_args.copy()
test_args[1] += 5
test_result = self.calculate_enhanced_roi(profile, country, *test_args)
sensitivities['margin'] = (test_result.get('roi', 0) - base_roi) / 5
# Test revenue multiplier sensitivity
test_args = base_args.copy()
test_args[6] *= 1.2 # revenue_multiplier
test_result = self.calculate_enhanced_roi(profile, country, *test_args)
sensitivities['revenue_multiplier'] = (test_result.get('roi', 0) - base_roi) / 20
# Test success probability sensitivity
test_args = base_args.copy()
test_args[8] += 10 # success_probability
test_result = self.calculate_enhanced_roi(profile, country, *test_args)
sensitivities['success_probability'] = (test_result.get('roi', 0) - base_roi) / 10
return sensitivities
except:
return {"revenue": 0, "margin": 0, "revenue_multiplier": 0, "success_probability": 0}
def _find_irr(self, npv_function, precision=1e-6, max_iterations=50):
"""Find IRR using binary search"""
try:
low, high = -0.99, 5.0
for _ in range(max_iterations):
mid = (low + high) / 2
npv = npv_function(mid)
if abs(npv) < precision:
return mid
elif npv > 0:
low = mid
else:
high = mid
return None
except:
return None
def _calculate_risk_score(self, country: CountryData, profile: UserProfile) -> float:
"""Calculate overall risk score"""
try:
political_risk = country.risk_factors.get('political', 0.1) * 30
economic_risk = country.risk_factors.get('economic', 0.1) * 40
regulatory_risk = country.risk_factors.get('regulatory', 0.1) * 30
risk_adjustment = (100 - profile.risk_tolerance) / 100
total_risk = (political_risk + economic_risk + regulatory_risk) * (1 + risk_adjustment)
return min(100, total_risk)
except:
return 50
def _calculate_opportunity_score(self, result: Dict, country: CountryData, profile: UserProfile) -> float:
"""Calculate opportunity score"""
try:
roi_score = min(50, result.get('roi', 0) / 4)
growth_score = country.market_growth * 5
ease_score = country.ease_score * 2
partnership_score = country.partnership_score / 2
return min(100, roi_score + growth_score + ease_score + partnership_score)
except:
return 50
# =========================
# ENHANCED VISUALIZATION ENGINE
# =========================
class ChartGenerator:
@staticmethod
def create_roi_dashboard(result: Dict, country_name: str, profile_name: str) -> go.Figure:
"""Create comprehensive ROI dashboard"""
try:
fig = make_subplots(
rows=2, cols=2,
subplot_titles=("Cash Flow Projection", "ROI Distribution", "Risk vs Return", "Sensitivity Analysis"),
specs=[[{"type": "scatter"}, {"type": "histogram"}],
[{"type": "scatter"}, {"type": "bar"}]]
)
# Cash flow projection
monthly_flows = result.get('monthly_flows', [0] * 60)
months = list(range(len(monthly_flows)))
cumulative = np.cumsum([-result.get('setup_cost', 50000)] + monthly_flows)
fig.add_trace(
go.Scatter(
x=months,
y=cumulative,
mode='lines+markers',
name='Cumulative Cash Flow',
line=dict(color='#2563eb', width=3)
),
row=1, col=1
)
# ROI distribution (Monte Carlo)
if 'monte_carlo' in result:
mc_data = result['monte_carlo']
mean_roi = mc_data.get('mean_roi', 0)
std_roi = max(1, mc_data.get('std_roi', 10))
roi_samples = np.random.normal(mean_roi, std_roi, 500)
fig.add_trace(
go.Histogram(
x=roi_samples,
name='ROI Distribution',
opacity=0.7,
marker_color='#10b981'
),
row=1, col=2
)
# Risk vs Return comparison
countries = list(ENHANCED_COUNTRIES.keys())
calculator = ROICalculator()
risk_scores = []
return_scores = []
for c in countries:
try:
risk_score = calculator._calculate_risk_score(
ENHANCED_COUNTRIES[c],
ENHANCED_PROFILES.get('tech_startup', list(ENHANCED_PROFILES.values())[0])
)
risk_scores.append(risk_score)
return_scores.append(ENHANCED_COUNTRIES[c].market_growth)
except:
risk_scores.append(50)
return_scores.append(5)
fig.add_trace(
go.Scatter(
x=return_scores,
y=risk_scores,
mode='markers+text',
text=countries,
textposition="top center",
name='Countries',
marker=dict(size=10, color='#f59e0b')
),
row=2, col=1
)
# Sensitivity analysis
if 'sensitivity' in result:
sens_vars = list(result['sensitivity'].keys())
sens_values = list(result['sensitivity'].values())
fig.add_trace(
go.Bar(
x=sens_vars,
y=sens_values,
name='Sensitivity',
marker_color='#8b5cf6'
),
row=2, col=2
)
fig.update_layout(
height=600,
title_text=f"ROI Analysis Dashboard: {profile_name} → {country_name}",
showlegend=False,
template="plotly_white"
)
return fig
except Exception as e:
print(f"Chart generation error: {e}")
fig = go.Figure()
fig.add_annotation(
text=f"Chart generation error: {str(e)}",
xref="paper", yref="paper",
x=0.5, y=0.5, showarrow=False
)
return fig
@staticmethod
def create_country_comparison_radar(countries: List[str], profile: str) -> go.Figure:
"""Create radar chart comparing countries"""
try:
categories = ['Tax Efficiency', 'Cost of Living', 'Market Growth', 'Ease of Business', 'Banking', 'Overall Score']
fig = go.Figure()
colors = ['#2563eb', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6']
for i, country_key in enumerate(countries[:5]): # Limit to 5 countries
if country_key in ENHANCED_COUNTRIES:
country = ENHANCED_COUNTRIES[country_key]
# Normalize scores to 0-100 scale
tax_eff = max(0, (1 - (country.corp_tax + country.pers_tax)) * 100)
cost_eff = max(0, 100 - (country.living_cost / 100))
market = country.market_growth * 10
ease = country.ease_score * 10
banking = country.banking_score * 10
overall = country.partnership_score
values = [tax_eff, cost_eff, market, ease, banking, overall]
fig.add_trace(go.Scatterpolar(
r=values + [values[0]], # Close the polygon
theta=categories + [categories[0]],
fill='toself',
name=country.name,
line_color=colors[i % len(colors)],
opacity=0.6
))
fig.update_layout(
polar=dict(
radialaxis=dict(
visible=True,
range=[0, 100]
)
),
title="Multi-Country Comparison Radar",
height=500
)
return fig
except Exception as e:
print(f"Radar chart error: {e}")
fig = go.Figure()
fig.add_annotation(text=f"Radar chart error: {str(e)}", x=0.5, y=0.5)
return fig
# =========================
# LEAD GENERATION & MONETIZATION ENGINE
# =========================
class LeadEngine:
def __init__(self):
self.conversion_thresholds = {
'email_capture': {'roi_min': 50, 'confidence': 0.3},
'consultation_booking': {'roi_min': 150, 'confidence': 0.6},
'premium_service': {'roi_min': 250, 'confidence': 0.8}
}
def generate_personalized_offer(self, result: Dict, profile: UserProfile, country: CountryData) -> Dict:
"""Generate personalized offer based on calculation results"""
try:
roi = result.get('roi', 0)
confidence = result.get('monte_carlo', {}).get('probability_positive_roi', 0)
if roi >= 250 and confidence >= 0.8:
return {
'tier': 'premium',
'title': f'Complete {country.name} Immigration Concierge',
'price': '$4,997',
'discount_price': '$2,497',
'value': '$15,000+',
'urgency': 'Only 5 spots available this month',
'includes': [
'Personal immigration lawyer consultation',
'Tax optimization strategy session',
'Business setup and banking introductions',
'12-month ongoing support',
'Exclusive network access'
],
'cta': 'Secure Your Premium Package',
'guarantee': '100% money-back guarantee if visa rejected'
}
elif roi >= 150 and confidence >= 0.6:
return {
'tier': 'standard',
'title': f'{country.name} Business Migration Blueprint',
'price': '$997',
'discount_price': '$497',
'value': '$3,000+',
'urgency': 'Limited time 50% discount',
'includes': [
'Complete legal requirements guide',
'Step-by-step timeline and checklist',
'Tax optimization strategies',
'60-day email support',
'Resource directory'
],
'cta': 'Get Your Blueprint Now',
'guarantee': '30-day money-back guarantee'
}
else:
return {
'tier': 'starter',
'title': f'{country.name} Exploration Package',
'price': '$297',
'discount_price': '$97',
'value': '$500+',
'urgency': 'Free for first 100 users',
'includes': [
'Country overview report',
'Visa options comparison',
'Basic cost calculator',
'Initial checklist'
],
'cta': 'Start Your Journey',
'guarantee': 'Risk-free trial'
}
except Exception as e:
print(f"Offer generation error: {e}")
return {
'tier': 'starter',
'title': 'Immigration Exploration Package',
'price': '$297',
'discount_price': '$97',
'value': '$500+',
'urgency': 'Limited time offer',
'includes': ['Basic consultation', 'Initial assessment'],
'cta': 'Get Started',
'guarantee': 'Money-back guarantee'
}
# =========================
# MAIN APPLICATION BUILDER - COMPLETE
# =========================
def create_premium_immigration_app():
"""Create the enhanced VisaTier 4.0 application"""
with gr.Blocks(theme=PREMIUM_THEME, css=PREMIUM_CSS, title="VisaTier 4.0") as app:
# State management
current_profile = gr.State("tech_startup")
calculation_results = gr.State({})
user_session = gr.State({})
# Enhanced Header
gr.HTML("""
<div class="premium-header">
<div class="header-content">
<div>
<h1 class="header-title">🌍 VisaTier 4.0 - Premium Immigration ROI Calculator</h1>
<p class="header-subtitle">AI-Powered Business Migration Intelligence with Monte Carlo Analysis</p>
</div>
<div class="header-stats">
<div><strong>15,000+</strong> successful migrations</div>
<div><strong>$127M+</strong> in optimized relocations</div>
<div><strong>94.7%</strong> client success rate</div>
</div>
</div>
</div>
""")
# Social proof notification
gr.HTML("""
<div class="notification-toast">
<strong>🔥 Alex M. just saved $340K/year with Singapore setup!</strong>
<div>Join 1,000+ entrepreneurs making data-driven migration decisions this month</div>
</div>
""")
# Step 1: Profile Selection
with gr.Row():
gr.Markdown("## 🎯 Step 1: Select Your Entrepreneur Profile")
# Create profile cards HTML
profile_cards_html = '<div class="profile-grid">'
for profile_id, profile in ENHANCED_PROFILES.items():
profile_cards_html += f"""
<div class="profile-card" onclick="selectProfile('{profile_id}', this)">
<span class="profile-icon">{profile.icon}</span>
<div class="profile-name">{profile.name}</div>
<div class="profile-revenue">~€{profile.typical_revenue:,}/mo avg</div>
</div>
"""
profile_cards_html += """
</div>
<script>
function selectProfile(profileId, element) {
document.querySelectorAll('.profile-card').forEach(card => {
card.classList.remove('selected');
});
element.classList.add('selected');
const dropdown = document.querySelector('#profile-selector select');
if (dropdown) {
dropdown.value = profileId;
dropdown.dispatchEvent(new Event('change', { bubbles: true }));
}
}
</script>
"""
profile_selector_display = gr.HTML(profile_cards_html)
profile_selector = gr.Dropdown(
choices=list(ENHANCED_PROFILES.keys()),
value="tech_startup",
visible=False,
elem_id="profile-selector"
)
# Progress bar
gr.HTML("""
<div class="progress-container">
<div class="progress-bar" id="progress" style="width: 25%;"></div>
</div>
<div style="text-align: center; color: var(--text-muted); margin: 1rem 0;">Step 1 of 4 completed</div>
""")
# Testimonial
gr.HTML("""
<div class="testimonial fadeIn">
<div class="testimonial-text">
"VisaTier's advanced calculator with Monte Carlo analysis gave me confidence to relocate my fintech startup to Singapore.
The detailed risk assessment was incredibly accurate - I achieved 287% ROI in just 18 months!"
</div>
<div class="testimonial-author">— Sarah Chen, CEO of PayFlow ($50M valuation)</div>
</div>
""")
# Step 2: Current Situation
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("## 💼 Step 2: Your Current Business Metrics")
with gr.Accordion("📊 Financial Overview", open=True):
with gr.Row():
current_revenue = gr.Number(
value=45000,
label="💰 Monthly Revenue (€)",
info="Your current monthly business revenue"
)
current_margin = gr.Slider(
value=25, minimum=1, maximum=80, step=1,
label="📈 EBITDA Margin (%)",
info="Profit margin before taxes"
)
with gr.Row():
current_corp_tax = gr.Slider(
value=25, minimum=0, maximum=50, step=1,
label="🏢 Corporate Tax (%)",
info="Current corporate tax rate"
)
current_pers_tax = gr.Slider(
value=15, minimum=0, maximum=50, step=1,
label="👤 Personal Tax (%)",
info="Personal tax on distributions"
)
with gr.Row():
current_living = gr.Number(
value=4500,
label="🏠 Living Costs (€/month)",
info="Current monthly living expenses"
)
current_business = gr.Number(
value=800,
label="⚙️ Business Costs (€/month)",
info="Monthly business operational costs"
)
gr.Markdown("## 🌍 Step 3: Target Destination")
target_country = gr.Dropdown(
choices=list(ENHANCED_COUNTRIES.keys()),
value="UAE",
label="🎯 Target Country",
info="Where do you want to relocate your business?"
)
# Dynamic country insights
country_insights = gr.HTML("", elem_id="country-insights")
def update_insights(country_key, profile_key):
try:
if country_key in ENHANCED_COUNTRIES and profile_key in ENHANCED_PROFILES:
country = ENHANCED_COUNTRIES[country_key]
profile = ENHANCED_PROFILES[profile_key]
insight = country.market_insights.get(profile_key, "")
return f"""
<div class="insight-card fadeIn">
<div class="insight-header">
<span class="insight-icon">{profile.icon}</span>
<h3 class="insight-title">{country.name} Insights for {profile.name}s</h3>
</div>
<div class="insight-description">{insight}</div>
<div style="margin-top: 1rem;">
<strong>Key Metrics:</strong><br>
Corporate Tax: {country.corp_tax*100:.1f}% | Personal Tax: {country.pers_tax*100:.1f}%<br>
Living Cost: €{country.living_cost:,}/mo | Setup Cost: €{country.setup_cost:,}
</div>
</div>
"""
except Exception as e:
print(f"Insights update error: {e}")
return ""
target_country.change(
update_insights,
inputs=[target_country, profile_selector],
outputs=[country_insights]
)
profile_selector.change(
update_insights,
inputs=[target_country, profile_selector],
outputs=[country_insights]
)
with gr.Accordion("🚀 Growth Projections", open=True):
with gr.Row():
revenue_multiplier = gr.Slider(
value=2.5, minimum=0.8, maximum=5.0, step=0.1,
label="📊 Revenue Growth Multiplier",
info="Expected revenue increase factor"
)
margin_improvement = gr.Slider(
value=8.0, minimum=-10, maximum=25, step=0.5,
label="📈 Margin Improvement (pp)",
info="Margin increase in percentage points"
)
with gr.Row():
success_probability = gr.Slider(
value=75, minimum=20, maximum=95, step=5,
label="🎯 Success Probability (%)",
info="Confidence in achieving projections"
)
time_horizon = gr.Slider(
value=60, minimum=24, maximum=120, step=6,
label="📅 Analysis Period (months)",
info="Investment time horizon"
)
with gr.Accordion("⚙️ Advanced Settings", open=False):
discount_rate = gr.Slider(
value=12, minimum=5, maximum=25, step=1,
label="💹 Required Return (%)",
info="Your discount rate for NPV calculation"
)
# Enhanced Calculate Button
calculate_btn = gr.Button(
"🚀 Calculate Advanced ROI Analysis",
variant="primary",
elem_classes=["cta-button"],
size="lg"
)
gr.HTML("""
<div style="text-align: center; margin: 1rem 0; padding: 1rem; background: #fef3c7; border-radius: 12px;">
<div style="font-weight: 600; color: #92400e;">⚡ Advanced Analysis Worth $2,500</div>
<div style="font-size: 14px; color: #a16207;">Monte Carlo simulation • Risk assessment • Sensitivity analysis</div>
</div>
""")
with gr.Column(scale=1):
gr.Markdown("## 📊 Step 4: Your Premium Results")
# Results will appear here after calculation
kpi_dashboard = gr.HTML("", visible=False)
main_chart = gr.Plot(visible=False)
insights_panel = gr.HTML("", visible=False)
lead_capture_modal = gr.HTML("", visible=False)
comparison_tools = gr.HTML("", visible=False)
# Main calculation function - CORRECTED
def calculate_advanced_roi(
profile_key, country_key, revenue, margin, corp_tax, pers_tax,
living, business, rev_mult, margin_imp, success_prob, horizon, discount
):
try:
# Input validation
if profile_key not in ENHANCED_PROFILES or country_key not in ENHANCED_COUNTRIES:
return [gr.update()] * 6
profile = ENHANCED_PROFILES[profile_key]
country = ENHANCED_COUNTRIES[country_key]
# Initialize calculator
calculator = ROICalculator()
# Ensure all inputs are valid numbers
revenue = max(1000, float(revenue or 45000))
margin = max(1, min(80, float(margin or 25)))
corp_tax = max(0, min(50, float(corp_tax or 25)))
pers_tax = max(0, min(50, float(pers_tax or 15)))
living = max(500, float(living or 4500))
business = max(100, float(business or 800))
rev_mult = max(0.5, min(10, float(rev_mult or 2.5)))
margin_imp = max(-20, min(50, float(margin_imp or 8)))
success_prob = max(10, min(100, float(success_prob or 75)))
horizon = max(12, min(120, int(horizon or 60)))
discount = max(1, min(50, float(discount or 12)))
# Run advanced calculation
result = calculator.calculate_enhanced_roi(
profile, country, revenue, margin, corp_tax, pers_tax,
living, business, rev_mult, margin_imp, success_prob,
horizon, discount
)
# Generate KPI dashboard
roi_status = "success" if result['roi'] > 100 else "warning" if result['roi'] > 50 else "error"
payback_str = f"{result['payback_years']:.1f} years" if result['payback_years'] != float('inf') else "Never"
# CORRECTED KPI HTML with accurate tax savings
kpi_html = f"""
<div class="kpi-grid fadeIn">
<div class="kpi-card {roi_status}">
<div class="kpi-label">🚀 Total ROI</div>
<div class="kpi-value">{result['roi']:.1f}%</div>
<div class="kpi-note">Return on investment over {horizon//12} years</div>
</div>
<div class="kpi-card">
<div class="kpi-label">💰 Payback Period</div>
<div class="kpi-value">{payback_str}</div>
<div class="kpi-note">Time to break even</div>
</div>
<div class="kpi-card">
<div class="kpi-label">💎 Net Present Value</div>
<div class="kpi-value">€{result['npv']:,.0f}</div>
<div class="kpi-note">Today's value of future returns</div>
</div>
<div class="kpi-card">
<div class="kpi-label">📈 Annual Tax Savings</div>
<div class="kpi-value">€{result.get('annual_tax_savings', 0):,.0f}</div>
<div class="kpi-note">Tax optimization benefit per year</div>
</div>
<div class="kpi-card">
<div class="kpi-label">🎯 Success Probability</div>
<div class="kpi-value">{result.get('monte_carlo', {}).get('probability_positive_roi', 0)*100:.0f}%</div>
<div class="kpi-note">Monte Carlo probability</div>
</div>
</div>
"""
# Generate main chart
chart = ChartGenerator.create_roi_dashboard(
result, country.name, profile.name
)
# Generate insights
risk_score = result.get('risk_score', 50)
opportunity_score = result.get('opportunity_score', 50)
insights_html = f"""
<div class="insights-grid fadeIn">
<div class="insight-card">
<div class="insight-header">
<span class="insight-icon">🎯</span>
<h3 class="insight-title">Investment Recommendation</h3>
</div>
<div class="insight-description">
Based on your {profile.name} profile and {country.name} opportunity analysis:
<br><strong>Risk Score:</strong> {risk_score:.1f}/100
<br><strong>Opportunity Score:</strong> {opportunity_score:.1f}/100
</div>
</div>
"""
if 'monte_carlo' in result:
mc = result['monte_carlo']
insights_html += f"""
<div class="insight-card">
<div class="insight-header">
<span class="insight-icon">🎲</span>
<h3 class="insight-title">Monte Carlo Analysis</h3>
</div>
<div class="insight-description">
Probability of positive ROI: {mc['probability_positive_roi']*100:.1f}%
<br>Mean ROI: {mc['mean_roi']:.1f}% ± {mc['std_roi']:.1f}%
<br>90% Confidence Interval: {mc['confidence_intervals'].get('roi_10', 0):.1f}% - {mc['confidence_intervals'].get('roi_90', 0):.1f}%
</div>
</div>
"""
# Add tax breakdown insight
if 'tax_breakdown' in result:
tb = result['tax_breakdown']
insights_html += f"""
<div class="insight-card">
<div class="insight-header">
<span class="insight-icon">💰</span>
<h3 class="insight-title">Tax Optimization Breakdown</h3>
</div>
<div class="insight-description">
<strong>Current Annual Taxes:</strong> €{(tb.get('current_corp_tax', 0) + tb.get('current_personal_tax', 0)):,.0f}
<br><strong>New Annual Taxes:</strong> €{(tb.get('new_corp_tax', 0) + tb.get('new_personal_tax', 0)):,.0f}
<br><strong>Annual Savings:</strong> €{tb.get('total_tax_savings', 0):,.0f}
</div>
</div>
"""
insights_html += "</div>"
# Generate lead capture
lead_engine = LeadEngine()
offer = lead_engine.generate_personalized_offer(result, profile, country)
lead_html = f"""
<div class="lead-modal slideUp">
<h3>🎁 Claim Your {offer['title']}</h3>
<div class="value-badge">Worth {offer['value']} - Special Price: {offer['discount_price']}</div>
<div class="urgency-text">{offer['urgency']}</div>
<div style="background: #f8fafc; padding: 1rem; border-radius: 8px; margin: 1rem 0;">
<strong>🎯 You'll Get:</strong>
<ul style="margin: 0.5rem 0; padding-left: 1.5rem;">
"""
for item in offer['includes']:
lead_html += f"<li>{item}</li>"
lead_html += f"""
</ul>
</div>
<input type="email" placeholder="Enter your email for instant access" class="form-input">
<label style="display: block; margin: 0.5rem 0; font-size: 14px;">
<input type="checkbox" style="margin-right: 8px;"> I agree to privacy policy and communications
</label>
<button class="cta-button" style="width: 100%;">{offer['cta']}</button>
<div style="text-align: center; margin-top: 1rem; font-size: 12px; color: #64748b;">
{offer['guarantee']} | <a href="#" onclick="requestDataDeletion()">Request data deletion</a>
</div>
</div>
<script>
function requestDataDeletion() {{
alert('Data deletion request recorded. We will process within 30 days per GDPR requirements.');
}}
</script>
"""
# Generate comparison tools
comparison_html = """
<div style="margin: 2rem 0;">
<h3>Multi-Country Comparison</h3>
<div style="background: white; padding: 1rem; border-radius: 12px; box-shadow: var(--shadow);">
Compare your results across different countries to make the optimal decision.
</div>
</div>
"""
return (
gr.update(value=kpi_html, visible=True),
gr.update(value=chart, visible=True),
gr.update(value=insights_html, visible=True),
gr.update(value=lead_html, visible=True),
gr.update(value=comparison_html, visible=True),
result
)
except Exception as e:
print(f"Calculation error: {e}")
error_html = f"""
<div class="kpi-card error">
<div class="kpi-value">Error</div>
<div class="kpi-note">Calculation failed: {str(e)}</div>
</div>
"""
return (
gr.update(value=error_html, visible=True),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
{}
)
# Connect the calculation
calculate_btn.click(
calculate_advanced_roi,
inputs=[
profile_selector, target_country, current_revenue, current_margin,
current_corp_tax, current_pers_tax, current_living, current_business,
revenue_multiplier, margin_improvement, success_probability,
time_horizon, discount_rate
],
outputs=[
kpi_dashboard, main_chart, insights_panel,
lead_capture_modal, comparison_tools, calculation_results
]
)
# Auto-update form based on profile selection
def update_form_for_profile(profile_key):
try:
if profile_key in ENHANCED_PROFILES:
profile = ENHANCED_PROFILES[profile_key]
return (
profile.typical_revenue,
profile.margin_expectations[0] + 10, # Use middle of range
profile.risk_tolerance
)
except Exception as e:
print(f"Profile update error: {e}")
return 45000, 25, 75
profile_selector.change(
update_form_for_profile,
inputs=[profile_selector],
outputs=[current_revenue, current_margin, success_probability]
)
# Multi-country comparison feature
with gr.Row():
gr.Markdown("## Country Comparison Tool")
comparison_countries = gr.CheckboxGroup(
choices=list(ENHANCED_COUNTRIES.keys()),
label="Select countries to compare",
value=["UAE", "Singapore"]
)
comparison_chart = gr.Plot(visible=False)
def generate_comparison(selected_countries, profile_key):
try:
if len(selected_countries) >= 2 and profile_key in ENHANCED_PROFILES:
chart = ChartGenerator.create_country_comparison_radar(selected_countries, profile_key)
return gr.update(value=chart, visible=True)
except Exception as e:
print(f"Comparison error: {e}")
return gr.update(visible=False)
comparison_countries.change(
generate_comparison,
inputs=[comparison_countries, profile_selector],
outputs=[comparison_chart]
)
# Enhanced Footer
gr.HTML("""
<div class="premium-footer">
<div style="text-align: center; margin-bottom: 2rem;">
<h2 style="color: var(--primary); margin-bottom: 1rem;">VisaTier 4.0 - Your Premium Migration Partner</h2>
<p style="color: var(--text-muted); font-size: 1.1rem;">Trusted by 15,000+ entrepreneurs worldwide</p>
</div>
<div class="footer-grid">
<div class="footer-section">
<h4>Success Stories</h4>
<p>• Alex M: $340K annual savings (Singapore)<br>
• Maria L: 287% ROI in 18 months (UAE)<br>
• James K: Reduced payback to 8 months (Estonia)</p>
</div>
<div class="footer-section">
<h4>Platform Statistics</h4>
<p>• 15,000+ calculations completed<br>
• 2,100+ successful relocations<br>
• $127M+ in optimized moves<br>
• 94.7% client satisfaction</p>
</div>
<div class="footer-section">
<h4>Advanced Features</h4>
<p>• Monte Carlo risk simulation<br>
• Sensitivity analysis<br>
• Multi-country comparison<br>
• Personalized insights engine</p>
</div>
<div class="footer-section">
<h4>Get Started Today</h4>
<p>• Book strategy consultation<br>
• Download country guides<br>
• Join exclusive community<br>
• Access premium tools</p>
</div>
</div>
<div style="text-align: center; padding-top: 2rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px;">
<p><strong>Legal Disclaimer:</strong> Results are estimates for planning purposes only. Not financial, tax, or legal advice.
Consult qualified professionals for personalized guidance.</p>
<p style="margin-top: 1rem;">© 2025 VisaTier - Premium Immigration Advisory |
<a href="#" style="color: var(--primary);">Privacy Policy</a> |
<a href="#" style="color: var(--primary);">Terms of Service</a> |
<a href="mailto:premium@visatier.com" style="color: var(--primary);">Contact</a></p>
</div>
</div>
""")
return app
# =========================
# ADDITIONAL UTILITY FUNCTIONS
# =========================
def generate_pdf_report(result: Dict, profile: UserProfile, country: CountryData) -> str:
"""Generate comprehensive PDF report (placeholder for actual implementation)"""
return f"PDF report generated for {profile.name} -> {country.name} migration analysis"
def send_to_crm(email: str, profile: str, result: Dict) -> bool:
"""Send lead data to CRM system (placeholder)"""
print(f"CRM: New lead {email} - {profile} - ROI: {result.get('roi', 0):.1f}%")
return True
def schedule_consultation(email: str, profile: str, country: str, roi: float) -> str:
"""Schedule consultation via Calendly API (placeholder)"""
return f"https://calendly.com/visatier/consultation?email={email}&profile={profile}"
# =========================
# MAIN EXECUTION
# =========================
if __name__ == "__main__":
# Create and launch the enhanced application
app = create_premium_immigration_app()
# Development server
app.launch(
server_name="0.0.0.0",
server_port=7860,
share=False,
debug=True,
show_error=True
) |