PromptMeister commited on
Commit
0b3b616
ยท
verified ยท
1 Parent(s): c2f1156

Update app.py

Browse files

updated the interface to be more clear and readable

Files changed (1) hide show
  1. app.py +152 -95
app.py CHANGED
@@ -669,14 +669,14 @@ def create_ranking_history_chart(keyword_history):
669
  def generate_serp_html(keyword, serp_results):
670
  """Generate HTML for SERP results"""
671
  if not serp_results:
672
- return "<div>No SERP results available</div>"
673
 
674
  html = f"""
675
- <div style="font-family: Arial, sans-serif; padding: 20px; border: 1px solid #ddd; border-radius: 8px;">
676
- <h2 style="margin-top: 0;">SERP Results for "{keyword}"</h2>
677
 
678
- <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; margin-bottom: 20px;">
679
- <div style="color: #666; font-size: 12px;">This is a simulated SERP. In a real application, this would use the Google API.</div>
680
  </div>
681
 
682
  <div class="serp-results" style="display: flex; flex-direction: column; gap: 16px;">
@@ -692,19 +692,25 @@ def generate_serp_html(keyword, serp_results):
692
  impressions = result["impressions_estimate"]
693
 
694
  html += f"""
695
- <div class="serp-result" style="padding: 15px; border: 1px solid #e2e8f0; border-radius: 6px; position: relative;">
696
- <div style="position: absolute; top: -10px; left: -10px; background-color: #4299e1; color: white; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px;">
697
  {position}
698
  </div>
699
- <div style="margin-bottom: 5px;">
700
- <a href="#" style="font-size: 18px; color: #1a73e8; text-decoration: none; font-weight: 500;">{title}</a>
701
  </div>
702
- <div style="margin-bottom: 8px; color: #006621; font-size: 14px;">{url}</div>
703
- <div style="color: #4d5156; font-size: 14px;">{snippet}</div>
704
 
705
- <div style="display: flex; margin-top: 10px; font-size: 12px; color: #666;">
706
- <div style="margin-right: 15px;"><span style="font-weight: 500;">CTR:</span> {ctr:.2%}</div>
707
- <div><span style="font-weight: 500;">Est. Impressions:</span> {impressions:,}</div>
 
 
 
 
 
 
708
  </div>
709
  </div>
710
  """
@@ -719,18 +725,20 @@ def generate_serp_html(keyword, serp_results):
719
  def generate_token_visualization_html(token_analysis, full_analysis):
720
  """Generate HTML for token visualization"""
721
  html = """
722
- <div style="font-family: Arial, sans-serif; padding: 20px; border: 1px solid #ddd; border-radius: 8px;">
723
- <h2 style="margin-top: 0;">Token Visualization</h2>
724
 
725
- <div style="margin-bottom: 20px; padding: 15px; background-color: #f8f9fa; border-radius: 6px;">
726
- <div style="margin-bottom: 8px; font-weight: bold; color: #4a5568;">Human View:</div>
727
- <div style="display: flex; flex-wrap: wrap; gap: 8px;">
 
 
728
  """
729
 
730
  # Add human view tokens
731
  for token in token_analysis:
732
  html += f"""
733
- <div style="padding: 6px 12px; background-color: white; border: 1px solid #cbd5e0; border-radius: 4px;">
734
  {token['text']}
735
  </div>
736
  """
@@ -739,22 +747,33 @@ def generate_token_visualization_html(token_analysis, full_analysis):
739
  </div>
740
  </div>
741
 
742
- <div style="text-align: center; margin: 15px 0;">
743
- <span style="font-size: 20px;">โ†“</span>
744
  </div>
745
 
746
- <div style="padding: 15px; background-color: #f0fff4; border-radius: 6px;">
747
- <div style="margin-bottom: 8px; font-weight: bold; color: #2f855a;">Machine View:</div>
748
- <div style="display: flex; flex-wrap: wrap; gap: 8px;">
 
 
749
  """
750
 
751
- # Add machine view tokens
 
 
 
 
 
 
 
 
 
752
  for token in full_analysis:
