colesr commited on
Commit
360ec61
·
verified ·
1 Parent(s): 63ee55d

Upload static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +57 -561
static/index.html CHANGED
@@ -49,8 +49,7 @@ body{background:#0a0e1a;overflow-x:hidden;color:#cbd5e1;font-family:'Inter',sans
49
  @keyframes orbit{0%{transform:translate(6px,6px);opacity:.4}25%{transform:translate(0,12px);opacity:.8}50%{transform:translate(-6px,6px);opacity:.4}75%{transform:translate(0,0);opacity:.8}100%{transform:translate(6px,6px);opacity:.4}}
50
  .animate-orbit{animation:orbit 4s linear infinite}
51
  @keyframes breathe{0%,100%{transform:scale(1);opacity:.6}50%{transform:scale(1.15);opacity:1}}
52
- /* GLOBE MODAL */
53
- .globe-overlay{position:fixed;inset:0;z-[90];background:rgba(5,8,18,0.92);backdrop-filter:blur(40px);display:flex;flex-direction:column;opacity:0;pointer-events:none;transition:opacity .8s ease}
54
  .globe-overlay.open{opacity:1;pointer-events:auto}
55
  .globe-close{position:relative;z-index:100;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;background:rgba(15,23,42,0.7);border:1px solid rgba(34,211,238,0.15);color:#94a3b8;transition:all .3s;flex-shrink:0}
56
  .globe-close:hover{background:rgba(34,211,238,0.1);border-color:rgba(34,211,238,0.4);color:#22d3ee}
@@ -68,7 +67,6 @@ body{background:#0a0e1a;overflow-x:hidden;color:#cbd5e1;font-family:'Inter',sans
68
  @keyframes globePulse{0%,100%{opacity:.5;transform:scale(1)}50%{opacity:1;transform:scale(1.3)}}
69
  .globe-pulse-dot{width:8px;height:8px;border-radius:50%;background:#22d3ee;animation:globePulse 2s ease-in-out infinite}
70
  .globe-status{font-size:11px;color:#64748b;margin-top:8px}
71
- /* LIGHT MODE */
72
  html.light-mode body{background:#f8fafc;color:#334155}
73
  html.light-mode .glass{background:rgba(255,255,255,0.75);border-color:rgba(148,163,184,0.2)}
74
  html.light-mode .glass-light{background:rgba(241,245,249,0.7);border-color:rgba(148,163,184,0.15)}
@@ -94,605 +92,103 @@ html.light-mode .export-menu button:hover{background:rgba(6,182,212,0.08);color:
94
  </head>
95
  <body class="font-sans text-slate-300 min-h-screen bg-grid">
96
 
97
- <!-- LANDING PAGE -->
98
  <div id="landingOverlay" class="fixed inset-0 z-[70] bg-[#0a0e1a]/90 backdrop-blur-xl flex items-center justify-center p-4 transition-opacity duration-500">
99
  <div class="max-w-2xl w-full text-center">
100
- <!-- Brand -->
101
  <div class="mb-8 fade-in" style="animation-delay:0.1s">
102
- <div class="w-16 h-16 rounded-2xl bg-gradient-to-br from-brand-400 to-brand-600 flex items-center justify-center mx-auto mb-5 shadow-lg shadow-brand-500/20">
103
- <i data-lucide="compass" class="w-8 h-8 text-white"></i>
104
- </div>
105
  <h1 class="text-3xl sm:text-4xl font-bold text-white tracking-tight mb-2">Global Insight Engine</h1>
106
  <p class="text-sm text-slate-400 max-w-md mx-auto leading-relaxed">Explore hidden relationships across 120+ development indicators. Load a dataset below or dive straight in.</p>
107
  </div>
108
-
109
- <!-- Quick Start -->
110
  <div class="mb-8 fade-in" style="animation-delay:0.25s">
111
  <div class="text-[0.65rem] text-slate-500 mb-3 uppercase tracking-wider font-medium">Quick Start</div>
112
  <div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
113
- <button onclick="dismissLanding('hdi_2022')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer">
114
- <div class="w-8 h-8 rounded-lg bg-blue-500/15 flex items-center justify-center mb-2 group-hover:bg-blue-500/25 transition-colors">
115
- <i data-lucide="users" class="w-4 h-4 text-blue-400"></i>
116
- </div>
117
- <div class="text-xs font-medium text-white mb-0.5">Human Development</div>
118
- <div class="text-[0.6rem] text-slate-500">UNDP · 5 vars</div>
119
- </button>
120
- <button onclick="dismissLanding('happiness_2023')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer">
121
- <div class="w-8 h-8 rounded-lg bg-rose-500/15 flex items-center justify-center mb-2 group-hover:bg-rose-500/25 transition-colors">
122
- <i data-lucide="heart" class="w-4 h-4 text-rose-400"></i>
123
- </div>
124
- <div class="text-xs font-medium text-white mb-0.5">World Happiness</div>
125
- <div class="text-[0.6rem] text-slate-500">UN SDSN · 8 vars</div>
126
- </button>
127
- <button onclick="dismissLanding('epi_2022')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer">
128
- <div class="w-8 h-8 rounded-lg bg-green-500/15 flex items-center justify-center mb-2 group-hover:bg-green-500/25 transition-colors">
129
- <i data-lucide="leaf" class="w-4 h-4 text-green-400"></i>
130
- </div>
131
- <div class="text-xs font-medium text-white mb-0.5">Environment</div>
132
- <div class="text-[0.6rem] text-slate-500">Yale/Columbia · 6 vars</div>
133
- </button>
134
- <button onclick="dismissLanding('wb:economy')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer">
135
- <div class="w-8 h-8 rounded-lg bg-emerald-500/15 flex items-center justify-center mb-2 group-hover:bg-emerald-500/25 transition-colors">
136
- <i data-lucide="trending-up" class="w-4 h-4 text-emerald-400"></i>
137
- </div>
138
- <div class="text-xs font-medium text-white mb-0.5">Global Economy</div>
139
- <div class="text-[0.6rem] text-slate-500">World Bank · 25 vars</div>
140
- </button>
141
- <button onclick="dismissLanding('innovation_2023')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer">
142
- <div class="w-8 h-8 rounded-lg bg-yellow-500/15 flex items-center justify-center mb-2 group-hover:bg-yellow-500/25 transition-colors">
143
- <i data-lucide="lightbulb" class="w-4 h-4 text-yellow-400"></i>
144
- </div>
145
- <div class="text-xs font-medium text-white mb-0.5">Innovation</div>
146
- <div class="text-[0.6rem] text-slate-500">WIPO · 8 vars</div>
147
- </button>
148
- <button onclick="dismissLanding('peace_2023')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer">
149
- <div class="w-8 h-8 rounded-lg bg-indigo-500/15 flex items-center justify-center mb-2 group-hover:bg-indigo-500/25 transition-colors">
150
- <i data-lucide="shield" class="w-4 h-4 text-indigo-400"></i>
151
- </div>
152
- <div class="text-xs font-medium text-white mb-0.5">Peace & Security</div>
153
- <div class="text-[0.6rem] text-slate-500">IEP · 9 vars</div>
154
- </button>
155
  </div>
156
  </div>
157
-
158
- <!-- Actions -->
159
  <div class="flex flex-col sm:flex-row items-center justify-center gap-3 fade-in" style="animation-delay:0.4s">
160
- <button onclick="dismissLanding()" class="px-6 py-2.5 rounded-xl bg-brand-600/80 text-sm font-medium text-white hover:bg-brand-500 transition-colors shadow-lg shadow-brand-500/15">
161
- Get Started
162
- </button>
163
- <button onclick="dismissLandingAndOpenSources()" class="px-6 py-2.5 rounded-xl glass-light text-sm font-medium text-slate-300 hover:text-white hover:bg-slate-700/50 transition-colors">
164
- Browse Full Library
165
- </button>
166
  </div>
167
  </div>
168
  </div>
169
 
170
  <div id="statusBar" class="status-bar glass border-b border-brand-500/20">
171
  <div class="max-w-[1920px] mx-auto px-4 py-2 flex items-center justify-between">
172
- <div class="flex items-center gap-3">
173
- <div class="w-5 h-5 rounded-full border-2 border-brand-400 border-t-transparent animate-spin" id="statusSpinner"></div>
174
- <div class="flex flex-col">
175
- <span id="statusText" class="text-sm text-brand-300 leading-tight">Initializing...</span>
176
- <span id="statusMeta" class="text-[0.6rem] text-slate-500 font-mono leading-tight hidden">0.0s · <span id="statusStage">preparing</span></span>
177
- </div>
178
- </div>
179
- <div class="flex items-center gap-3">
180
- <div id="statusLiveTicker" class="hidden text-[0.65rem] text-slate-500 font-mono overflow-hidden whitespace-nowrap max-w-[200px] sm:max-w-[320px]">
181
- <span id="tickerText" class="inline-block"></span>
182
- </div>
183
- <div class="w-24 sm:w-32 h-1 bg-slate-800 rounded-full overflow-hidden"><div id="statusProgress" class="h-full bg-gradient-to-r from-brand-400 to-brand-300 rounded-full transition-all" style="width:0%"></div></div>
184
- <span id="statusPercent" class="text-xs text-slate-500 font-mono w-10 text-right">0%</span>
185
- <button id="statusKillBtn" onclick="killLoad()" class="hidden w-6 h-6 rounded-md flex items-center justify-center bg-slate-800/80 hover:bg-red-500/20 hover:text-red-400 text-slate-500 transition-colors" title="Cancel">
186
- <i data-lucide="x" class="w-3.5 h-3.5"></i>
187
- </button>
188
- </div>
189
  </div>
190
  </div>
191
 
192
  <header class="glass sticky top-0 z-50">
193
  <div class="max-w-[1920px] mx-auto px-4 sm:px-6 py-3 flex items-center justify-between">
194
- <div class="flex items-center gap-3">
195
- <div class="w-9 h-9 rounded-lg bg-gradient-to-br from-brand-400 via-brand-500 to-brand-600 flex items-center justify-center animate-logo-float" style="box-shadow:0 0 12px rgba(6,182,212,0.2)">
196
- <i data-lucide="compass" class="w-5 h-5 text-white drop-shadow-sm"></i>
197
- </div>
198
- <div>
199
- <h1 class="text-lg font-bold text-white tracking-tight">Global Insight Engine</h1>
200
- <p class="text-[0.65rem] text-slate-500 -mt-0.5">Data Platform</p>
201
- </div>
202
- </div>
203
- <div class="flex items-center gap-2">
204
- <div class="hidden sm:flex items-center gap-2 px-3 py-1.5 rounded-full glass-light text-xs text-slate-400">
205
- <span class="w-2 h-2 rounded-full bg-emerald-400 pulse-dot"></span>
206
- <span id="dataPointCount">Initializing...</span>
207
- </div>
208
- <button onclick="openNewsGlobe()" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-brand-600/80 hover:bg-brand-500 transition-colors shadow-md shadow-brand-500/10">
209
- <i data-lucide="globe" class="w-3.5 h-3.5"></i>
210
- <span>Analyze Global Media</span>
211
- </button>
212
- <div class="relative">
213
- <button onclick="document.getElementById('exportMenu').classList.toggle('show')" data-tooltip="Export insights as text, CSV, PNG, or share link" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors">
214
- <i data-lucide="download" class="w-3.5 h-3.5"></i><span class="hidden sm:inline">Export</span>
215
- </button>
216
- <div id="exportMenu" class="export-menu">
217
- <button onclick="exportInsights('txt')" data-tooltip="Download a plain-text analysis report"><i data-lucide="file-text" class="w-3.5 h-3.5 inline mr-2"></i>Text Report</button>
218
- <button onclick="exportInsights('csv')" data-tooltip="Export all data as a CSV file"><i data-lucide="table" class="w-3.5 h-3.5 inline mr-2"></i>CSV Data</button>
219
- <button onclick="exportInsights('png')" data-tooltip="Export chart images as PNG"><i data-lucide="image" class="w-3.5 h-3.5 inline mr-2"></i>PNG Charts</button>
220
- <button onclick="shareSession()" data-tooltip="Copy a shareable link to this session"><i data-lucide="link" class="w-3.5 h-3.5 inline mr-2"></i>Copy Share Link</button>
221
- </div>
222
- </div>
223
- <label class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors cursor-pointer" data-tooltip="Load from the data library">
224
- <i data-lucide="upload" class="w-3.5 h-3.5"></i>
225
- <span class="hidden sm:inline">Upload</span>
226
- <input type="file" accept=".json,.csv" class="hidden" onchange="handleFileUpload(event)">
227
- </label>
228
- <button onclick="showDatasetBrowser()" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors">
229
- <i data-lucide="database" class="w-3.5 h-3.5"></i><span class="hidden sm:inline">Sources</span>
230
- </button>
231
- <!-- AI Insight Guide -->
232
- <button onclick="openChatbot('general')" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors group" data-tooltip="Open the Insight Guide for help with charts and data concepts">
233
- <span class="relative flex items-center justify-center w-4 h-4">
234
- <i data-lucide="sparkles" class="w-3.5 h-3.5 text-brand-400 group-hover:text-brand-300 transition-colors"></i>
235
- <span class="absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-brand-400 animate-breathe"></span>
236
- </span>
237
- <span class="hidden sm:inline">Guide</span>
238
- </button>
239
- </div>
240
  </div>
241
  </header>
242
 
243
- <div class="max-w-[1920px] mx-auto px-4 sm:px-6 pt-4">
244
- <div class="flex items-center justify-between">
245
- <div id="tabBar" class="flex gap-2 overflow-x-auto pb-2 flex-1">
246
- <button draggable="true" data-tab="explorer" id="tab-btn-explorer" class="tab-btn active px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Browse variables, distributions, and correlations. Drag to reorder.">
247
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="search" class="w-3.5 h-3.5"></i>Explorer
248
- </button>
249
- <button draggable="true" data-tab="simulator" id="tab-btn-simulator" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Simulate policy changes and see projected impacts. Drag to reorder.">
250
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="git-branch" class="w-3.5 h-3.5"></i>Simulator
251
- </button>
252
- <button draggable="true" data-tab="discover" id="tab-btn-discover" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Auto-generated insights and findings from the data. Drag to reorder.">
253
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="sparkles" class="w-3.5 h-3.5"></i>Discover
254
- </button>
255
- <button draggable="true" data-tab="compare" id="tab-btn-compare" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Side-by-side country comparison with radar charts. Drag to reorder.">
256
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="columns-3" class="w-3.5 h-3.5"></i>Compare
257
- </button>
258
- <button draggable="true" data-tab="decisions" id="tab-btn-decisions" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Weighted ranking with priority sliders. Drag to reorder.">
259
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="sliders-horizontal" class="w-3.5 h-3.5"></i>Rank
260
- </button>
261
- <button draggable="true" data-tab="benchmark" id="tab-btn-benchmark" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Profile a single country against regional or global peers. Drag to reorder.">
262
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="user" class="w-3.5 h-3.5"></i>Profile
263
- </button>
264
- <button draggable="true" data-tab="outliers" id="tab-btn-outliers" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Find statistical outliers and edge cases in the data. Drag to reorder.">
265
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="alert-triangle" class="w-3.5 h-3.5"></i>Outliers
266
- </button>
267
- <button draggable="true" data-tab="mapping" id="tab-btn-mapping" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move" data-tooltip="Create concept maps and relationship diagrams. Drag to reorder.">
268
- <i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="map" class="w-3.5 h-3.5"></i>Mapping
269
- </button>
270
- </div>
271
- <!-- Discrete theme toggle -->
272
- <button onclick="toggleTheme()" id="themeToggle" class="ml-2 flex-shrink-0 w-8 h-8 rounded-lg glass-light flex items-center justify-center text-slate-400 hover:text-brand-300 transition-colors" title="Toggle theme">
273
- <i data-lucide="sun" class="w-3.5 h-3.5 theme-icon-light hidden"></i>
274
- <i data-lucide="moon" class="w-3.5 h-3.5 theme-icon-dark"></i>
275
- </button>
276
- </div>
277
- </div>
278
 
279
- <!-- EXPLORER TAB -->
280
  <div id="tab-explorer" class="tab-content max-w-[1920px] mx-auto flex flex-col lg:flex-row">
281
- <aside class="w-full lg:w-80 xl:w-96 flex-shrink-0 glass border-r border-slate-800/50 lg:h-[calc(100vh-120px)] lg:overflow-y-auto lg:sticky lg:top-28">
282
- <div class="p-4">
283
- <div class="flex items-center justify-between mb-3">
284
- <h2 class="text-sm font-semibold text-white">Variables</h2>
285
- <span class="text-[0.65rem] text-slate-500" id="varCount">Loading...</span>
286
- </div>
287
- <div class="relative mb-5">
288
- <i data-lucide="search" class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"></i>
289
- <input type="text" id="varSearch" placeholder="Search variables..." class="w-full pl-9 pr-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700/50 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-brand-500/50 focus:ring-1 focus:ring-brand-500/20 transition-all" oninput="filterVariables()">
290
- </div>
291
- <div class="mb-2">
292
- <div class="text-[0.65rem] text-slate-500 mb-2 uppercase tracking-wider font-medium">Browse by Category</div>
293
- </div>
294
- <div id="categoryGrid" class="grid grid-cols-2 gap-2 mb-2"></div>
295
- <div id="clearCatWrap" class="hidden"><div class="clear-cat" onclick="clearCategoryFilter()">Clear selection</div></div>
296
- <div id="variableList" class="space-y-1.5 mt-4 hidden"></div>
297
- </div>
298
- </aside>
299
- <main class="flex-1 p-4 sm:p-6 space-y-6 min-w-0">
300
- <div id="emptyState" class="flex flex-col items-center justify-center py-20 text-center">
301
- <div class="w-20 h-20 rounded-2xl bg-gradient-to-br from-brand-400/20 to-brand-600/20 flex items-center justify-center mb-6">
302
- <i data-lucide="mouse-pointer-click" class="w-10 h-10 text-brand-400"></i>
303
- </div>
304
- <h2 class="text-2xl font-bold text-white mb-2">Select a Variable to Begin</h2>
305
- <p class="text-slate-400 max-w-md">Search or browse categories to discover hidden relationships, spot outliers, and get actionable insights.</p>
306
- </div>
307
- <div id="resultsArea" class="hidden space-y-6">
308
- <div class="glass rounded-2xl p-6 fade-in relative overflow-hidden">
309
- <div class="relative">
310
- <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
311
- <div>
312
- <div class="flex items-center gap-2 mb-2">
313
- <span id="heroCategory" class="text-[0.65rem] px-2 py-0.5 rounded-full bg-brand-500/20 text-brand-300 uppercase font-semibold tracking-wider"></span>
314
- <span id="heroType" class="text-[0.65rem] px-2 py-0.5 rounded-full bg-slate-700/50 text-slate-400 uppercase font-semibold tracking-wider"></span>
315
- </div>
316
- <h2 id="heroName" class="text-2xl sm:text-3xl font-bold text-white mb-1"></h2>
317
- <p id="heroDesc" class="text-sm text-slate-400 max-w-xl"></p>
318
- </div>
319
- <div class="flex gap-3">
320
- <div class="text-center px-4 py-2 rounded-xl glass-light"><div id="heroMean" class="text-xl font-bold stat-value font-mono"></div><div class="text-[0.6rem] text-slate-500 uppercase tracking-wider">Mean</div></div>
321
- <div class="text-center px-4 py-2 rounded-xl glass-light"><div id="heroStd" class="text-xl font-bold stat-value font-mono"></div><div class="text-[0.6rem] text-slate-500 uppercase tracking-wider">Std Dev</div></div>
322
- <div class="text-center px-4 py-2 rounded-xl glass-light"><div id="heroRange" class="text-xl font-bold stat-value font-mono"></div><div class="text-[0.6rem] text-slate-500 uppercase tracking-wider">Range</div></div>
323
- </div>
324
- </div>
325
- </div>
326
- </div>
327
- <div id="narrativePanel" class="narrative-panel rounded-xl p-5 hidden fade-in">
328
- <div class="flex items-center gap-2 mb-3">
329
- <i data-lucide="message-square-plus" class="w-4 h-4 text-brand-400"></i>
330
- <span class="text-xs font-semibold text-brand-300 uppercase tracking-wider">Narrative Insight</span>
331
- </div>
332
- <p id="narrativeText" class="text-sm text-slate-300 leading-relaxed"></p>
333
- </div>
334
- <div class="flex items-center justify-between">
335
- <div class="flex items-center gap-2" id="peerToggleContainer" style="display:none">
336
- <button onclick="setPeerMode('global')" id="peerGlobal" class="peer-toggle active">Global</button>
337
- <button onclick="setPeerMode('regional')" id="peerRegional" class="peer-toggle">By Region</button>
338
- </div>
339
- </div>
340
- <div id="riskOpportunityBanner" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div>
341
- <div id="insightBanners" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div>
342
- <div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
343
- <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="bar-chart-3" class="w-4 h-4 text-brand-400"></i>Distribution</h3><button onclick="openChatbotFor('distribution')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div><div class="h-64"><canvas id="distributionChart"></canvas></div></div>
344
- <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="network" class="w-4 h-4 text-brand-400"></i>Network</h3><button onclick="openChatbotFor('network')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div><div class="h-64 relative"><canvas id="networkCanvas" class="w-full h-full"></canvas></div></div>
345
- </div>
346
- <div class="glass rounded-2xl p-5">
347
- <div class="flex items-center justify-between mb-5">
348
- <h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="link" class="w-4 h-4 text-brand-400"></i>Correlations</h3>
349
- <div class="flex gap-2">
350
- <button onclick="setCorrFilter('all')" id="filterAll" class="px-3 py-1 rounded-md text-xs bg-brand-500/20 text-brand-300 border border-brand-500/30">All</button>
351
- <button onclick="setCorrFilter('positive')" id="filterPos" class="px-3 py-1 rounded-md text-xs bg-slate-800/50 text-slate-400 border border-slate-700/50 hover:border-slate-600">Positive</button>
352
- <button onclick="setCorrFilter('negative')" id="filterNeg" class="px-3 py-1 rounded-md text-xs bg-slate-800/50 text-slate-400 border border-slate-700/50 hover:border-slate-600">Negative</button>
353
- </div>
354
- </div>
355
- <div id="correlationBars" class="space-y-3"></div>
356
- <button onclick="openChatbotFor('correlations')" class="explain-chart-btn mt-3 w-full px-3 py-2 rounded-lg glass-light text-xs text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center justify-center gap-2"><i data-lucide="message-circle" class="w-3.5 h-3.5"></i>Explain how correlations work</button>
357
- </div>
358
- <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="scatter-chart" class="w-4 h-4 text-brand-400"></i>Explore</h3><div class="flex items-center gap-2"><select id="scatterVarSelect" onchange="updateScatterPlot()" class="px-3 py-1.5 rounded-lg bg-slate-800/80 border border-slate-700/50 text-sm text-white focus:outline-none focus:border-brand-500/50"></select><button onclick="openChatbotFor('scatter')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div></div><div class="h-80"><canvas id="scatterChart"></canvas></div></div>
359
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="lightbulb" class="w-4 h-4 text-brand-400"></i>Insights</h3><div id="insightCards" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div></div>
360
- <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="grid-3x3" class="w-4 h-4 text-brand-400"></i>Heatmap</h3><button onclick="openChatbotFor('heatmap')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div><div class="overflow-x-auto"><canvas id="heatmapCanvas"></canvas></div></div>
361
- </div>
362
- </main>
363
  </div>
364
 
365
- <!-- SCENARIO BUILDER TAB -->
366
- <div id="tab-simulator" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
367
- <div class="glass rounded-2xl p-6">
368
- <h2 class="text-xl font-bold text-white mb-2 flex items-center gap-2"><i data-lucide="git-branch" class="w-5 h-5 text-brand-400"></i>Scenario Builder</h2>
369
- <p class="text-xs text-slate-400 mb-6">Adjust any variable and see projected changes across all correlated indicators.</p>
370
- <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
371
- <div class="lg:col-span-1 space-y-4">
372
- <div class="sim-scenario">
373
- <label class="block text-xs font-semibold text-white mb-2">Select Scenario Variable</label>
374
- <select id="simVariable" onchange="initSimulator()" class="w-full px-3 py-2 rounded-lg bg-slate-800/80 border border-slate-700/50 text-sm text-white focus:outline-none focus:border-brand-500/50"></select>
375
- </div>
376
- <div class="sim-scenario">
377
- <div class="flex justify-between mb-1"><span class="text-xs text-slate-300" id="simLabel">Value</span><span class="text-xs font-mono text-brand-300" id="simValue">0</span></div>
378
- <input type="range" id="simSlider" min="-50" max="50" value="0" class="slider-track w-full" oninput="runSimulation(this.value)">
379
- <div class="flex justify-between mt-1 text-[0.6rem] text-slate-500"><span>-50%</span><span>0%</span><span>+50%</span></div>
380
- </div>
381
- <div class="sim-scenario">
382
- <div class="flex justify-between mb-2"><span class="text-xs font-semibold text-white">Affected Indicators</span><span class="text-[0.65rem] text-slate-500" id="simAffectedCount">0</span></div>
383
- <div id="simResults" class="space-y-2 max-h-64 overflow-y-auto"></div>
384
- </div>
385
- </div>
386
- <div class="lg:col-span-2">
387
- <div class="glass rounded-2xl p-5 h-full">
388
- <div class="flex items-center justify-between mb-4">
389
- <h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="arrow-left-right" class="w-4 h-4 text-brand-400"></i>Projected Impact</h3>
390
- <button onclick="openChatbotFor('simulator')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button>
391
- </div>
392
- <div class="h-80"><canvas id="simChart"></canvas></div>
393
- </div>
394
- </div>
395
- </div>
396
- </div>
397
- </div>
398
 
399
- <!-- DISCOVER TAB -->
400
- <div id="tab-discover" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
401
- <div class="glass rounded-2xl p-6">
402
- <h2 class="text-xl font-bold text-white mb-2 flex items-center gap-2"><i data-lucide="sparkles" class="w-5 h-5 text-brand-400"></i>Unique Insights Discovery</h2>
403
- <p class="text-xs text-slate-400 mb-6">The most surprising, counter-intuitive, and cross-domain correlations in the entire dataset.</p>
404
- <div id="gemList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"></div>
405
- </div>
406
- </div>
407
 
408
- <!-- COMPARE TAB -->
409
- <div id="tab-compare" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
410
- <div class="glass rounded-2xl p-6">
411
- <h2 class="text-xl font-bold text-white mb-4 flex items-center gap-2"><i data-lucide="columns-3" class="w-5 h-5 text-brand-400"></i>Country Comparison</h2>
412
- <div class="flex flex-wrap gap-2 mb-6">
413
- <select id="compareSelect" onchange="addCompareCountry(this.value);this.value=''" class="px-3 py-2 rounded-lg bg-slate-800/80 border border-slate-700/50 text-sm text-white focus:outline-none focus:border-brand-500/50">
414
- <option value="">+ Add country...</option>
415
- </select>
416
- </div>
417
- <div id="compareTags" class="flex flex-wrap gap-2 mb-6"></div>
418
- <div id="compareResults" class="hidden">
419
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
420
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="radar" class="w-4 h-4 text-brand-400"></i>Radar Comparison</h3><div class="h-80"><canvas id="compareRadarCanvas"></canvas></div></div>
421
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="bar-chart-3" class="w-4 h-4 text-brand-400"></i>Side-by-Side</h3><div id="compareTable" class="overflow-x-auto max-h-80"></div></div>
422
- </div>
423
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="arrow-left-right" class="w-4 h-4 text-brand-400"></i>Difference Heatmap</h3><div class="overflow-x-auto"><canvas id="compareHeatmapCanvas"></canvas></div></div>
424
- </div>
425
- <div id="compareEmpty" class="text-center py-12"><p class="text-slate-500 text-sm">Select at least two countries to compare.</p></div>
426
- </div>
427
- </div>
428
 
429
- <!-- RANK TAB -->
430
- <div id="tab-decisions" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
431
- <div class="glass rounded-2xl p-6">
432
- <div class="flex items-center justify-between mb-4">
433
- <h2 class="text-xl font-bold text-white flex items-center gap-2"><i data-lucide="sliders-horizontal" class="w-5 h-5 text-brand-400"></i>Rank</h2>
434
- <button onclick="openChatbotFor('decisions')" class="explain-chart-btn px-2.5 py-1.5 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1.5"><i data-lucide="message-circle" class="w-3 h-3"></i>How this works</button>
435
- </div>
436
- <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
437
- <div class="space-y-4">
438
- <div class="flex justify-between items-center">
439
- <span class="text-xs font-semibold text-white">Priorities</span>
440
- <div class="flex items-center gap-2">
441
- <button onclick="openChatbotFor('weight-sliders')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.6rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-2.5 h-2.5"></i>Explain sliders</button>
442
- <button onclick="resetWeights()" class="text-[0.65rem] text-brand-400 hover:text-brand-300 transition-colors">Reset</button>
443
- </div>
444
- </div>
445
- <div id="weightSliders" class="space-y-3"></div>
446
- <div class="p-3 rounded-lg glass-light"><div class="flex justify-between mb-1"><span class="text-[0.65rem] text-slate-500">Total Weight</span><span class="text-xs font-mono text-brand-300" id="weightTotalText">100%</span></div><div class="w-full h-2 rounded-full bg-slate-800 mt-1"><div id="weightTotalBar" class="h-full bg-brand-500 rounded-full transition-all" style="width:100%"></div></div></div>
447
- </div>
448
- <div class="lg:col-span-2 space-y-6">
449
- <div class="glass rounded-2xl p-5">
450
- <div class="flex items-center justify-between mb-4">
451
- <h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="trophy" class="w-4 h-4 text-brand-400"></i>Top Recommendations</h3>
452
- <button onclick="openChatbotFor('decision-results')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain scores</button>
453
- </div>
454
- <div id="decisionResults" class="space-y-3"></div>
455
- </div>
456
- <div class="glass rounded-2xl p-5">
457
- <div class="flex items-center justify-between mb-4">
458
- <h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="radar" class="w-4 h-4 text-brand-400"></i>Radar</h3>
459
- <button onclick="openChatbotFor('radar')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain radar</button>
460
- </div>
461
- <div class="h-80"><canvas id="radarChart"></canvas></div>
462
- </div>
463
- </div>
464
- </div>
465
- </div>
466
- </div>
467
 
468
- <!-- BENCHMARK TAB -->
469
- <div id="tab-benchmark" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
470
- <div class="glass rounded-2xl p-6">
471
- <h2 class="text-xl font-bold text-white mb-4 flex items-center gap-2"><i data-lucide="user" class="w-5 h-5 text-brand-400"></i>My Profile</h2>
472
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
473
- <div class="space-y-4">
474
- <div class="flex justify-between items-center"><span class="text-xs font-semibold text-white">Your Values</span><select id="benchmarkCountrySelect" onchange="fillBenchmarkFromCountry()" class="px-2 py-1 rounded bg-slate-800/80 text-xs text-white border border-slate-700/50 focus:outline-none focus:border-brand-500/50"><option value="">-- Pick a country proxy --</option></select></div>
475
- <div id="benchmarkInputs" class="grid grid-cols-1 sm:grid-cols-2 gap-3"></div>
476
- <button onclick="calculateBenchmark()" class="w-full py-2.5 rounded-lg bg-brand-600/80 text-sm text-white hover:bg-brand-500 transition-colors flex items-center justify-center gap-2"><i data-lucide="activity" class="w-4 h-4"></i>Analyze Profile</button>
477
- </div>
478
- <div id="benchmarkResults" class="hidden space-y-4">
479
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="percent" class="w-4 h-4 text-brand-400"></i>Percentiles</h3><div id="percentileBars" class="space-y-3"></div></div>
480
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="map-pin" class="w-4 h-4 text-brand-400"></i>Closest Match</h3><div id="closestMatch"></div></div>
481
- <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="target" class="w-4 h-4 text-brand-400"></i>Priority Actions</h3><div id="priorityActions" class="space-y-2"></div></div>
482
- </div>
483
- </div>
484
- </div>
485
- </div>
486
 
487
- <!-- OUTLIERS TAB -->
488
- <div id="tab-outliers" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
489
- <div class="glass rounded-2xl p-6">
490
- <h2 class="text-xl font-bold text-white mb-4 flex items-center gap-2"><i data-lucide="alert-triangle" class="w-5 h-5 text-brand-400"></i>Outlier Spotlight</h2>
491
- <div id="outlierList" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div>
492
- </div>
493
- </div>
494
 
495
- <div id="datasetModal" class="fixed inset-0 z-50 hidden items-center justify-center bg-black/60 backdrop-blur-sm p-4" onclick="if(event.target===this)closeDatasetModal()">
496
- <div class="glass rounded-2xl w-full max-w-5xl max-h-[85vh] overflow-hidden flex flex-col">
497
- <div class="flex items-center justify-between p-5 border-b border-slate-700/50">
498
- <h3 class="text-lg font-bold text-white flex items-center gap-2"><i data-lucide="database" class="w-5 h-5 text-brand-400"></i>Dataset Explorer</h3>
499
- <button onclick="closeDatasetModal()" class="w-8 h-8 rounded-lg flex items-center justify-center hover:bg-slate-700/50 transition-colors"><i data-lucide="x" class="w-4 h-4 text-slate-400"></i></button>
500
- </div>
501
- <div class="overflow-auto p-5 flex-1">
502
- <table class="text-xs w-full min-w-[800px] border-collapse"><thead id="datasetThead" class="sticky top-0 bg-slate-900/90"></thead><tbody id="datasetTbody"></tbody></table>
503
- </div>
504
- </div>
505
- </div>
506
 
507
- <!-- AI INSIGHT GUIDE CHATBOT -->
508
  <div id="chatbotPanel" class="fixed inset-y-0 right-0 w-full sm:w-[480px] z-[80] transform translate-x-full transition-transform duration-500 ease-out flex flex-col" style="background:rgba(10,14,26,0.92);backdrop-filter:blur(24px);border-left:1px solid rgba(34,211,238,0.08)">
509
- <!-- Header -->
510
- <div class="flex items-center justify-between p-5 border-b border-slate-700/30">
511
- <div class="flex items-center gap-3">
512
- <div class="w-8 h-8 rounded-lg bg-gradient-to-br from-brand-400 to-brand-600 flex items-center justify-center">
513
- <i data-lucide="sparkles" class="w-4 h-4 text-white"></i>
514
- </div>
515
- <div>
516
- <div class="text-sm font-semibold text-white">Insight Guide</div>
517
- <div class="text-[0.65rem] text-slate-500 flex items-center gap-1.5">
518
- <span class="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-breathe"></span>
519
- Ready to help
520
- </div>
521
- </div>
522
- </div>
523
- <button onclick="closeChatbot()" class="w-8 h-8 rounded-lg flex items-center justify-center hover:bg-slate-700/50 transition-colors">
524
- <i data-lucide="x" class="w-4 h-4 text-slate-400"></i>
525
- </button>
526
- </div>
527
-
528
- <!-- Context pill -->
529
- <div class="px-5 pt-3 pb-1">
530
- <div id="chatbotContextPill" class="hidden inline-flex items-center gap-2 px-3 py-1.5 rounded-full glass-light text-xs text-slate-400">
531
- <i data-lucide="target" class="w-3 h-3 text-brand-400"></i>
532
- <span id="chatbotContextText">Looking at: GDP per Capita</span>
533
- </div>
534
- </div>
535
-
536
- <!-- Messages -->
537
- <div id="chatbotMessages" class="flex-1 overflow-y-auto px-5 py-4 space-y-4">
538
- <!-- Welcome message -->
539
- <div class="flex gap-3">
540
- <div class="w-7 h-7 rounded-lg bg-gradient-to-br from-brand-400 to-brand-600 flex-shrink-0 flex items-center justify-center mt-0.5">
541
- <i data-lucide="sparkles" class="w-3.5 h-3.5 text-white"></i>
542
- </div>
543
- <div class="space-y-2">
544
- <p class="text-sm text-slate-300 leading-relaxed">Hi there! I'm your <strong class="text-brand-300">Insight Guide</strong>. I can help you understand any chart, number, or visual on this page — in plain language, no jargon.</p>
545
- <p class="text-sm text-slate-300 leading-relaxed">Just ask me things like:</p>
546
- <ul class="text-sm text-slate-400 space-y-1 ml-1">
547
- <li class="flex items-start gap-2"><span class="text-brand-400 mt-0.5">›</span> <span>"What does this Network Diagram mean?"</span></li>
548
- <li class="flex items-start gap-2"><span class="text-brand-400 mt-0.5">›</span> <span>"Explain the Distribution chart in detail"</span></li>
549
- <li class="flex items-start gap-2"><span class="text-brand-400 mt-0.5">›</span> <span>"How is the correlation calculated?"</span></li>
550
- <li class="flex items-start gap-2"><span class="text-brand-400 mt-0.5">›</span> <span>"Why is this country an outlier?"</span></li>
551
- </ul>
552
- <p class="text-sm text-slate-400 mt-2">Or click any <span class="text-brand-300 font-medium">📎 Explain this</span> button next to a chart for instant context.</p>
553
- </div>
554
- </div>
555
- </div>
556
-
557
- <!-- Quick chips -->
558
- <div id="chatbotQuickChips" class="px-5 pb-2 flex flex-wrap gap-2">
559
- <button onclick="sendChatbotMessage('Explain the currently selected variable')" class="px-3 py-1.5 rounded-full glass-light text-xs text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all">Explain this variable</button>
560
- <button onclick="sendChatbotMessage('How do I read the Network Diagram?')" class="px-3 py-1.5 rounded-full glass-light text-xs text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all">Network Diagram</button>
561
- <button onclick="sendChatbotMessage('What do the correlation numbers mean?')" class="px-3 py-1.5 rounded-full glass-light text-xs text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all">Correlations</button>
562
- <button onclick="sendChatbotMessage('How are outliers detected?')" class="px-3 py-1.5 rounded-full glass-light text-xs text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all">Outliers</button>
563
- </div>
564
-
565
- <!-- Input -->
566
- <div class="p-4 border-t border-slate-700/30">
567
- <div class="flex items-end gap-2 glass-light rounded-xl px-4 py-2">
568
- <textarea id="chatbotInput" rows="1" placeholder="Ask me anything about the data or visuals..." class="flex-1 bg-transparent text-sm text-white placeholder-slate-500 resize-none focus:outline-none leading-relaxed" onkeydown="if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();sendChatbotMessage();}"></textarea>
569
- <button onclick="sendChatbotMessage()" class="w-8 h-8 rounded-lg bg-brand-600/80 hover:bg-brand-500 flex items-center justify-center transition-colors flex-shrink-0">
570
- <i data-lucide="arrow-up" class="w-4 h-4 text-white"></i>
571
- </button>
572
- </div>
573
- <p class="text-center text-[0.6rem] text-slate-600 mt-2">Powered by on-device analysis. No data leaves your session.</p>
574
- </div>
575
- </div>
576
-
577
- <!-- Chatbot overlay backdrop -->
578
- <div id="chatbotBackdrop" onclick="closeChatbot()" class="fixed inset-0 z-[75] bg-black/40 backdrop-blur-sm hidden opacity-0 transition-opacity duration-300"></div>
579
-
580
- <!-- MAPPING TAB -->
581
- <div id="tab-mapping" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6">
582
- <div class="glass rounded-2xl p-6 flex flex-col" style="height: calc(100vh - 200px);">
583
- <div class="flex items-center justify-between mb-4">
584
- <h2 class="text-xl font-bold text-white flex items-center gap-2"><i data-lucide="map" class="w-5 h-5 text-brand-400"></i>Mapping</h2>
585
- <div class="flex items-center gap-2">
586
- <button onclick="addMappingCard()" class="px-3 py-1.5 rounded-lg glass-light text-xs text-slate-300 hover:text-white hover:bg-slate-700/50 transition-colors flex items-center gap-1.5">
587
- <i data-lucide="plus" class="w-3.5 h-3.5"></i>Add Card
588
- </button>
589
- <button onclick="clearMapping()" class="px-3 py-1.5 rounded-lg glass-light text-xs text-slate-300 hover:text-white hover:bg-slate-700/50 transition-colors flex items-center gap-1.5">
590
- <i data-lucide="trash-2" class="w-3.5 h-3.5"></i>Clear
591
- </button>
592
- <button onclick="openChatbotFor('mapping')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button>
593
- </div>
594
- </div>
595
- <p class="text-xs text-slate-400 mb-3">Click & drag cards to arrange. Click "connect" on a card to draw a connection line to another card. Click a card to edit its note.</p>
596
- <div id="mappingCanvas" class="relative flex-1 rounded-xl border border-slate-700/30 overflow-hidden" style="background: linear-gradient(rgba(15,23,42,0.6), rgba(15,23,42,0.6)), radial-gradient(circle at 1px 1px,rgba(148,163,184,.06) 1px,transparent 0); background-size: 40px 40px; cursor: grab;">
597
- <svg id="mappingLines" class="absolute inset-0 w-full h-full pointer-events-none" style="z-index: 1;"></svg>
598
- <div id="mappingCardsContainer" class="absolute inset-0" style="z-index: 2;"></div>
599
- </div>
600
- <div class="mt-2 flex items-center gap-4 text-[0.6rem] text-slate-500">
601
- <span class="flex items-center gap-1"><i data-lucide="mouse-pointer-click" class="w-3 h-3"></i> Drag cards to move</span>
602
- <span class="flex items-center gap-1"><i data-lucide="pen-tool" class="w-3 h-3"></i> Click "connect" then click target card to draw line</span>
603
- <span class="flex items-center gap-1"><i data-lucide="text" class="w-3 h-3"></i> Click card text to edit</span>
604
- </div>
605
- </div>
606
  </div>
607
 
608
- <!-- NEWS GLOBE MODAL -->
609
- <div id="newsGlobeOverlay" class="globe-overlay">
610
- <div class="globe-top-bar">
611
- <div>
612
- <div class="flex items-center gap-2">
613
- <div class="w-7 h-7 rounded-lg bg-gradient-to-br from-brand-400 to-brand-600 flex items-center justify-center">
614
- <i data-lucide="globe" class="w-4 h-4 text-white"></i>
615
- </div>
616
- <div>
617
- <h2 class="text-sm font-semibold text-white">Global News Pulse</h2>
618
- <p class="text-[0.6rem] text-slate-500">Live sentiment from public news & social media</p>
619
- </div>
620
- </div>
621
- </div>
622
- <div class="flex items-center gap-3">
623
- <div class="glass-light rounded-lg px-3 py-1.5 text-xs text-slate-400 flex items-center gap-2">
624
- <span class="globe-pulse-dot"></span>
625
- <span id="globeStatusText">Loading data stream...</span>
626
- </div>
627
- <button id="globeSpinBtn" onclick="toggleGlobeSpin()" title="Pause / resume globe rotation" class="flex items-center gap-1.5 text-xs font-medium text-white hover:text-brand-100 transition-colors bg-brand-600/80 hover:bg-brand-500 rounded-lg px-3 py-1.5 shadow-md shadow-brand-500/10">
628
- <i data-lucide="pause" class="w-4 h-4"></i><span class="hidden sm:inline">Pause</span>
629
- </button>
630
- <button class="globe-close" onclick="closeNewsGlobe()" title="Close globe">
631
- <i data-lucide="x" class="w-4 h-4"></i>
632
- </button>
633
- </div>
634
- </div>
635
-
636
- <div class="globe-loading" id="globeLoading">
637
- <div class="w-12 h-12 rounded-full border-2 border-brand-400 border-t-transparent animate-spin"></div>
638
- <div class="globe-status" id="globeLoadingText">Initializing 3D globe...</div>
639
- </div>
640
-
641
  <div id="globeContainer" class="globe-canvas"></div>
642
-
643
- <!-- Tooltip -->
644
- <div id="globeTooltip" class="globe-tooltip glass rounded-xl px-4 py-3 border border-slate-700/50 hidden" style="max-width:280px;">
645
- <div class="flex items-center gap-2 mb-1.5">
646
- <span id="globeTooltipFlag" class="text-sm"></span>
647
- <span id="globeTooltipCountry" class="text-sm font-semibold text-white"></span>
648
- </div>
649
- <div class="flex items-center gap-3 mb-2">
650
- <div id="globeTooltipBarWrap" class="flex-1 h-1.5 rounded-full bg-slate-800 overflow-hidden">
651
- <div id="globeTooltipBar" class="h-full rounded-full transition-all" style="width:50%"></div>
652
- </div>
653
- <span id="globeTooltipScore" class="text-xs font-mono text-brand-300"></span>
654
- </div>
655
- <div class="space-y-1 text-[0.65rem] text-slate-400">
656
- <div class="flex justify-between"><span>Volume</span><span id="globeTooltipVolume" class="text-slate-300"></span></div>
657
- <div class="flex justify-between"><span>Sentiment</span><span id="globeTooltipSentiment" class=""></span></div>
658
- <div class="flex justify-between"><span>Top topic</span><span id="globeTooltipTopic" class="text-brand-300"></span></div>
659
- <div class="flex justify-between"><span>Trend</span><span id="globeTooltipTrend"></span></div>
660
- </div>
661
- </div>
662
-
663
- <!-- Bottom legend -->
664
- <div class="globe-legend glass rounded-xl p-3 border border-slate-700/50">
665
- <div class="text-[0.65rem] text-slate-500 mb-2 uppercase tracking-wider font-medium">Sentiment Scale</div>
666
- <div class="globe-legend-item"><span class="globe-legend-dot" style="background:#ef4444"></span>Critical (-80 to -40)</div>
667
- <div class="globe-legend-item"><span class="globe-legend-dot" style="background:#f97316"></span>Negative (-40 to -10)</div>
668
- <div class="globe-legend-item"><span class="globe-legend-dot" style="background:#eab308"></span>Neutral (-10 to +10)</div>
669
- <div class="globe-legend-item"><span class="globe-legend-dot" style="background:#22c55e"></span>Positive (+10 to +40)</div>
670
- <div class="globe-legend-item"><span class="globe-legend-dot" style="background:#06b6d4"></span>Excellent (+40 to +80)</div>
671
- <div class="mt-2 pt-2 border-t border-slate-700/30 text-[0.6rem] text-slate-500">
672
- Height = news volume · Color = sentiment · Click & drag to rotate
673
- </div>
674
- </div>
675
-
676
- <div class="globe-label glass rounded-xl p-3 border border-slate-700/50">
677
- <div class="text-[0.65rem] text-slate-500 mb-1 uppercase tracking-wider font-medium">Global Snapshot</div>
678
- <div id="globeGlobalStats" class="space-y-1 text-[0.65rem] text-slate-400">
679
- <div class="flex justify-between"><span>Countries tracked</span><span id="globeStatCountries" class="text-white">0</span></div>
680
- <div class="flex justify-between"><span>News articles</span><span id="globeStatArticles" class="text-white">0</span></div>
681
- <div class="flex justify-between"><span>Avg sentiment</span><span id="globeStatSentiment" class="text-white">0</span></div>
682
- <div class="flex justify-between"><span>Most active</span><span id="globeStatActive" class="text-brand-300">--</span></div>
683
- </div>
684
- </div>
685
- </div>
686
-
687
- <!-- "Explain this" tooltip style floating buttons for charts -->
688
- <div id="explainTooltip" class="fixed z-[55] hidden" style="pointer-events:none">
689
- <div class="glass-light rounded-lg px-2.5 py-1.5 text-xs text-brand-300 flex items-center gap-1.5 shadow-lg shadow-brand-500/10" style="pointer-events:auto">
690
- <i data-lucide="message-circle" class="w-3 h-3"></i>
691
- <span>Explain</span>
692
- </div>
693
  </div>
694
 
695
- <script src="/static/dataset_embed.js"></script>
696
- <script src="/static/app_v30.js"></script>
 
697
  </body>
698
- </html>
 
49
  @keyframes orbit{0%{transform:translate(6px,6px);opacity:.4}25%{transform:translate(0,12px);opacity:.8}50%{transform:translate(-6px,6px);opacity:.4}75%{transform:translate(0,0);opacity:.8}100%{transform:translate(6px,6px);opacity:.4}}
50
  .animate-orbit{animation:orbit 4s linear infinite}
51
  @keyframes breathe{0%,100%{transform:scale(1);opacity:.6}50%{transform:scale(1.15);opacity:1}}
52
+ .globe-overlay{position:fixed;inset:0;z-index:90;background:rgba(5,8,18,0.92);backdrop-filter:blur(40px);display:flex;flex-direction:column;opacity:0;pointer-events:none;transition:opacity .8s ease}
 
53
  .globe-overlay.open{opacity:1;pointer-events:auto}
54
  .globe-close{position:relative;z-index:100;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;background:rgba(15,23,42,0.7);border:1px solid rgba(34,211,238,0.15);color:#94a3b8;transition:all .3s;flex-shrink:0}
55
  .globe-close:hover{background:rgba(34,211,238,0.1);border-color:rgba(34,211,238,0.4);color:#22d3ee}
 
67
  @keyframes globePulse{0%,100%{opacity:.5;transform:scale(1)}50%{opacity:1;transform:scale(1.3)}}
68
  .globe-pulse-dot{width:8px;height:8px;border-radius:50%;background:#22d3ee;animation:globePulse 2s ease-in-out infinite}
69
  .globe-status{font-size:11px;color:#64748b;margin-top:8px}
 
70
  html.light-mode body{background:#f8fafc;color:#334155}
71
  html.light-mode .glass{background:rgba(255,255,255,0.75);border-color:rgba(148,163,184,0.2)}
72
  html.light-mode .glass-light{background:rgba(241,245,249,0.7);border-color:rgba(148,163,184,0.15)}
 
92
  </head>
93
  <body class="font-sans text-slate-300 min-h-screen bg-grid">
94
 
 
95
  <div id="landingOverlay" class="fixed inset-0 z-[70] bg-[#0a0e1a]/90 backdrop-blur-xl flex items-center justify-center p-4 transition-opacity duration-500">
96
  <div class="max-w-2xl w-full text-center">
 
97
  <div class="mb-8 fade-in" style="animation-delay:0.1s">
98
+ <div class="w-16 h-16 rounded-2xl bg-gradient-to-br from-brand-400 to-brand-600 flex items-center justify-center mx-auto mb-5 shadow-lg shadow-brand-500/20"><i data-lucide="compass" class="w-8 h-8 text-white"></i></div>
 
 
99
  <h1 class="text-3xl sm:text-4xl font-bold text-white tracking-tight mb-2">Global Insight Engine</h1>
100
  <p class="text-sm text-slate-400 max-w-md mx-auto leading-relaxed">Explore hidden relationships across 120+ development indicators. Load a dataset below or dive straight in.</p>
101
  </div>
 
 
102
  <div class="mb-8 fade-in" style="animation-delay:0.25s">
103
  <div class="text-[0.65rem] text-slate-500 mb-3 uppercase tracking-wider font-medium">Quick Start</div>
104
  <div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
105
+ <button onclick="dismissLanding('hdi_2022')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer"><div class="w-8 h-8 rounded-lg bg-blue-500/15 flex items-center justify-center mb-2 group-hover:bg-blue-500/25 transition-colors"><i data-lucide="users" class="w-4 h-4 text-blue-400"></i></div><div class="text-xs font-medium text-white mb-0.5">Human Development</div><div class="text-[0.6rem] text-slate-500">UNDP · 5 vars</div></button>
106
+ <button onclick="dismissLanding('happiness_2023')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer"><div class="w-8 h-8 rounded-lg bg-rose-500/15 flex items-center justify-center mb-2 group-hover:bg-rose-500/25 transition-colors"><i data-lucide="heart" class="w-4 h-4 text-rose-400"></i></div><div class="text-xs font-medium text-white mb-0.5">World Happiness</div><div class="text-[0.6rem] text-slate-500">UN SDSN · 8 vars</div></button>
107
+ <button onclick="dismissLanding('epi_2022')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer"><div class="w-8 h-8 rounded-lg bg-green-500/15 flex items-center justify-center mb-2 group-hover:bg-green-500/25 transition-colors"><i data-lucide="leaf" class="w-4 h-4 text-green-400"></i></div><div class="text-xs font-medium text-white mb-0.5">Environment</div><div class="text-[0.6rem] text-slate-500">Yale/Columbia · 6 vars</div></button>
108
+ <button onclick="dismissLanding('wb:economy')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer"><div class="w-8 h-8 rounded-lg bg-emerald-500/15 flex items-center justify-center mb-2 group-hover:bg-emerald-500/25 transition-colors"><i data-lucide="trending-up" class="w-4 h-4 text-emerald-400"></i></div><div class="text-xs font-medium text-white mb-0.5">Global Economy</div><div class="text-[0.6rem] text-slate-500">World Bank · 25 vars</div></button>
109
+ <button onclick="dismissLanding('innovation_2023')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer"><div class="w-8 h-8 rounded-lg bg-yellow-500/15 flex items-center justify-center mb-2 group-hover:bg-yellow-500/25 transition-colors"><i data-lucide="lightbulb" class="w-4 h-4 text-yellow-400"></i></div><div class="text-xs font-medium text-white mb-0.5">Innovation</div><div class="text-[0.6rem] text-slate-500">WIPO · 8 vars</div></button>
110
+ <button onclick="dismissLanding('peace_2023')" class="group glass-light rounded-xl p-4 text-left transition-all hover:bg-brand-500/5 hover:border-brand-500/20 border border-transparent cursor-pointer"><div class="w-8 h-8 rounded-lg bg-indigo-500/15 flex items-center justify-center mb-2 group-hover:bg-indigo-500/25 transition-colors"><i data-lucide="shield" class="w-4 h-4 text-indigo-400"></i></div><div class="text-xs font-medium text-white mb-0.5">Peace & Security</div><div class="text-[0.6rem] text-slate-500">IEP · 9 vars</div></button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  </div>
112
  </div>
 
 
113
  <div class="flex flex-col sm:flex-row items-center justify-center gap-3 fade-in" style="animation-delay:0.4s">
114
+ <button onclick="dismissLanding()" class="px-6 py-2.5 rounded-xl bg-brand-600/80 text-sm font-medium text-white hover:bg-brand-500 transition-colors shadow-lg shadow-brand-500/15">Get Started</button>
115
+ <button onclick="dismissLandingAndOpenSources()" class="px-6 py-2.5 rounded-xl glass-light text-sm font-medium text-slate-300 hover:text-white hover:bg-slate-700/50 transition-colors">Browse Full Library</button>
 
 
 
 
116
  </div>
117
  </div>
118
  </div>
119
 
120
  <div id="statusBar" class="status-bar glass border-b border-brand-500/20">
121
  <div class="max-w-[1920px] mx-auto px-4 py-2 flex items-center justify-between">
122
+ <div class="flex items-center gap-3"><div class="w-5 h-5 rounded-full border-2 border-brand-400 border-t-transparent animate-spin" id="statusSpinner"></div><div class="flex flex-col"><span id="statusText" class="text-sm text-brand-300 leading-tight">Initializing...</span><span id="statusMeta" class="text-[0.6rem] text-slate-500 font-mono leading-tight hidden">0.0s · <span id="statusStage">preparing</span></span></div></div>
123
+ <div class="flex items-center gap-3"><div id="statusLiveTicker" class="hidden text-[0.65rem] text-slate-500 font-mono overflow-hidden whitespace-nowrap max-w-[200px] sm:max-w-[320px]"><span id="tickerText" class="inline-block"></span></div><div class="w-24 sm:w-32 h-1 bg-slate-800 rounded-full overflow-hidden"><div id="statusProgress" class="h-full bg-gradient-to-r from-brand-400 to-brand-300 rounded-full transition-all" style="width:0%"></div></div><span id="statusPercent" class="text-xs text-slate-500 font-mono w-10 text-right">0%</span><button id="statusKillBtn" onclick="killLoad()" class="hidden w-6 h-6 rounded-md flex items-center justify-center bg-slate-800/80 hover:bg-red-500/20 hover:text-red-400 text-slate-500 transition-colors" title="Cancel"><i data-lucide="x" class="w-3.5 h-3.5"></i></button></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  </div>
125
  </div>
126
 
127
  <header class="glass sticky top-0 z-50">
128
  <div class="max-w-[1920px] mx-auto px-4 sm:px-6 py-3 flex items-center justify-between">
129
+ <div class="flex items-center gap-3"><div class="w-9 h-9 rounded-lg bg-gradient-to-br from-brand-400 via-brand-500 to-brand-600 flex items-center justify-center animate-logo-float" style="box-shadow:0 0 12px rgba(6,182,212,0.2)"><i data-lucide="compass" class="w-5 h-5 text-white drop-shadow-sm"></i></div><div><h1 class="text-lg font-bold text-white tracking-tight">Global Insight Engine</h1><p class="text-[0.65rem] text-slate-500 -mt-0.5">Data Platform</p></div></div>
130
+ <div class="flex items-center gap-2"><div class="hidden sm:flex items-center gap-2 px-3 py-1.5 rounded-full glass-light text-xs text-slate-400"><span class="w-2 h-2 rounded-full bg-emerald-400 pulse-dot"></span><span id="dataPointCount">Initializing...</span></div><button onclick="openNewsGlobe()" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-brand-600/80 hover:bg-brand-500 transition-colors shadow-md shadow-brand-500/10"><i data-lucide="globe" class="w-3.5 h-3.5"></i><span>Analyze Global Media</span></button><div class="relative"><button onclick="document.getElementById('exportMenu').classList.toggle('show')" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors"><i data-lucide="download" class="w-3.5 h-3.5"></i><span class="hidden sm:inline">Export</span></button><div id="exportMenu" class="export-menu"><button onclick="exportInsights('txt')"><i data-lucide="file-text" class="w-3.5 h-3.5 inline mr-2"></i>Text Report</button><button onclick="exportInsights('csv')"><i data-lucide="table" class="w-3.5 h-3.5 inline mr-2"></i>CSV Data</button><button onclick="exportInsights('png')"><i data-lucide="image" class="w-3.5 h-3.5 inline mr-2"></i>PNG Charts</button><button onclick="shareSession()"><i data-lucide="link" class="w-3.5 h-3.5 inline mr-2"></i>Copy Share Link</button></div></div><label class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors cursor-pointer"><i data-lucide="upload" class="w-3.5 h-3.5"></i><span class="hidden sm:inline">Upload</span><input type="file" accept=".json,.csv" class="hidden" onchange="handleFileUpload(event)"></label><button onclick="showDatasetBrowser()" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors"><i data-lucide="database" class="w-3.5 h-3.5"></i><span class="hidden sm:inline">Sources</span></button><button onclick="openChatbot('general')" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg glass-light text-xs text-slate-400 hover:text-white transition-colors group"><span class="relative flex items-center justify-center w-4 h-4"><i data-lucide="sparkles" class="w-3.5 h-3.5 text-brand-400 group-hover:text-brand-300 transition-colors"></i><span class="absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-brand-400 animate-breathe"></span></span><span class="hidden sm:inline">Guide</span></button></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  </div>
132
  </header>
133
 
134
+ <div class="max-w-[1920px] mx-auto px-4 sm:px-6 pt-4"><div class="flex items-center justify-between"><div id="tabBar" class="flex gap-2 overflow-x-auto pb-2 flex-1">
135
+ <button draggable="true" data-tab="explorer" id="tab-btn-explorer" class="tab-btn active px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="search" class="w-3.5 h-3.5"></i>Explorer</button>
136
+ <button draggable="true" data-tab="simulator" id="tab-btn-simulator" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="git-branch" class="w-3.5 h-3.5"></i>Simulator</button>
137
+ <button draggable="true" data-tab="discover" id="tab-btn-discover" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="sparkles" class="w-3.5 h-3.5"></i>Discover</button>
138
+ <button draggable="true" data-tab="compare" id="tab-btn-compare" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="columns-3" class="w-3.5 h-3.5"></i>Compare</button>
139
+ <button draggable="true" data-tab="decisions" id="tab-btn-decisions" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="sliders-horizontal" class="w-3.5 h-3.5"></i>Rank</button>
140
+ <button draggable="true" data-tab="benchmark" id="tab-btn-benchmark" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="user" class="w-3.5 h-3.5"></i>Profile</button>
141
+ <button draggable="true" data-tab="outliers" id="tab-btn-outliers" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="alert-triangle" class="w-3.5 h-3.5"></i>Outliers</button>
142
+ <button draggable="true" data-tab="mapping" id="tab-btn-mapping" class="tab-btn px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:text-white whitespace-nowrap flex items-center gap-1.5 cursor-move"><i data-lucide="grip-vertical" class="w-3 h-3 text-slate-600 mr-0.5 opacity-50 hover:opacity-100 transition-opacity tab-drag-handle"></i><i data-lucide="map" class="w-3.5 h-3.5"></i>Mapping</button>
143
+ </div><button onclick="toggleTheme()" id="themeToggle" class="ml-2 flex-shrink-0 w-8 h-8 rounded-lg glass-light flex items-center justify-center text-slate-400 hover:text-brand-300 transition-colors" title="Toggle theme"><i data-lucide="sun" class="w-3.5 h-3.5 theme-icon-light hidden"></i><i data-lucide="moon" class="w-3.5 h-3.5 theme-icon-dark"></i></button></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
 
145
  <div id="tab-explorer" class="tab-content max-w-[1920px] mx-auto flex flex-col lg:flex-row">
146
+ <aside class="w-full lg:w-80 xl:w-96 flex-shrink-0 glass border-r border-slate-800/50 lg:h-[calc(100vh-120px)] lg:overflow-y-auto lg:sticky lg:top-28"><div class="p-4"><div class="flex items-center justify-between mb-3"><h2 class="text-sm font-semibold text-white">Variables</h2><span class="text-[0.65rem] text-slate-500" id="varCount">Loading...</span></div><div class="relative mb-5"><i data-lucide="search" class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"></i><input type="text" id="varSearch" placeholder="Search variables..." class="w-full pl-9 pr-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700/50 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-brand-500/50 focus:ring-1 focus:ring-brand-500/20 transition-all" oninput="filterVariables()"></div><div class="mb-2"><div class="text-[0.65rem] text-slate-500 mb-2 uppercase tracking-wider font-medium">Browse by Category</div></div><div id="categoryGrid" class="grid grid-cols-2 gap-2 mb-2"></div><div id="clearCatWrap" class="hidden"><div class="clear-cat" onclick="clearCategoryFilter()">Clear selection</div></div><div id="variableList" class="space-y-1.5 mt-4 hidden"></div></div></aside>
147
+ <main class="flex-1 p-4 sm:p-6 space-y-6 min-w-0"><div id="emptyState" class="flex flex-col items-center justify-center py-20 text-center"><div class="w-20 h-20 rounded-2xl bg-gradient-to-br from-brand-400/20 to-brand-600/20 flex items-center justify-center mb-6"><i data-lucide="mouse-pointer-click" class="w-10 h-10 text-brand-400"></i></div><h2 class="text-2xl font-bold text-white mb-2">Select a Variable to Begin</h2><p class="text-slate-400 max-w-md">Search or browse categories to discover hidden relationships, spot outliers, and get actionable insights.</p></div><div id="resultsArea" class="hidden space-y-6"><div class="glass rounded-2xl p-6 fade-in"><div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"><div><div class="flex items-center gap-2 mb-2"><span id="heroCategory" class="text-[0.65rem] px-2 py-0.5 rounded-full bg-brand-500/20 text-brand-300 uppercase font-semibold tracking-wider"></span><span id="heroType" class="text-[0.65rem] px-2 py-0.5 rounded-full bg-slate-700/50 text-slate-400 uppercase font-semibold tracking-wider"></span></div><h2 id="heroName" class="text-2xl sm:text-3xl font-bold text-white mb-1"></h2><p id="heroDesc" class="text-sm text-slate-400 max-w-xl"></p></div><div class="flex gap-3"><div class="text-center px-4 py-2 rounded-xl glass-light"><div id="heroMean" class="text-xl font-bold stat-value font-mono"></div><div class="text-[0.6rem] text-slate-500 uppercase tracking-wider">Mean</div></div><div class="text-center px-4 py-2 rounded-xl glass-light"><div id="heroStd" class="text-xl font-bold stat-value font-mono"></div><div class="text-[0.6rem] text-slate-500 uppercase tracking-wider">Std Dev</div></div><div class="text-center px-4 py-2 rounded-xl glass-light"><div id="heroRange" class="text-xl font-bold stat-value font-mono"></div><div class="text-[0.6rem] text-slate-500 uppercase tracking-wider">Range</div></div></div></div></div>
148
+ <div id="narrativePanel" class="narrative-panel rounded-xl p-5 hidden fade-in"><div class="flex items-center gap-2 mb-3"><i data-lucide="message-square-plus" class="w-4 h-4 text-brand-400"></i><span class="text-xs font-semibold text-brand-300 uppercase tracking-wider">Narrative Insight</span></div><p id="narrativeText" class="text-sm text-slate-300 leading-relaxed"></p></div>
149
+ <div class="flex items-center justify-between"><div class="flex items-center gap-2" id="peerToggleContainer" style="display:none"><button onclick="setPeerMode('global')" id="peerGlobal" class="peer-toggle active">Global</button><button onclick="setPeerMode('regional')" id="peerRegional" class="peer-toggle">By Region</button></div></div>
150
+ <div id="riskOpportunityBanner" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div><div id="insightBanners" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div>
151
+ <div class="grid grid-cols-1 xl:grid-cols-2 gap-6"><div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="bar-chart-3" class="w-4 h-4 text-brand-400"></i>Distribution</h3><button onclick="openChatbotFor('distribution')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div><div class="h-64"><canvas id="distributionChart"></canvas></div></div><div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="network" class="w-4 h-4 text-brand-400"></i>Network</h3><button onclick="openChatbotFor('network')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div><div class="h-64 relative"><canvas id="networkCanvas" class="w-full h-full"></canvas></div></div></div>
152
+ <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-5"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="link" class="w-4 h-4 text-brand-400"></i>Correlations</h3><div class="flex gap-2"><button onclick="setCorrFilter('all')" id="filterAll" class="px-3 py-1 rounded-md text-xs bg-brand-500/20 text-brand-300 border border-brand-500/30">All</button><button onclick="setCorrFilter('positive')" id="filterPos" class="px-3 py-1 rounded-md text-xs bg-slate-800/50 text-slate-400 border border-slate-700/50 hover:border-slate-600">Positive</button><button onclick="setCorrFilter('negative')" id="filterNeg" class="px-3 py-1 rounded-md text-xs bg-slate-800/50 text-slate-400 border border-slate-700/50 hover:border-slate-600">Negative</button></div></div><div id="correlationBars" class="space-y-3"></div></div>
153
+ <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="scatter-chart" class="w-4 h-4 text-brand-400"></i>Explore</h3><div class="flex items-center gap-2"><select id="scatterVarSelect" onchange="updateScatterPlot()" class="px-3 py-1.5 rounded-lg bg-slate-800/80 border border-slate-700/50 text-sm text-white focus:outline-none focus:border-brand-500/50"></select><button onclick="openChatbotFor('scatter')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div></div><div class="h-80"><canvas id="scatterChart"></canvas></div></div>
154
+ <div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4 flex items-center gap-2"><i data-lucide="lightbulb" class="w-4 h-4 text-brand-400"></i>Insights</h3><div id="insightCards" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div></div>
155
+ <div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="grid-3x3" class="w-4 h-4 text-brand-400"></i>Heatmap</h3><button onclick="openChatbotFor('heatmap')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-3 h-3"></i>Explain</button></div><div class="overflow-x-auto"><canvas id="heatmapCanvas"></canvas></div></div></div></main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  </div>
157
 
158
+ <div id="tab-simulator" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6"><div class="glass rounded-2xl p-6"><h2 class="text-xl font-bold text-white mb-2 flex items-center gap-2"><i data-lucide="git-branch" class="w-5 h-5 text-brand-400"></i>Scenario Builder</h2><div class="grid grid-cols-1 lg:grid-cols-3 gap-6"><div class="lg:col-span-1 space-y-4"><div class="sim-scenario"><label class="block text-xs font-semibold text-white mb-2">Select Scenario Variable</label><select id="simVariable" onchange="initSimulator()" class="w-full px-3 py-2 rounded-lg bg-slate-800/80 border border-slate-700/50 text-sm text-white focus:outline-none focus:border-brand-500/50"></select></div><div class="sim-scenario"><div class="flex justify-between mb-1"><span class="text-xs text-slate-300" id="simLabel">Value</span><span class="text-xs font-mono text-brand-300" id="simValue">0</span></div><input type="range" id="simSlider" min="-50" max="50" value="0" class="slider-track w-full" oninput="runSimulation(this.value)"></div></div><div class="lg:col-span-2"><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white flex items-center gap-2 mb-4"><i data-lucide="arrow-left-right" class="w-4 h-4 text-brand-400"></i>Projected Impact</h3><div class="h-80"><canvas id="simChart"></canvas></div></div></div></div></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
+ <div id="tab-discover" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6"><div class="glass rounded-2xl p-6"><h2 class="text-xl font-bold text-white mb-2 flex items-center gap-2"><i data-lucide="sparkles" class="w-5 h-5 text-brand-400"></i>Unique Insights Discovery</h2><div id="gemList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"></div></div></div>
 
 
 
 
 
 
 
161
 
162
+ <div id="tab-compare" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6"><div class="glass rounded-2xl p-6"><h2 class="text-xl font-bold text-white mb-4 flex items-center gap-2"><i data-lucide="columns-3" class="w-5 h-5 text-brand-400"></i>Country Comparison</h2><div class="flex flex-wrap gap-2 mb-6"><select id="compareSelect" onchange="addCompareCountry(this.value);this.value=''" class="px-3 py-2 rounded-lg bg-slate-800/80 border border-slate-700/50 text-sm text-white focus:outline-none focus:border-brand-500/50"><option value="">+ Add country...</option></select></div><div id="compareTags" class="flex flex-wrap gap-2 mb-6"></div><div id="compareResults" class="hidden"><div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6"><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4"><i data-lucide="radar" class="w-4 h-4 text-brand-400"></i> Radar Comparison</h3><div class="h-80"><canvas id="compareRadarCanvas"></canvas></div></div><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4"><i data-lucide="bar-chart-3" class="w-4 h-4 text-brand-400"></i> Side-by-Side</h3><div id="compareTable" class="overflow-x-auto max-h-80"></div></div></div><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4"><i data-lucide="arrow-left-right" class="w-4 h-4 text-brand-400"></i> Difference Heatmap</h3><div class="overflow-x-auto"><canvas id="compareHeatmapCanvas"></canvas></div></div></div><div id="compareEmpty" class="text-center py-12"><p class="text-slate-500 text-sm">Select at least two countries to compare.</p></div></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
+ <div id="tab-decisions" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6"><div class="glass rounded-2xl p-6"><div class="flex items-center justify-between mb-4"><h2 class="text-xl font-bold text-white flex items-center gap-2"><i data-lucide="sliders-horizontal" class="w-5 h-5 text-brand-400"></i>Rank</h2><button onclick="openChatbotFor('decisions')" class="explain-chart-btn px-2.5 py-1.5 rounded-md glass-light text-[0.65rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1.5"><i data-lucide="message-circle" class="w-3 h-3"></i>How this works</button></div><div class="grid grid-cols-1 lg:grid-cols-3 gap-6"><div class="space-y-4"><div class="flex justify-between items-center"><span class="text-xs font-semibold text-white">Priorities</span><div class="flex items-center gap-2"><button onclick="openChatbotFor('weight-sliders')" class="explain-chart-btn px-2 py-1 rounded-md glass-light text-[0.6rem] text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all flex items-center gap-1"><i data-lucide="message-circle" class="w-2.5 h-2.5"></i>Explain sliders</button><button onclick="resetWeights()" class="text-[0.65rem] text-brand-400 hover:text-brand-300 transition-colors">Reset</button></div></div><div id="weightSliders" class="space-y-3"></div><div class="p-3 rounded-lg glass-light"><div class="flex justify-between mb-1"><span class="text-[0.65rem] text-slate-500">Total Weight</span><span class="text-xs font-mono text-brand-300" id="weightTotalText">100%</span></div><div class="w-full h-2 rounded-full bg-slate-800 mt-1"><div id="weightTotalBar" class="h-full bg-brand-500 rounded-full transition-all" style="width:100%"></div></div></div></div><div class="lg:col-span-2 space-y-6"><div class="glass rounded-2xl p-5"><div class="flex items-center justify-between mb-4"><h3 class="text-sm font-semibold text-white flex items-center gap-2"><i data-lucide="trophy" class="w-4 h-4 text-brand-400"></i>Top Recommendations</h3></div><div id="decisionResults" class="space-y-3"></div></div><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white flex items-center gap-2 mb-4"><i data-lucide="radar" class="w-4 h-4 text-brand-400"></i>Radar</h3><div class="h-80"><canvas id="radarChart"></canvas></div></div></div></div></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
+ <div id="tab-benchmark" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6"><div class="glass rounded-2xl p-6"><h2 class="text-xl font-bold text-white mb-4 flex items-center gap-2"><i data-lucide="user" class="w-5 h-5 text-brand-400"></i>My Profile</h2><div class="grid grid-cols-1 lg:grid-cols-2 gap-6"><div class="space-y-4"><div class="flex justify-between items-center"><span class="text-xs font-semibold text-white">Your Values</span><select id="benchmarkCountrySelect" onchange="fillBenchmarkFromCountry()" class="px-2 py-1 rounded bg-slate-800/80 text-xs text-white border border-slate-700/50 focus:outline-none focus:border-brand-500/50"><option value="">-- Pick a country proxy --</option></select></div><div id="benchmarkInputs" class="grid grid-cols-1 sm:grid-cols-2 gap-3"></div><button onclick="calculateBenchmark()" class="w-full py-2.5 rounded-lg bg-brand-600/80 text-sm text-white hover:bg-brand-500 transition-colors flex items-center justify-center gap-2"><i data-lucide="activity" class="w-4 h-4"></i>Analyze Profile</button></div><div id="benchmarkResults" class="hidden space-y-4"><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4"><i data-lucide="percent" class="w-4 h-4 text-brand-400"></i> Percentiles</h3><div id="percentileBars" class="space-y-3"></div></div><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4"><i data-lucide="map-pin" class="w-4 h-4 text-brand-400"></i> Closest Match</h3><div id="closestMatch"></div></div><div class="glass rounded-2xl p-5"><h3 class="text-sm font-semibold text-white mb-4"><i data-lucide="target" class="w-4 h-4 text-brand-400"></i> Priority Actions</h3><div id="priorityActions" class="space-y-2"></div></div></div></div></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
+ <div id="tab-outliers" class="tab-content hidden max-w-[1920px] mx-auto p-4 sm:p-6"><div class="glass rounded-2xl p-6"><h2 class="text-xl font-bold text-white mb-4 flex items-center gap-2"><i data-lucide="alert-triangle" class="w-5 h-5 text-brand-400"></i>Outlier Spotlight</h2><div id="outlierList" class="grid grid-cols-1 md:grid-cols-2 gap-4"></div></div></div>
 
 
 
 
 
 
169
 
170
+ <div id="datasetModal" class="fixed inset-0 z-50 hidden items-center justify-center bg-black/60 backdrop-blur-sm p-4" onclick="if(event.target===this)closeDatasetModal()"><div class="glass rounded-2xl w-full max-w-5xl max-h-[85vh] overflow-hidden flex flex-col"><div class="flex items-center justify-between p-5 border-b border-slate-700/50"><h3 class="text-lg font-bold text-white flex items-center gap-2"><i data-lucide="database" class="w-5 h-5 text-brand-400"></i>Dataset Explorer</h3><button onclick="closeDatasetModal()" class="w-8 h-8 rounded-lg flex items-center justify-center hover:bg-slate-700/50 transition-colors"><i data-lucide="x" class="w-4 h-4 text-slate-400"></i></button></div><div class="overflow-auto p-5 flex-1"><table class="text-xs w-full min-w-[800px] border-collapse"><thead id="datasetThead" class="sticky top-0 bg-slate-900/90"></thead><tbody id="datasetTbody"></tbody></table></div></div></div>
 
 
 
 
 
 
 
 
 
 
171
 
 
172
  <div id="chatbotPanel" class="fixed inset-y-0 right-0 w-full sm:w-[480px] z-[80] transform translate-x-full transition-transform duration-500 ease-out flex flex-col" style="background:rgba(10,14,26,0.92);backdrop-filter:blur(24px);border-left:1px solid rgba(34,211,238,0.08)">
173
+ <div class="flex items-center justify-between p-5 border-b border-slate-700/30"><div class="flex items-center gap-3"><div class="w-8 h-8 rounded-lg bg-gradient-to-br from-brand-400 to-brand-600 flex items-center justify-center"><i data-lucide="sparkles" class="w-4 h-4 text-white"></i></div><div><div class="text-sm font-semibold text-white">Insight Guide</div><div class="text-[0.65rem] text-slate-500 flex items-center gap-1.5"><span class="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-breathe"></span>Ready to help</div></div></div><button onclick="closeChatbot()" class="w-8 h-8 rounded-lg flex items-center justify-center hover:bg-slate-700/50 transition-colors"><i data-lucide="x" class="w-4 h-4 text-slate-400"></i></button></div>
174
+ <div class="px-5 pt-3 pb-1"><div id="chatbotContextPill" class="hidden inline-flex items-center gap-2 px-3 py-1.5 rounded-full glass-light text-xs text-slate-400"><i data-lucide="target" class="w-3 h-3 text-brand-400"></i><span id="chatbotContextText">Looking at: GDP per Capita</span></div></div>
175
+ <div id="chatbotMessages" class="flex-1 overflow-y-auto px-5 py-4 space-y-4"><div class="flex gap-3"><div class="w-7 h-7 rounded-lg bg-gradient-to-br from-brand-400 to-brand-600 flex-shrink-0 flex items-center justify-center mt-0.5"><i data-lucide="sparkles" class="w-3.5 h-3.5 text-white"></i></div><div class="space-y-2"><p class="text-sm text-slate-300 leading-relaxed">Hi! I'm your <strong class="text-brand-300">Insight Guide</strong>. Click "Explain" on any chart or ask me anything.</p></div></div></div>
176
+ <div id="chatbotQuickChips" class="px-5 pb-2 flex flex-wrap gap-2"><button onclick="sendChatbotMessage('What are the most interesting insights?')" class="px-3 py-1.5 rounded-full glass-light text-xs text-slate-400 hover:text-brand-300 hover:border-brand-500/20 border border-transparent transition-all">Interesting insights</button></div>
177
+ <div class="border-t border-slate-700/30 p-4"><div class="flex gap-2"><input id="chatbotInput" type="text" placeholder="Ask me anything about the data..." class="flex-1 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700/50 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-brand-500/50" onkeydown="if(event.key==='Enter')sendChatbotMessage()"><button onclick="sendChatbotMessage()" class="px-4 py-2.5 rounded-lg bg-brand-600/80 text-sm text-white hover:bg-brand-500 transition-colors flex items-center gap-2"><i data-lucide="send" class="w-4 h-4"></i></button></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </div>
179
 
180
+ <!-- GLOBE OVERLAY -->
181
+ <div id="globeOverlay" class="globe-overlay">
182
+ <div class="globe-top-bar"><div class="flex items-center gap-3"><div class="text-sm font-semibold text-white">Global Media Pulse</div><div class="text-[0.65rem] text-slate-400" id="globeArticleCount"></div></div><button onclick="closeNewsGlobe()" class="globe-close"><i data-lucide="x" class="w-4 h-4"></i></button></div>
183
+ <div id="globeLoading" class="globe-loading"><div class="globe-pulse-dot"></div><div class="globe-status">Loading sentiment data...</div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  <div id="globeContainer" class="globe-canvas"></div>
185
+ <div id="globeTooltip" class="globe-tooltip" style="opacity:0"><div class="glass rounded-xl px-4 py-3"><div id="globeCountry" class="text-sm font-semibold text-white"></div><div id="globeSentiment" class="text-xs text-slate-400 mt-1"></div></div></div>
186
+ <div class="globe-label"><div class="text-xs text-slate-500 mb-1">Real-time Sentiment</div><div class="text-sm font-semibold text-white">News Sentiment Globe</div><div class="text-[0.6rem] text-slate-500 mt-1">Dots = countries sized by article volume. Color = sentiment polarity.</div></div>
187
+ <div class="globe-legend"><div class="globe-legend-item"><div class="globe-legend-dot" style="background:#22d3ee"></div>Positive</div><div class="globe-legend-item"><div class="globe-legend-dot" style="background:#f43f5e"></div>Negative</div><div class="globe-legend-item"><div class="globe-legend-dot" style="background:#94a3b8"></div>Neutral</div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  </div>
189
 
190
+ <script src="/app_v35.js"></script>
191
+ <script src="/globe_patch.js"></script>
192
+ <script>document.addEventListener('DOMContentLoaded',function(){if(window.init)init();lucide.createIcons();});</script>
193
  </body>
194
+ </html>