Ahmad140 commited on
Commit
6d49e80
·
verified ·
1 Parent(s): f69b06b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +205 -464
index.html CHANGED
@@ -2,483 +2,224 @@
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
6
- <title>Elite Visuals AI | Smart Assistant</title>
7
- <!-- Font Awesome 6 -->
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
- <!-- Google Fonts -->
10
- <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&display=swap" rel="stylesheet">
11
  <style>
12
- * {
13
- margin: 0;
14
- padding: 0;
15
- box-sizing: border-box;
16
- }
17
- body {
18
- background: linear-gradient(135deg, #f5f7fa 0%, #e9eef5 100%);
19
- font-family: 'Inter', sans-serif;
20
- height: 100vh;
21
- width: 100%;
22
- overflow-x: hidden;
23
- }
24
- /* --- Floating Chat Icon (pulse) --- */
25
- .chat-icon {
26
- position: fixed;
27
- bottom: 28px;
28
- right: 28px;
29
- width: 64px;
30
- height: 64px;
31
- background: linear-gradient(145deg, #25D366, #128C7E);
32
- border-radius: 50%;
33
- display: flex;
34
- align-items: center;
35
- justify-content: center;
36
- cursor: pointer;
37
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(37, 211, 102, 0.5);
38
- transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
39
- z-index: 1000;
40
- animation: pulse 1.8s infinite;
41
- }
42
- @keyframes pulse {
43
- 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
44
- 70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
45
- 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
46
- }
47
- .chat-icon:hover {
48
- transform: scale(1.08) rotate(5deg);
49
- background: linear-gradient(145deg, #20b859, #0e6b5e);
50
- box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
51
- }
52
  .chat-icon i { font-size: 32px; color: white; }
53
-
54
- /* --- Chat Modal --- */
55
- .chat-modal {
56
- position: fixed;
57
- bottom: 100px;
58
- right: 28px;
59
- width: 400px;
60
- height: 620px;
61
- background: rgba(255, 255, 255, 0.98);
62
- backdrop-filter: blur(10px);
63
- border-radius: 28px;
64
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
65
- display: none;
66
- flex-direction: column;
67
- overflow: hidden;
68
- z-index: 1001;
69
- animation: slideUpFade 0.3s ease-out;
70
- }
71
- @keyframes slideUpFade {
72
- from { opacity: 0; transform: translateY(30px) scale(0.95); }
73
- to { opacity: 1; transform: translateY(0) scale(1); }
74
- }
75
- .chat-header {
76
- background: linear-gradient(135deg, #075E54, #0b3b32);
77
- color: white;
78
- padding: 16px 20px;
79
- display: flex;
80
- justify-content: space-between;
81
- align-items: center;
82
- }
83
- .chat-header h3 {
84
- font-weight: 600;
85
- font-size: 1.1rem;
86
- display: flex;
87
- align-items: center;
88
- gap: 8px;
89
- }
90
- .close-btn {
91
- background: rgba(255,255,255,0.2);
92
- border: none;
93
- color: white;
94
- width: 32px;
95
- height: 32px;
96
- border-radius: 50%;
97
- cursor: pointer;
98
- transition: 0.2s;
99
- }
100
- .close-btn:hover {
101
- background: rgba(255,255,255,0.4);
102
- transform: rotate(90deg);
103
- }
104
- .chat-messages {
105
- flex: 1;
106
- padding: 16px;
107
- overflow-y: auto;
108
- background: #f0f2f5;
109
- display: flex;
110
- flex-direction: column;
111
- gap: 12px;
112
- }
113
- /* --- Service Info Widget (Collapsible, inside chat) --- */
114
- .service-widget {
115
- background: white;
116
- border-radius: 20px;
117
- margin-bottom: 8px;
118
- overflow: hidden;
119
- box-shadow: 0 2px 8px rgba(0,0,0,0.05);
120
- transition: all 0.2s;
121
- }
122
- .widget-header {
123
- background: linear-gradient(135deg, #1e2a3a, #0f172a);
124
- color: white;
125
- padding: 12px 16px;
126
- display: flex;
127
- justify-content: space-between;
128
- align-items: center;
129
- cursor: pointer;
130
- font-weight: 600;
131
- }
132
- .widget-header i {
133
- transition: transform 0.2s;
134
- }
135
- .widget-content {
136
- padding: 16px;
137
- display: none;
138
- background: #ffffff;
139
- border-top: 1px solid #e2e8f0;
140
- max-height: 350px;
141
- overflow-y: auto;
142
- }
143
- .widget-content.show {
144
- display: block;
145
- }
146
- .package-card {
147
- background: #f8fafc;
148
- border-radius: 16px;
149
- padding: 12px;
150
- margin-bottom: 12px;
151
- border-left: 4px solid #25D366;
152
- }
153
- .package-card h4 {
154
- margin: 0 0 6px 0;
155
- color: #075E54;
156
- }
157
- .package-card p {
158
- font-size: 0.8rem;
159
- margin: 4px 0;
160
- }
161
- .extra-note {
162
- background: #fff3cd;
163
- padding: 10px;
164
- border-radius: 12px;
165
- font-size: 0.8rem;
166
- border-left: 4px solid #ffc107;
167
- margin-top: 8px;
168
- }
169
- .service-list {
170
- display: flex;
171
- flex-wrap: wrap;
172
- gap: 8px;
173
- margin: 10px 0;
174
- }
175
- .service-tag {
176
- background: #e4e6eb;
177
- padding: 4px 12px;
178
- border-radius: 20px;
179
- font-size: 0.7rem;
180
- font-weight: 500;
181
- }
182
- /* --- Messages --- */
183
- .message {
184
- max-width: 85%;
185
- padding: 10px 14px;
186
- border-radius: 22px;
187
- font-size: 0.9rem;
188
- line-height: 1.45;
189
- white-space: pre-line;
190
- word-wrap: break-word;
191
- animation: messagePop 0.25s ease-out;
192
- }
193
- @keyframes messagePop {
194
- from { opacity: 0; transform: translateY(8px) scale(0.96); }
195
- to { opacity: 1; transform: translateY(0) scale(1); }
196
- }
197
- .user-msg {
198
- background: #DCF8C6;
199
- margin-left: auto;
200
- border-bottom-right-radius: 6px;
201
- }
202
- .bot-msg {
203
- background: white;
204
- margin-right: auto;
205
- border-bottom-left-radius: 6px;
206
- box-shadow: 0 2px 6px rgba(0,0,0,0.05);
207
- }
208
- .questions-container {
209
- display: flex;
210
- flex-wrap: wrap;
211
- gap: 10px;
212
- margin: 8px 0;
213
- }
214
- .question-bubble {
215
- background: #e4e6eb;
216
- color: #1f2a3e;
217
- padding: 8px 14px;
218
- border-radius: 30px;
219
- font-size: 0.75rem;
220
- font-weight: 500;
221
- cursor: pointer;
222
- transition: 0.2s;
223
- }
224
- .question-bubble:hover {
225
- background: #d1d4db;
226
- transform: translateY(-2px) scale(1.02);
227
- }
228
- .typing-indicator {
229
- background: white;
230
- padding: 10px 16px;
231
- border-radius: 24px;
232
- display: inline-flex;
233
- align-items: center;
234
- gap: 6px;
235
- width: fit-content;
236
- }
237
- .typing-indicator span {
238
- width: 8px;
239
- height: 8px;
240
- background: #888;
241
- border-radius: 50%;
242
- display: inline-block;
243
- animation: typingWave 1.2s infinite ease-in-out both;
244
- }
245
- .typing-indicator span:nth-child(1) { animation-delay: 0s; }
246
- .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
247
- .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
248
- @keyframes typingWave {
249
- 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
250
- 30% { transform: translateY(-6px); opacity: 1; }
251
- }
252
- .chat-input-area {
253
- display: flex;
254
- padding: 14px;
255
- background: white;
256
- border-top: 1px solid #e2e8f0;
257
- gap: 10px;
258
- }
259
- .chat-input-area input {
260
- flex: 1;
261
- padding: 12px 16px;
262
- border: 1px solid #cbd5e1;
263
- border-radius: 40px;
264
- outline: none;
265
- }
266
- .chat-input-area input:focus {
267
- border-color: #25D366;
268
- box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
269
- }
270
- .chat-input-area button {
271
- background: #25D366;
272
- border: none;
273
- color: white;
274
- width: 44px;
275
- height: 44px;
276
- border-radius: 50%;
277
- cursor: pointer;
278
- transition: 0.2s;
279
- }
280
- .chat-input-area button:hover {
281
- background: #128C7E;
282
- transform: scale(1.05);
283
- }
284
- .chat-messages::-webkit-scrollbar { width: 5px; }
285
- .chat-messages::-webkit-scrollbar-track { background: #e0e4e8; border-radius: 5px; }
286
- .chat-messages::-webkit-scrollbar-thumb { background: #aaa; border-radius: 5px; }
287
  </style>
288
  </head>
289
  <body>
290
-
291
- <!-- Floating Chat Icon -->
292
- <div class="chat-icon" id="chatIcon">
293
- <i class="fas fa-comment-dots"></i>
294
- </div>
295
-
296
- <!-- Chat Modal -->
297
- <div class="chat-modal" id="chatModal">
298
- <div class="chat-header">
299
- <h3><i class="fas fa-robot"></i> Elite Visuals AI</h3>
300
- <button class="close-btn" id="closeChat"><i class="fas fa-times"></i></button>
301
- </div>
302
- <div class="chat-messages" id="chatMessages">
303
- <!-- Welcome message (static) -->
304
- <div class="message bot-msg">✨ Assalam-o-Alaikum! I'm Elite Visuals AI assistant. Ask me about websites, e‑commerce, SEO, chatbots & more. Extra features? I'll tell you price/timeline increase!</div>
305
-
306
- <!-- VISUAL SERVICE WIDGET (collapsible, inside chat) -->
307
- <div class="service-widget" id="serviceWidget">
308
- <div class="widget-header" id="widgetHeader">
309
- <span><i class="fas fa-crown"></i> 📦 Services & Pricing (click to expand)</span>
310
- <i class="fas fa-chevron-down" id="toggleIcon"></i>
311
- </div>
312
- <div class="widget-content" id="widgetContent">
313
- <!-- Basic Package -->
314
- <div class="package-card">
315
- <h4>✅ Basic Website</h4>
316
- <p><strong>💰 Price:</strong> PKR 50,000</p>
317
- <p><strong>⏱️ Timeline:</strong> 7-10 working days</p>
318
- <p><strong>📌 Includes:</strong> 5 pages, mobile responsive, basic SEO, contact form, social media links.</p>
319
- </div>
320
- <!-- Standard Package -->
321
- <div class="package-card">
322
- <h4>⭐ Standard Website</h4>
323
- <p><strong>💰 Price:</strong> PKR 1,20,000</p>
324
- <p><strong>⏱️ Timeline:</strong> 15-20 working days</p>
325
- <p><strong>📌 Includes:</strong> 10 pages, CMS (WordPress/custom), advanced SEO, blog integration, chatbot, 1 month free support.</p>
326
- </div>
327
- <!-- Premium Package -->
328
- <div class="package-card">
329
- <h4>🏆 Premium Website</h4>
330
- <p><strong>💰 Price:</strong> PKR 2,50,000</p>
331
- <p><strong>⏱️ Timeline:</strong> 25-30 working days</p>
332
- <p><strong>📌 Includes:</strong> Unlimited pages, e‑commerce, payment gateway, user accounts, custom animations, database, 6 months support, training.</p>
333
- </div>
334
- <div class="service-list">
335
- <span class="service-tag">🛒 E‑commerce</span>
336
- <span class="service-tag">🔍 SEO</span>
337
- <span class="service-tag">🤖 Chatbot</span>
338
- <span class="service-tag">🖌️ Graphic Design</span>
339
- <span class="service-tag">📱 Digital Marketing</span>
340
- <span class="service-tag">🛠️ Maintenance</span>
341
- </div>
342
- <div class="extra-note">
343
- <strong>⚠️ Extra Requirements?</strong><br>
344
- Agar aap basic package mein extra features chahoge (live chat, booking system, multi‑language, custom backend, etc.) to <strong>price aur timeline increase</strong> hogi. Hum custom quote denge. Chat mein pooch sakte hain!
345
- </div>
346
- </div>
347
  </div>
348
-
349
- <!-- Default Questions Bubbles -->
350
- <div id="defaultQuestionsContainer" class="questions-container"></div>
351
- </div>
352
- <div class="chat-input-area">
353
- <input type="text" id="userInput" placeholder="Type your question...">
354
- <button id="sendBtn"><i class="fas fa-paper-plane"></i></button>
355
  </div>
 
356
  </div>
 
 
 
 
 
357
 
358
- <script>
359
- // Session ID
360
- let sessionId = localStorage.getItem('chat_session_id');
361
- if (!sessionId) {
362
- sessionId = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 8);
363
- localStorage.setItem('chat_session_id', sessionId);
364
- }
365
- const API_URL = "/api/chat";
366
-
367
- // Default questions (including extra features examples)
368
- const DEFAULT_QUESTIONS = [
369
- "📞 Contact number?",
370
- "💰 Basic website package price & timeline?",
371
- "📦 What's included in Standard package?",
372
- "🛒 Do you build e‑commerce websites?",
373
- "⚡ Extra features like live chat – cost increase?",
374
- "🔍 SEO services available?",
375
- "➕ I want multi‑language website – extra price?"
376
- ];
377
-
378
- // DOM elements
379
- const chatIcon = document.getElementById('chatIcon');
380
- const chatModal = document.getElementById('chatModal');
381
- const closeChat = document.getElementById('closeChat');
382
- const sendBtn = document.getElementById('sendBtn');
383
- const userInput = document.getElementById('userInput');
384
- const chatMessages = document.getElementById('chatMessages');
385
- const questionsContainer = document.getElementById('defaultQuestionsContainer');
386
-
387
- // Service widget collapsible
388
- const widgetHeader = document.getElementById('widgetHeader');
389
- const widgetContent = document.getElementById('widgetContent');
390
- const toggleIcon = document.getElementById('toggleIcon');
391
- let widgetOpen = false;
392
-
393
- widgetHeader.addEventListener('click', () => {
394
- if (widgetOpen) {
395
- widgetContent.classList.remove('show');
396
- toggleIcon.classList.remove('fa-chevron-up');
397
- toggleIcon.classList.add('fa-chevron-down');
398
- widgetOpen = false;
399
- } else {
400
- widgetContent.classList.add('show');
401
- toggleIcon.classList.remove('fa-chevron-down');
402
- toggleIcon.classList.add('fa-chevron-up');
403
- widgetOpen = true;
 
 
 
 
 
 
 
 
 
 
 
 
404
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  });
406
-
407
- // Render question bubbles
408
- function renderQuestionBubbles() {
409
- questionsContainer.innerHTML = '';
410
- DEFAULT_QUESTIONS.forEach(q => {
411
- const bubble = document.createElement('div');
412
- bubble.className = 'question-bubble';
413
- bubble.innerText = q;
414
- bubble.onclick = () => {
415
- userInput.value = q.replace(/^[📞💰📦🛒⚡🔍➕]\s*/, '');
416
- sendMessage();
417
- };
418
- questionsContainer.appendChild(bubble);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  });
420
- }
421
-
422
- // Add message to chat
423
- function addMessage(text, sender) {
424
- const div = document.createElement('div');
425
- div.className = `message ${sender === 'user' ? 'user-msg' : 'bot-msg'}`;
426
- div.innerText = text;
427
- chatMessages.appendChild(div);
428
- chatMessages.scrollTop = chatMessages.scrollHeight;
429
- }
430
-
431
- // Typing indicator
432
- let typingDiv = null;
433
- function showTyping() {
434
- if (typingDiv) return;
435
- typingDiv = document.createElement('div');
436
- typingDiv.className = 'typing-indicator';
437
- typingDiv.innerHTML = '<span></span><span></span><span></span>';
438
- chatMessages.appendChild(typingDiv);
439
- chatMessages.scrollTop = chatMessages.scrollHeight;
440
- }
441
- function hideTyping() {
442
- if (typingDiv) {
443
- typingDiv.remove();
444
- typingDiv = null;
445
- }
446
- }
447
-
448
- // Send message to backend
449
- async function sendMessage() {
450
- const msg = userInput.value.trim();
451
- if (!msg) return;
452
- if (questionsContainer) questionsContainer.style.display = 'none';
453
- addMessage(msg, 'user');
454
- userInput.value = '';
455
- showTyping();
456
- try {
457
- const res = await fetch(API_URL, {
458
- method: 'POST',
459
- headers: { 'Content-Type': 'application/json' },
460
- body: JSON.stringify({ message: msg, session_id: sessionId })
461
- });
462
- const data = await res.json();
463
- hideTyping();
464
- addMessage(data.reply, 'bot');
465
- } catch (err) {
466
- hideTyping();
467
- addMessage("❌ Server error. Please try again later.", 'bot');
468
- console.error(err);
469
  }
470
- }
471
-
472
- // Event listeners
473
- chatIcon.onclick = () => {
474
- chatModal.style.display = 'flex';
475
- if (questionsContainer.children.length === 0) renderQuestionBubbles();
476
- };
477
- closeChat.onclick = () => chatModal.style.display = 'none';
478
- sendBtn.onclick = sendMessage;
479
- userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') sendMessage(); });
480
-
481
- renderQuestionBubbles();
482
- </script>
 
 
483
  </body>
484
  </html>
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Elite Visuals AI | Dynamic Quote</title>
 
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
 
9
  <style>
10
+ * { margin: 0; padding: 0; box-sizing: border-box; }
11
+ body { background: linear-gradient(135deg, #f5f7fa 0%, #e9eef5 100%); font-family: 'Inter', sans-serif; height: 100vh; overflow: hidden; }
12
+ .chat-icon { position: fixed; bottom: 28px; right: 28px; width: 64px; height: 64px; background: linear-gradient(145deg, #25D366, #128C7E); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: pulse 1.8s infinite; z-index: 1000; }
13
+ @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,0.5); } 70% { box-shadow: 0 0 0 15px rgba(37,211,102,0); } 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); } }
14
+ .chat-icon:hover { transform: scale(1.08); background: #20b859; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  .chat-icon i { font-size: 32px; color: white; }
16
+ .chat-modal { position: fixed; bottom: 100px; right: 28px; width: 420px; height: 620px; background: rgba(255,255,255,0.98); border-radius: 28px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35); display: none; flex-direction: column; overflow: hidden; z-index: 1001; animation: slideUpFade 0.3s ease-out; }
17
+ @keyframes slideUpFade { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
18
+ .chat-header { background: linear-gradient(135deg, #075E54, #0b3b32); color: white; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
19
+ .close-btn { background: rgba(255,255,255,0.2); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: white; }
20
+ .chat-messages { flex: 1; padding: 16px; overflow-y: auto; background: #f0f2f5; display: flex; flex-direction: column; gap: 8px; }
21
+ .message { max-width: 85%; padding: 10px 14px; border-radius: 22px; font-size: 0.9rem; line-height: 1.45; white-space: pre-line; animation: fadeIn 0.2s; }
22
+ @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
23
+ .user-msg { background: #DCF8C6; margin-left: auto; border-bottom-right-radius: 6px; }
24
+ .bot-msg { background: white; margin-right: auto; border-bottom-left-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
25
+
26
+ /* DYNAMIC INFO WIDGET (LIVE QUOTE) */
27
+ .live-widget { background: white; border-radius: 20px; margin: 8px 0; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
28
+ .widget-header { background: linear-gradient(135deg, #1e2a3a, #0f172a); color: white; padding: 10px 16px; display: flex; justify-content: space-between; cursor: pointer; font-weight: 600; }
29
+ .widget-content { padding: 16px; display: none; background: #fef9e6; border-top: 2px solid #25D366; }
30
+ .widget-content.show { display: block; }
31
+ .info-row { margin: 8px 0; font-size: 0.85rem; }
32
+ .info-label { font-weight: 700; color: #075E54; }
33
+ .features-list { margin-left: 20px; margin-top: 5px; }
34
+
35
+ .questions-container { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
36
+ .question-bubble { background: #e4e6eb; padding: 6px 12px; border-radius: 20px; font-size: 0.7rem; cursor: pointer; transition: 0.2s; }
37
+ .question-bubble:hover { background: #d1d4db; transform: translateY(-2px); }
38
+ .typing-indicator { background: white; padding: 8px 12px; border-radius: 20px; display: inline-flex; gap: 5px; width: fit-content; }
39
+ .typing-indicator span { width: 8px; height: 8px; background: #888; border-radius: 50%; animation: wave 1.2s infinite; }
40
+ @keyframes wave { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
41
+ .chat-input-area { display: flex; padding: 12px; background: white; border-top: 1px solid #ddd; gap: 8px; }
42
+ .chat-input-area input { flex: 1; padding: 10px 15px; border: 1px solid #ccc; border-radius: 30px; outline: none; }
43
+ .chat-input-area button { background: #25D366; border: none; width: 42px; height: 42px; border-radius: 50%; color: white; cursor: pointer; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  </style>
45
  </head>
46
  <body>
47
+ <div class="chat-icon" id="chatIcon"><i class="fas fa-comment-dots"></i></div>
48
+ <div class="chat-modal" id="chatModal">
49
+ <div class="chat-header"><h3><i class="fas fa-robot"></i> Elite Visuals AI</h3><button class="close-btn" id="closeChat"><i class="fas fa-times"></i></button></div>
50
+ <div class="chat-messages" id="chatMessages">
51
+ <div class="message bot-msg">✨ Assalam-o-Alaikum! Ask me about website packages, e‑commerce, SEO, or extra features. I'll show live price & timeline updates below.</div>
52
+ <!-- Dynamic Live Quote Widget (initially hidden) -->
53
+ <div class="live-widget" id="liveWidget">
54
+ <div class="widget-header" id="widgetHeader">
55
+ <span><i class="fas fa-chart-line"></i> 📊 Live Quote (click to expand)</span>
56
+ <i class="fas fa-chevron-down" id="toggleIcon"></i>
57
+ </div>
58
+ <div class="widget-content" id="widgetContent">
59
+ <p id="widgetEmptyMsg">💡 Ask about a package or feature to see details here...</p>
60
+ <div id="widgetDetails" style="display: none;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </div>
 
 
 
 
 
 
 
62
  </div>
63
+ <div id="defaultQuestionsContainer" class="questions-container"></div>
64
  </div>
65
+ <div class="chat-input-area">
66
+ <input type="text" id="userInput" placeholder="Ask about price, timeline, extra features...">
67
+ <button id="sendBtn"><i class="fas fa-paper-plane"></i></button>
68
+ </div>
69
+ </div>
70
 
71
+ <script>
72
+ let sessionId = localStorage.getItem('chat_session_id');
73
+ if (!sessionId) {
74
+ sessionId = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 8);
75
+ localStorage.setItem('chat_session_id', sessionId);
76
+ }
77
+ const API_URL = "/api/chat";
78
+ const DEFAULT_QUESTIONS = [
79
+ "Basic website price and timeline?",
80
+ "Standard package details",
81
+ "Extra features like live chat – cost increase?",
82
+ "Do you build e-commerce?",
83
+ "Contact number"
84
+ ];
85
+
86
+ // DOM elements
87
+ const chatIcon = document.getElementById('chatIcon');
88
+ const chatModal = document.getElementById('chatModal');
89
+ const closeChat = document.getElementById('closeChat');
90
+ const sendBtn = document.getElementById('sendBtn');
91
+ const userInput = document.getElementById('userInput');
92
+ const chatMessages = document.getElementById('chatMessages');
93
+ const questionsContainer = document.getElementById('defaultQuestionsContainer');
94
+ const widgetContentDiv = document.getElementById('widgetContent');
95
+ const widgetEmptyMsg = document.getElementById('widgetEmptyMsg');
96
+ const widgetDetailsDiv = document.getElementById('widgetDetails');
97
+ let widgetOpen = false;
98
+ const widgetHeader = document.getElementById('widgetHeader');
99
+ const toggleIcon = document.getElementById('toggleIcon');
100
+
101
+ widgetHeader.addEventListener('click', () => {
102
+ const content = document.getElementById('widgetContent');
103
+ if (widgetOpen) {
104
+ content.classList.remove('show');
105
+ toggleIcon.classList.remove('fa-chevron-up');
106
+ toggleIcon.classList.add('fa-chevron-down');
107
+ } else {
108
+ content.classList.add('show');
109
+ toggleIcon.classList.remove('fa-chevron-down');
110
+ toggleIcon.classList.add('fa-chevron-up');
111
+ }
112
+ widgetOpen = !widgetOpen;
113
+ });
114
+
115
+ function updateWidget(data) {
116
+ // data contains: package, price, timeline, features, extra_feature, extra_cost, extra_timeline, service
117
+ if (!data || (Object.keys(data).length === 0)) {
118
+ widgetEmptyMsg.style.display = 'block';
119
+ widgetDetailsDiv.style.display = 'none';
120
+ return;
121
+ }
122
+ let html = '';
123
+ if (data.package) {
124
+ html += `<div class="info-row"><span class="info-label">📦 Package:</span> ${data.package}</div>`;
125
+ if (data.price) html += `<div class="info-row"><span class="info-label">💰 Price:</span> ${data.price}</div>`;
126
+ if (data.timeline) html += `<div class="info-row"><span class="info-label">⏱️ Timeline:</span> ${data.timeline}</div>`;
127
+ if (data.features && data.features.length) {
128
+ html += `<div class="info-row"><span class="info-label">✅ Includes:</span><ul class="features-list">${data.features.map(f => `<li>${f}</li>`).join('')}</ul></div>`;
129
  }
130
+ } else if (data.extra_feature) {
131
+ html += `<div class="info-row"><span class="info-label">✨ Extra Feature:</span> ${data.extra_feature}</div>`;
132
+ if (data.extra_cost) html += `<div class="info-row"><span class="info-label">💰 Additional Cost:</span> ${data.extra_cost}</div>`;
133
+ if (data.extra_timeline) html += `<div class="info-row"><span class="info-label">⏱️ Timeline Increase:</span> ${data.extra_timeline}</div>`;
134
+ } else if (data.service) {
135
+ html += `<div class="info-row"><span class="info-label">🛠️ Service:</span> ${data.service}</div>`;
136
+ if (data.price) html += `<div class="info-row"><span class="info-label">💰 Price:</span> ${data.price}</div>`;
137
+ if (data.timeline) html += `<div class="info-row"><span class="info-label">⏱️ Timeline:</span> ${data.timeline}</div>`;
138
+ } else {
139
+ // fallback: show something generic
140
+ html = `<div class="info-row">ℹ️ Ask about a specific package or feature for detailed quote.</div>`;
141
+ }
142
+ widgetDetailsDiv.innerHTML = html;
143
+ widgetEmptyMsg.style.display = 'none';
144
+ widgetDetailsDiv.style.display = 'block';
145
+ }
146
+
147
+ function renderQuestionBubbles() {
148
+ questionsContainer.innerHTML = '';
149
+ DEFAULT_QUESTIONS.forEach(q => {
150
+ const bubble = document.createElement('div');
151
+ bubble.className = 'question-bubble';
152
+ bubble.innerText = q;
153
+ bubble.onclick = () => { userInput.value = q; sendMessage(); };
154
+ questionsContainer.appendChild(bubble);
155
  });
156
+ }
157
+
158
+ function addMessage(text, sender) {
159
+ const div = document.createElement('div');
160
+ div.className = `message ${sender === 'user' ? 'user-msg' : 'bot-msg'}`;
161
+ div.innerText = text;
162
+ chatMessages.appendChild(div);
163
+ chatMessages.scrollTop = chatMessages.scrollHeight;
164
+ }
165
+
166
+ let typingDiv = null;
167
+ function showTyping() {
168
+ if (typingDiv) return;
169
+ typingDiv = document.createElement('div');
170
+ typingDiv.className = 'typing-indicator';
171
+ typingDiv.innerHTML = '<span></span><span></span><span></span>';
172
+ chatMessages.appendChild(typingDiv);
173
+ chatMessages.scrollTop = chatMessages.scrollHeight;
174
+ }
175
+ function hideTyping() {
176
+ if (typingDiv) { typingDiv.remove(); typingDiv = null; }
177
+ }
178
+
179
+ async function sendMessage() {
180
+ const msg = userInput.value.trim();
181
+ if (!msg) return;
182
+ if (questionsContainer) questionsContainer.style.display = 'none';
183
+ addMessage(msg, 'user');
184
+ userInput.value = '';
185
+ showTyping();
186
+ try {
187
+ const res = await fetch(API_URL, {
188
+ method: 'POST',
189
+ headers: { 'Content-Type': 'application/json' },
190
+ body: JSON.stringify({ message: msg, session_id: sessionId })
191
  });
192
+ const data = await res.json();
193
+ hideTyping();
194
+ addMessage(data.reply, 'bot');
195
+ // Update dynamic widget with structured data
196
+ if (data.widget) {
197
+ updateWidget(data.widget);
198
+ // Auto-expand widget if not already open
199
+ if (!widgetOpen) {
200
+ document.getElementById('widgetContent').classList.add('show');
201
+ toggleIcon.classList.remove('fa-chevron-down');
202
+ toggleIcon.classList.add('fa-chevron-up');
203
+ widgetOpen = true;
204
+ }
205
+ } else {
206
+ // If no widget data, maybe show a default
207
+ updateWidget(null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  }
209
+ } catch (err) {
210
+ hideTyping();
211
+ addMessage("❌ Server error. Try again.", 'bot');
212
+ }
213
+ }
214
+
215
+ chatIcon.onclick = () => {
216
+ chatModal.style.display = 'flex';
217
+ if (questionsContainer.children.length === 0) renderQuestionBubbles();
218
+ };
219
+ closeChat.onclick = () => chatModal.style.display = 'none';
220
+ sendBtn.onclick = sendMessage;
221
+ userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') sendMessage(); });
222
+ renderQuestionBubbles();
223
+ </script>
224
  </body>
225
  </html>