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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Project Manager</title>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
            --success-color: #27ae60;
            --warning-color: #f39c12;
            --background-color: #f8f9fa;
            --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        body {
            background-color: var(--background-color);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        .navbar {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            box-shadow: var(--card-shadow);
        }

        .navbar-brand {
            font-weight: bold;
            font-size: 1.5rem;
            color: white !important;
        }

        .dashboard-card {
            background: white;
            border-radius: 12px;
            box-shadow: var(--card-shadow);
            transition: transform 0.3s ease;
            border: none;
        }

        .dashboard-card:hover {
            transform: translateY(-2px);
        }

        .filter-section {
            background: white;
            border-radius: 12px;
            box-shadow: var(--card-shadow);
            padding: 20px;
            margin-bottom: 20px;
        }

        .chart-container {
            position: relative;
            height: 300px;
            padding: 20px;
        }

        .priority-table {
            max-height: 300px;
            overflow-y: auto;
        }

        .priority-high {
            color: var(--accent-color);
            font-weight: bold;
        }

        .priority-medium {
            color: var(--warning-color);
            font-weight: bold;
        }

        .priority-low {
            color: var(--success-color);
            font-weight: bold;
        }

        .chat-container {
            background: white;
            border-radius: 12px;
            box-shadow: var(--card-shadow);
            height: 500px;
            display: flex;
            flex-direction: column;
        }

        .chat-header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 15px 20px;
            border-radius: 12px 12px 0 0;
            font-weight: bold;
        }

        .chat-messages {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            max-height: 350px;
        }

        .message {
            margin-bottom: 15px;
            animation: fadeIn 0.3s ease;
        }

        .message.user {
            text-align: right;
        }

        .message.bot {
            text-align: left;
        }

        .message-bubble {
            display: inline-block;
            padding: 12px 16px;
            border-radius: 18px;
            max-width: 70%;
            word-wrap: break-word;
        }

        .message.user .message-bubble {
            background: var(--secondary-color);
            color: white;
        }

        .message.bot .message-bubble {
            background: #e9ecef;
            color: var(--primary-color);
        }

        .chat-input-container {
            padding: 20px;
            border-top: 1px solid #e9ecef;
            border-radius: 0 0 12px 12px;
        }

        .chat-input {
            border: 2px solid #e9ecef;
            border-radius: 25px;
            padding: 12px 20px;
            transition: border-color 0.3s ease;
        }

        .chat-input:focus {
            border-color: var(--secondary-color);
            box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
        }

        .btn-send {
            background: var(--secondary-color);
            border: none;
            border-radius: 50%;
            width: 45px;
            height: 45px;
            color: white;
            transition: background-color 0.3s ease;
        }

        .btn-send:hover {
            background: var(--primary-color);
            color: white;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .loading {
            display: none;
            text-align: center;
            color: #6c757d;
        }

        .loading .spinner-border {
            width: 1rem;
            height: 1rem;
        }

        @media (max-width: 768px) {
            .chart-container {
                height: 250px;
            }
            
            .chat-container {
                height: 400px;
            }
            
            .chat-messages {
                max-height: 250px;
            }
        }
    </style>
</head>
<body>
    <!-- Navigation Bar -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="#">
                <i class="fas fa-chart-line me-2"></i>AI Project Manager
            </a>
        </div>
    </nav>

    <div class="container mt-4">
        <!-- Filter Section -->
        <div class="filter-section">
            <div class="row g-3">
                <div class="col-md-4">
                    <label class="form-label"><i class="fas fa-calendar me-2"></i>Date Range</label>
                    <div class="input-group">
                        <input type="date" class="form-control" value="2024-01-01">
                        <span class="input-group-text">to</span>
                        <input type="date" class="form-control" value="2024-12-31">
                    </div>
                </div>
                <div class="col-md-4">
                    <label class="form-label"><i class="fas fa-tasks me-2"></i>Status</label>
                    <select class="form-select">
                        <option>All Status</option>
                        <option>Active</option>
                        <option>Completed</option>
                        <option>On Hold</option>
                        <option>Cancelled</option>
                    </select>
                </div>
                <div class="col-md-4">
                    <label class="form-label"><i class="fas fa-project-diagram me-2"></i>Project</label>
                    <select class="form-select">
                        <option>All Projects</option>
                        <option>E-commerce Platform</option>
                        <option>Mobile App</option>
                        <option>Data Analytics</option>
                        <option>AI Chatbot</option>
                    </select>
                </div>
            </div>
        </div>

        <!-- Dashboard Cards -->
        <div class="row g-4 mb-4">
            <!-- Project Breakdown Chart -->
            <div class="col-lg-4">
                <div class="card dashboard-card h-100">
                    <div class="card-header bg-transparent">
                        <h5 class="mb-0"><i class="fas fa-chart-pie me-2"></i>Project Breakdown</h5>
                    </div>
                    <div class="chart-container">
                        <canvas id="projectChart"></canvas>
                    </div>
                </div>
            </div>

            <!-- Task Status Chart -->
            <div class="col-lg-4">
                <div class="card dashboard-card h-100">
                    <div class="card-header bg-transparent">
                        <h5 class="mb-0"><i class="fas fa-chart-donut me-2"></i>Task Status</h5>
                    </div>
                    <div class="chart-container">
                        <canvas id="taskChart"></canvas>
                    </div>
                </div>
            </div>

            <!-- Priority Projects Table -->
            <div class="col-lg-4">
                <div class="card dashboard-card h-100">
                    <div class="card-header bg-transparent">
                        <h5 class="mb-0"><i class="fas fa-list me-2"></i>Priority Projects</h5>
                    </div>
                    <div class="card-body p-0">
                        <div class="priority-table">
                            <table class="table table-hover mb-0">
                                <thead class="table-light">
                                    <tr>
                                        <th>Project</th>
                                        <th>Priority</th>
                                        <th>Progress</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>E-commerce Platform</td>
                                        <td><span class="priority-high">High</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-danger" style="width: 75%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Mobile App Development</td>
                                        <td><span class="priority-high">High</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-warning" style="width: 60%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Data Analytics Dashboard</td>
                                        <td><span class="priority-medium">Medium</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-info" style="width: 40%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>AI Chatbot Integration</td>
                                        <td><span class="priority-medium">Medium</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-success" style="width: 90%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Website Redesign</td>
                                        <td><span class="priority-low">Low</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-secondary" style="width: 25%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>API Documentation</td>
                                        <td><span class="priority-low">Low</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-success" style="width: 85%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Security Audit</td>
                                        <td><span class="priority-high">High</span></td>
                                        <td>
                                            <div class="progress" style="height: 8px;">
                                                <div class="progress-bar bg-warning" style="width: 50%"></div>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Chat Section -->
        <div class="row">
            <div class="col-12">
                <div class="chat-container">
                    <div class="chat-header">
                        <i class="fas fa-robot me-2"></i>AI Project Assistant
                    </div>
                    <div class="chat-messages" id="chatMessages">
                        <div class="message bot">
                            <div class="message-bubble">
                                Hello! I'm your AI Project Assistant. How can I help you manage your projects today?
                            </div>
                        </div>
                    </div>
                    <div class="loading" id="loadingIndicator">
                        <div class="spinner-border me-2" role="status"></div>
                        <span>AI is thinking...</span>
                    </div>
                    <div class="chat-input-container">
                        <div class="input-group">
                            <input type="text" class="form-control chat-input" id="chatInput" 
                                   placeholder="Ask me about your projects..." 
                                   onkeypress="handleKeyPress(event)">
                            <button class="btn btn-send" onclick="sendMessage()">
                                <i class="fas fa-paper-plane"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Initialize Charts
        const projectCtx = document.getElementById('projectChart').getContext('2d');
        const projectChart = new Chart(projectCtx, {
            type: 'pie',
            data: {
                labels: ['E-commerce', 'Mobile App', 'Data Analytics', 'AI Chatbot', 'Others'],
                datasets: [{
                    data: [30, 25, 20, 15, 10],
                    backgroundColor: [
                        '#e74c3c',
                        '#3498db',
                        '#f39c12',
                        '#27ae60',
                        '#9b59b6'
                    ],
                    borderWidth: 2,
                    borderColor: '#fff'
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        position: 'bottom',
                        labels: {
                            padding: 15,
                            usePointStyle: true
                        }
                    }
                }
            }
        });

        const taskCtx = document.getElementById('taskChart').getContext('2d');
        const taskChart = new Chart(taskCtx, {
            type: 'doughnut',
            data: {
                labels: ['Completed', 'In Progress', 'On Hold', 'Pending'],
                datasets: [{
                    data: [45, 30, 15, 10],
                    backgroundColor: [
                        '#27ae60',
                        '#3498db',
                        '#f39c12',
                        '#e74c3c'
                    ],
                    borderWidth: 2,
                    borderColor: '#fff'
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        position: 'bottom',
                        labels: {
                            padding: 15,
                            usePointStyle: true
                        }
                    }
                }
            }
        });

        // Chat functionality
        function addMessage(message, isUser = false) {
            const chatMessages = document.getElementById('chatMessages');
            const messageDiv = document.createElement('div');
            messageDiv.className = `message ${isUser ? 'user' : 'bot'}`;
            
            const bubbleDiv = document.createElement('div');
            bubbleDiv.className = 'message-bubble';
            bubbleDiv.textContent = message;
            
            messageDiv.appendChild(bubbleDiv);
            chatMessages.appendChild(messageDiv);
            
            // Scroll to bottom
            chatMessages.scrollTop = chatMessages.scrollHeight;
        }

        function showLoading(show) {
            const loadingIndicator = document.getElementById('loadingIndicator');
            loadingIndicator.style.display = show ? 'block' : 'none';
        }

        async function sendMessage() {
            const chatInput = document.getElementById('chatInput');
            const message = chatInput.value.trim();
            
            if (!message) return;
            
            // Add user message
            addMessage(message, true);
            chatInput.value = '';
            
            // Show loading
            showLoading(true);
            
            try {
                const response = await fetch('/chat', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify({ query: message })
                });
                
                const data = await response.json();
                
                // Hide loading
                showLoading(false);
                
                // Add bot response
                addMessage(data.answer || 'Sorry, I could not process your request.');
                
            } catch (error) {
                console.error('Error:', error);
                showLoading(false);
                addMessage('Sorry, there was an error processing your request. Please try again.');
            }
        }

        function handleKeyPress(event) {
            if (event.key === 'Enter') {
                sendMessage();
            }
        }

        // Auto-focus chat input
        document.getElementById('chatInput').focus();
    </script>
</body>
</html>