753
- bg_color = get_token_colors(token["type"])
754
  html += f"""
755
- <div style="padding: 6px 12px; background-color: {bg_color}; border: 1px solid #a0aec0; border-radius: 4px; font-family: monospace;">
756
- {token['token']}
757
- <span style="font-size: 10px; opacity: 0.7; display: block;">{token['type']}</span>
758
  </div>
759
  """
760
 
@@ -762,28 +781,28 @@ def generate_token_visualization_html(token_analysis, full_analysis):
762
  </div>
763
  </div>
764
 
765
- <div style="margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center;">
766
  """
767
 
768
- # Add stats
769
  word_count = len(token_analysis)
770
  token_count = len(full_analysis)
771
  ratio = round(token_count / max(1, word_count), 2)
772
 
773
  html += f"""
774
- <div style="background-color: #ebf8ff; padding: 10px; border-radius: 6px;">
775
- <div style="font-size: 24px; font-weight: bold; color: #3182ce;">{word_count}</div>
776
- <div style="font-size: 14px; color: #4299e1;">Words</div>
777
  </div>
778
 
779
- <div style="background-color: #f0fff4; padding: 10px; border-radius: 6px;">
780
- <div style="font-size: 24px; font-weight: bold; color: #38a169;">{token_count}</div>
781
- <div style="font-size: 14px; color: #48bb78;">Tokens</div>
782
  </div>
783
 
784
- <div style="background-color: #faf5ff; padding: 10px; border-radius: 6px;">
785
- <div style="font-size: 24px; font-weight: bold; color: #805ad5;">{ratio}</div>
786
- <div style="font-size: 14px; color: #9f7aea;">Tokens per Word</div>
787
  </div>
788
  """
789
 
@@ -797,38 +816,51 @@ def generate_token_visualization_html(token_analysis, full_analysis):
797
  def generate_full_analysis_html(keyword, token_analysis, intent_analysis, evolution_potential, trends):
798
  """Generate HTML for full keyword analysis"""
799
  html = f"""
800
- <div style="font-family: Arial, sans-serif; padding: 20px; border: 1px solid #ddd; border-radius: 8px;">
801
- <h2 style="margin-top: 0;">Keyword DNA Analysis for: {keyword}</h2>
802
-
803
- <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px;">
804
- <div style="padding: 15px; border: 1px solid #e2e8f0; border-radius: 6px;">
805
- <h3 style="margin-top: 0; font-size: 16px;">Intent Gene</h3>
806
- <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
807
- <span>Type:</span>
808
- <span>{intent_analysis['type']}</span>
 
 
809
  </div>
810
  <div style="display: flex; justify-content: space-between; align-items: center;">
811
- <span>Strength:</span>
812
- <div style="width: 120px; height: 8px; background-color: #edf2f7; border-radius: 4px; overflow: hidden;">
813
- <div style="height: 100%; background-color: #48bb78; width: {intent_analysis['strength']}%;"></div>
 
814
  </div>
815
  </div>
816
  </div>
817
 
818
- <div style="padding: 15px; border: 1px solid #e2e8f0; border-radius: 6px;">
819
- <h3 style="margin-top: 0; font-size: 16px;">Evolution Potential</h3>
820
- <div style="display: flex; justify-content: center; align-items: center; height: 100px;">
821
- <div style="position: relative; width: 100px; height: 100px;">
 
 
822
  <div style="position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;">
823
- <span style="font-size: 24px; font-weight: bold;">{evolution_potential}</span>
824
  </div>
825
- <svg width="100" height="100" viewBox="0 0 36 36">
826
  <path
827
  d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"
828
  fill="none"
829
- stroke="#4CAF50"
 
 
 
 
 
 
830
  stroke-width="3"
831
  stroke-dasharray="{evolution_potential}, 100"
 
 
832
  />
833
  </svg>
834
  </div>
@@ -836,17 +868,19 @@ def generate_full_analysis_html(keyword, token_analysis, intent_analysis, evolut
836
  </div>
837
  </div>
838
 
839
- <div style="padding: 15px; border: 1px solid #e2e8f0; border-radius: 6px; margin-bottom: 20px;">
840
- <h3 style="margin-top: 0; font-size: 16px;">Future Mutations</h3>
841
- <div style="display: flex; flex-direction: column; gap: 8px;">
 
 
842
  """
843
 
844
- # Add trends
845
  for trend in trends:
846
  html += f"""
847
- <div style="display: flex; align-items: center; gap: 8px;">
848
- <span style="color: #48bb78;">โ†—</span>
849
- <span>{trend}</span>
850
  </div>
851
  """
852
 
@@ -854,58 +888,81 @@ def generate_full_analysis_html(keyword, token_analysis, intent_analysis, evolut
854
  </div>
855
  </div>
856
 
857
- <h3 style="margin-bottom: 10px;">Token Details & Historical Analysis</h3>
 
 
858
  """
859
 
860
- # Add token details
861
- for token in token_analysis:
 
 
 
 
 
 
 
 
 
862
  html += f"""
863
- <div style="padding: 15px; border: 1px solid #e2e8f0; border-radius: 6px; margin-bottom: 15px;">
864
- <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
865
- <div style="display: flex; align-items: center; gap: 8px;">
866
- <span style="font-size: 18px; font-weight: medium;">{token['token']}</span>
867
- <span style="padding: 2px 8px; background-color: #edf2f7; border-radius: 4px; font-size: 12px;">{token['posTag']}</span>
 
 
 
 
868
  """
869
 
870
  if token['entityType']:
871
  html += f"""
872
- <span style="padding: 2px 8px; background-color: #ebf8ff; color: #3182ce; border-radius: 4px; font-size: 12px; display: flex; align-items: center;">
873
- โ“˜ {token['entityType']}
874
  </span>
875
  """
876
 
877
  html += f"""
878
  </div>
879
- <div style="display: flex; align-items: center; gap: 4px;">
880
- <span style="font-size: 12px; color: #718096;">Importance:</span>
881
- <div style="width: 64px; height: 8px; background-color: #edf2f7; border-radius: 4px; overflow: hidden;">
882
- <div style="height: 100%; background-color: #4299e1; width: {token['importance']}%;"></div>
883
  </div>
 
884
  </div>
885
  </div>
886
 
887
- <div style="margin-top: 15px;">
888
- <div style="font-size: 12px; color: #718096; margin-bottom: 4px;">Historical Relevance:</div>
889
- <div style="border: 1px solid #e2e8f0; border-radius: 4px; padding: 10px; background-color: #f7fafc;">
890
- <div style="font-size: 12px; margin-bottom: 8px;">
891
- <span style="font-weight: 500;">Origin: </span>
892
- <span>{token['origin']['era']}, </span>
893
- <span style="font-style: italic;">{token['origin']['language']}</span>
 
894
  </div>
895
- <div style="font-size: 12px; margin-bottom: 12px;">{token['origin']['note']}</div>
896
 
897
- <div style="display: flex; align-items: flex-end; height: 50px; gap: 4px; margin-top: 8px;">
898
  """
899
 
900
- # Add historical data bars
901
  for period, value in token['historicalData']:
902
- opacity = 0.3 + (token['historicalData'].index((period, value)) * 0.1)
 
 
 
903
  html += f"""
904
- <div style="display: flex; flex-direction: column; align-items: center; flex: 1;">
905
- <div style="width: 100%; background-color: rgba(66, 153, 225, {opacity}); border-radius: 2px 2px 0 0; height: {max(4, value)}%;"></div>
906
- <div style="font-size: 9px; margin-top: 4px; color: #718096; transform: rotate(45deg); transform-origin: top left; white-space: nowrap;">
907
  {period}
908
  </div>
 
 
 
909
  </div>
910
  """
911
 
 
669
  def generate_serp_html(keyword, serp_results):
670
  """Generate HTML for SERP results"""
671
  if not serp_results:
672
+ return '<div style="color: #e2e8f0; text-align: center; padding: 2rem;">No SERP results available</div>'
673
 
674
  html = f"""
675
+ <div style="font-family: 'Inter', sans-serif; padding: 20px; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); border: 1px solid #475569; border-radius: 16px; color: #ffffff;">
676
+ <h2 style="margin-top: 0; color: #ffffff; background: linear-gradient(135deg, #06b6d4, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">SERP Results for "{keyword}"</h2>
677
 
678
+ <div style="background: rgba(6, 182, 212, 0.1); border: 1px solid #06b6d4; padding: 12px; border-radius: 8px; margin-bottom: 20px;">
679
+ <div style="color: #06b6d4; font-size: 12px; font-weight: 500;">๐Ÿ” This is a simulated SERP. In a real application, this would use the Google API.</div>
680
  </div>
681
 
682
  <div class="serp-results" style="display: flex; flex-direction: column; gap: 16px;">
 
692
  impressions = result["impressions_estimate"]
693
 
694
  html += f"""
695
+ <div class="serp-result" style="padding: 18px; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); border: 1px solid #475569; border-radius: 12px; position: relative; transition: all 0.3s ease;">
696
+ <div style="position: absolute; top: -12px; left: -12px; background: linear-gradient(135deg, #06b6d4, #3b82f6); color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; box-shadow: 0 4px 8px rgba(6, 182, 212, 0.3);">
697
  {position}
698
  </div>
699
+ <div style="margin-bottom: 8px;">
700
+ <a href="#" style="font-size: 18px; color: #06b6d4; text-decoration: none; font-weight: 600; line-height: 1.4;">{title}</a>
701
  </div>
702
+ <div style="margin-bottom: 10px; color: #14b8a6; font-size: 14px; font-weight: 500;">{url}</div>
703
+ <div style="color: #e2e8f0; font-size: 14px; line-height: 1.5; margin-bottom: 12px;">{snippet}</div>
704
 
705
+ <div style="display: flex; gap: 20px; font-size: 12px; color: #94a3b8; padding-top: 8px; border-top: 1px solid #475569;">
706
+ <div style="display: flex; align-items: center; gap: 4px;">
707
+ <span style="font-weight: 600; color: #06b6d4;">CTR:</span>
708
+ <span>{ctr:.2%}</span>
709
+ </div>
710
+ <div style="display: flex; align-items: center; gap: 4px;">
711
+ <span style="font-weight: 600; color: #06b6d4;">Est. Impressions:</span>
712
+ <span>{impressions:,}</span>
713
+ </div>
714
  </div>
715
  </div>
716
  """
 
725
  def generate_token_visualization_html(token_analysis, full_analysis):
726
  """Generate HTML for token visualization"""
727
  html = """
728
+ <div style="font-family: 'Inter', sans-serif; padding: 24px; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); border: 1px solid #475569; border-radius: 16px; color: #ffffff;">
729
+ <h2 style="margin-top: 0; color: #ffffff; background: linear-gradient(135deg, #06b6d4, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">๐Ÿ”ฌ Token Visualization</h2>
730
 
731
+ <div style="margin-bottom: 24px; padding: 20px; background: rgba(6, 182, 212, 0.1); border: 1px solid #06b6d4; border-radius: 12px;">
732
+ <div style="margin-bottom: 12px; font-weight: 600; color: #06b6d4; display: flex; align-items: center; gap: 8px;">
733
+ <span>๐Ÿ‘๏ธ</span> Human View:
734
+ </div>
735
+ <div style="display: flex; flex-wrap: wrap; gap: 10px;">
736
  """
737
 
738
  # Add human view tokens
739
  for token in token_analysis:
740
  html += f"""
741
+ <div style="padding: 8px 16px; background: linear-gradient(135deg, #1e293b, #334155); border: 1px solid #475569; border-radius: 8px; color: #e2e8f0; font-weight: 500; transition: all 0.3s ease;">
742
  {token['text']}
743
  </div>
744
  """
 
747
  </div>
748
  </div>
749
 
750
+ <div style="text-align: center; margin: 20px 0;">
751
+ <span style="font-size: 24px; color: #06b6d4;">โ†“</span>
752
  </div>
753
 
754
+ <div style="padding: 20px; background: rgba(20, 184, 166, 0.1); border: 1px solid #14b8a6; border-radius: 12px;">
755
+ <div style="margin-bottom: 12px; font-weight: 600; color: #14b8a6; display: flex; align-items: center; gap: 8px;">
756
+ <span>๐Ÿค–</span> Machine View:
757
+ </div>
758
+ <div style="display: flex; flex-wrap: wrap; gap: 10px;">
759
  """
760
 
761
+ # Add machine view tokens with enhanced styling
762
+ color_map = {
763
+ "prefix": "linear-gradient(135deg, #8b5cf6, #a855f7)",
764
+ "suffix": "linear-gradient(135deg, #10b981, #14b8a6)",
765
+ "stem": "linear-gradient(135deg, #3b82f6, #06b6d4)",
766
+ "compound_first": "linear-gradient(135deg, #f59e0b, #d97706)",
767
+ "compound_second": "linear-gradient(135deg, #f59e0b, #d97706)",
768
+ "word": "linear-gradient(135deg, #6b7280, #4b5563)"
769
+ }
770
+
771
  for token in full_analysis:
772
+ bg_gradient = color_map.get(token["type"], color_map["word"])
773
  html += f"""
774
+ <div style="padding: 10px 14px; background: {bg_gradient}; border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; font-family: 'Fira Code', monospace; color: #ffffff; font-weight: 500; box-shadow: 0 2px 4px rgba(0,0,0,0.3); transition: all 0.3s ease;">
775
+ <div style="font-size: 14px;">{token['token']}</div>
776
+ <div style="font-size: 10px; opacity: 0.8; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px;">{token['type']}</div>
777
  </div>
778
  """
779
 
 
781
  </div>
782
  </div>
783
 
784
+ <div style="margin-top: 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
785
  """
786
 
787
+ # Add stats with improved styling
788
  word_count = len(token_analysis)
789
  token_count = len(full_analysis)
790
  ratio = round(token_count / max(1, word_count), 2)
791
 
792
  html += f"""
793
+ <div style="background: linear-gradient(135deg, #06b6d4, #0891b2); padding: 20px; border-radius: 12px; text-align: center; color: #ffffff; box-shadow: 0 4px 8px rgba(6, 182, 212, 0.3);">
794
+ <div style="font-size: 28px; font-weight: 700; margin-bottom: 4px;">{word_count}</div>
795
+ <div style="font-size: 14px; opacity: 0.9; font-weight: 500;">Words</div>
796
  </div>
797
 
798
+ <div style="background: linear-gradient(135deg, #14b8a6, #0d9488); padding: 20px; border-radius: 12px; text-align: center; color: #ffffff; box-shadow: 0 4px 8px rgba(20, 184, 166, 0.3);">
799
+ <div style="font-size: 28px; font-weight: 700; margin-bottom: 4px;">{token_count}</div>
800
+ <div style="font-size: 14px; opacity: 0.9; font-weight: 500;">Tokens</div>
801
  </div>
802
 
803
+ <div style="background: linear-gradient(135deg, #8b5cf6, #7c3aed); padding: 20px; border-radius: 12px; text-align: center; color: #ffffff; box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);">
804
+ <div style="font-size: 28px; font-weight: 700; margin-bottom: 4px;">{ratio}</div>
805
+ <div style="font-size: 14px; opacity: 0.9; font-weight: 500;">Tokens/Word</div>
806
  </div>
807
  """
808
 
 
816
  def generate_full_analysis_html(keyword, token_analysis, intent_analysis, evolution_potential, trends):
817
  """Generate HTML for full keyword analysis"""
818
  html = f"""
819
+ <div style="font-family: 'Inter', sans-serif; padding: 24px; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); border: 1px solid #475569; border-radius: 16px; color: #ffffff;">
820
+ <h2 style="margin-top: 0; margin-bottom: 24px; color: #ffffff; background: linear-gradient(135deg, #06b6d4, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">๐Ÿงฌ Keyword DNA Analysis for: {keyword}</h2>
821
+
822
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px;">
823
+ <div style="padding: 20px; background: rgba(6, 182, 212, 0.1); border: 1px solid #06b6d4; border-radius: 12px;">
824
+ <h3 style="margin-top: 0; font-size: 18px; color: #06b6d4; display: flex; align-items: center; gap: 8px; margin-bottom: 16px;">
825
+ <span>๐ŸŽฏ</span> Intent Gene
826
+ </h3>
827
+ <div style="display: flex; justify-content: space-between; margin-bottom: 12px; color: #e2e8f0;">
828
+ <span style="font-weight: 500;">Type:</span>
829
+ <span style="font-weight: 600; color: #06b6d4;">{intent_analysis['type']}</span>
830
  </div>
831
  <div style="display: flex; justify-content: space-between; align-items: center;">
832
+ <span style="font-weight: 500; color: #e2e8f0;">Strength:</span>
833
+ <div style="width: 120px; height: 10px; background: rgba(255,255,255,0.1); border-radius: 5px; overflow: hidden; position: relative;">
834
+ <div style="height: 100%; background: linear-gradient(90deg, #06b6d4, #14b8a6); width: {intent_analysis['strength']}%; border-radius: 5px; box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);"></div>
835
+ <div style="position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; color: #ffffff; font-weight: 600;">{intent_analysis['strength']}%</div>
836
  </div>
837
  </div>
838
  </div>
839
 
840
+ <div style="padding: 20px; background: rgba(139, 92, 246, 0.1); border: 1px solid #8b5cf6; border-radius: 12px;">
841
+ <h3 style="margin-top: 0; font-size: 18px; color: #8b5cf6; display: flex; align-items: center; gap: 8px; margin-bottom: 16px;">
842
+ <span>โšก</span> Evolution Potential
843
+ </h3>
844
+ <div style="display: flex; justify-content: center; align-items: center; height: 80px;">
845
+ <div style="position: relative; width: 80px; height: 80px;">
846
  <div style="position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;">
847
+ <span style="font-size: 24px; font-weight: 700; color: #8b5cf6;">{evolution_potential}%</span>
848
  </div>
849
+ <svg width="80" height="80" viewBox="0 0 36 36">
850
  <path
851
  d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"
852
  fill="none"
853
+ stroke="rgba(139, 92, 246, 0.3)"
854
+ stroke-width="3"
855
+ />
856
+ <path
857
+ d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"
858
+ fill="none"
859
+ stroke="#8b5cf6"
860
  stroke-width="3"
861
  stroke-dasharray="{evolution_potential}, 100"
862
+ stroke-linecap="round"
863
+ style="filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.5));"
864
  />
865
  </svg>
866
  </div>
 
868
  </div>
869
  </div>
870
 
871
+ <div style="padding: 20px; background: rgba(20, 184, 166, 0.1); border: 1px solid #14b8a6; border-radius: 12px; margin-bottom: 24px;">
872
+ <h3 style="margin-top: 0; font-size: 18px; color: #14b8a6; display: flex; align-items: center; gap: 8px; margin-bottom: 16px;">
873
+ <span>๐Ÿ”ฎ</span> Future Mutations
874
+ </h3>
875
+ <div style="display: flex; flex-direction: column; gap: 10px;">
876
  """
877
 
878
+ # Add trends with enhanced styling
879
  for trend in trends:
880
  html += f"""
881
+ <div style="display: flex; align-items: center; gap: 12px; padding: 8px 0;">
882
+ <span style="color: #14b8a6; font-size: 16px;">โ†—</span>
883
+ <span style="color: #e2e8f0; font-weight: 500;">{trend}</span>
884
  </div>
885
  """
886
 
 
888
  </div>
889
  </div>
890
 
891
+ <h3 style="margin-bottom: 16px; color: #ffffff; display: flex; align-items: center; gap: 8px;">
892
+ <span>๐Ÿ“Š</span> Token Details & Historical Analysis
893
+ </h3>
894
  """
895
 
896
+ # Add token details with enhanced styling
897
+ for i, token in enumerate(token_analysis):
898
+ gradient_colors = [
899
+ "linear-gradient(135deg, #06b6d4, #0891b2)",
900
+ "linear-gradient(135deg, #14b8a6, #0d9488)",
901
+ "linear-gradient(135deg, #8b5cf6, #7c3aed)",
902
+ "linear-gradient(135deg, #3b82f6, #1e40af)",
903
+ "linear-gradient(135deg, #f59e0b, #d97706)"
904
+ ]
905
+ token_gradient = gradient_colors[i % len(gradient_colors)]
906
+
907
  html += f"""
908
+ <div style="padding: 20px; background: rgba(30, 41, 59, 0.8); border: 1px solid #475569; border-radius: 12px; margin-bottom: 16px; backdrop-filter: blur(10px);">
909
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
910
+ <div style="display: flex; align-items: center; gap: 12px;">
911
+ <span style="font-size: 20px; font-weight: 600; color: #ffffff; padding: 8px 16px; background: {token_gradient}; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.3);">
912
+ {token['token']}
913
+ </span>
914
+ <span style="padding: 4px 12px; background: rgba(6, 182, 212, 0.2); color: #06b6d4; border: 1px solid #06b6d4; border-radius: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase;">
915
+ {token['posTag']}
916
+ </span>
917
  """
918
 
919
  if token['entityType']:
920
  html += f"""
921
+ <span style="padding: 4px 12px; background: rgba(139, 92, 246, 0.2); color: #8b5cf6; border: 1px solid #8b5cf6; border-radius: 6px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px;">
922
+ <span>โ“˜</span> {token['entityType']}
923
  </span>
924
  """
925
 
926
  html += f"""
927
  </div>
928
+ <div style="display: flex; align-items: center; gap: 8px;">
929
+ <span style="font-size: 12px; color: #94a3b8; font-weight: 500;">Importance:</span>
930
+ <div style="width: 80px; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden;">
931
+ <div style="height: 100%; background: linear-gradient(90deg, #06b6d4, #14b8a6); width: {token['importance']}%; border-radius: 4px;"></div>
932
  </div>
933
+ <span style="font-size: 11px; color: #06b6d4; font-weight: 600;">{token['importance']}%</span>
934
  </div>
935
  </div>
936
 
937
+ <div style="margin-top: 16px;">
938
+ <div style="font-size: 14px; color: #94a3b8; margin-bottom: 8px; font-weight: 500;">๐Ÿ“š Historical Relevance:</div>
939
+ <div style="border: 1px solid #475569; border-radius: 8px; padding: 16px; background: rgba(15, 23, 42, 0.8);">
940
+ <div style="font-size: 13px; margin-bottom: 8px; color: #e2e8f0;">
941
+ <span style="font-weight: 600; color: #06b6d4;">Origin:</span>
942
+ <span style="margin-left: 8px;">{token['origin']['era']}</span>
943
+ <span style="margin-left: 4px; color: #94a3b8;">โ€ข</span>
944
+ <span style="font-style: italic; margin-left: 4px; color: #14b8a6;">{token['origin']['language']}</span>
945
  </div>
946
+ <div style="font-size: 12px; margin-bottom: 16px; color: #94a3b8; line-height: 1.4;">{token['origin']['note']}</div>
947
 
948
+ <div style="display: flex; align-items: flex-end; height: 60px; gap: 6px; margin-top: 12px; padding: 8px; background: rgba(6, 182, 212, 0.05); border-radius: 6px;">
949
  """
950
 
951
+ # Add enhanced historical data bars
952
  for period, value in token['historicalData']:
953
+ period_index = token['historicalData'].index((period, value))
954
+ opacity = 0.4 + (period_index * 0.1)
955
+ bar_height = max(8, (value / 100) * 40)
956
+
957
  html += f"""
958
+ <div style="display: flex; flex-direction: column; align-items: center; flex: 1; position: relative;">
959
+ <div style="width: 100%; background: linear-gradient(to top, rgba(6, 182, 212, {opacity}), rgba(20, 184, 166, {opacity + 0.2})); border-radius: 3px 3px 0 0; height: {bar_height}px; transition: all 0.3s ease; box-shadow: 0 2px 4px rgba(0,0,0,0.2);"></div>
960
+ <div style="font-size: 8px; margin-top: 6px; color: #94a3b8; transform: rotate(45deg); transform-origin: top center; white-space: nowrap; font-weight: 500;">
961
  {period}
962
  </div>
963
+ <div style="position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 8px; color: #06b6d4; font-weight: 600; opacity: 0; transition: opacity 0.3s ease;">
964
+ {int(value)}%
965
+ </div>
966
  </div>
967
  """
968