ParthSadaria commited on
Commit
453517a
·
verified ·
1 Parent(s): 0213467

Upload 2 files

Browse files
Files changed (2) hide show
  1. static/script.js +276 -0
  2. static/style.css +506 -0
static/script.js ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Global variables
2
+ let currentChatId = null;
3
+ let darkMode = localStorage.getItem('darkMode') === 'true';
4
+
5
+ // Apply theme on load
6
+ document.addEventListener('DOMContentLoaded', () => {
7
+ if (darkMode) {
8
+ document.body.classList.add('dark-mode');
9
+ document.getElementById('theme-toggle').innerHTML = '<i class="fas fa-sun"></i>';
10
+ }
11
+
12
+ // Add enter key listener for chat input
13
+ const userInput = document.getElementById('user-input');
14
+ if (userInput) {
15
+ userInput.addEventListener('keydown', (e) => {
16
+ if (e.key === 'Enter' && !e.shiftKey) {
17
+ e.preventDefault();
18
+ sendMessage();
19
+ }
20
+ });
21
+ }
22
+
23
+ // Smooth scroll for navigation
24
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
25
+ anchor.addEventListener('click', function (e) {
26
+ e.preventDefault();
27
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
28
+ behavior: 'smooth'
29
+ });
30
+ });
31
+ });
32
+ });
33
+
34
+ // Toggle between light and dark mode
35
+ function toggleTheme() {
36
+ darkMode = !darkMode;
37
+ localStorage.setItem('darkMode', darkMode);
38
+ document.body.classList.toggle('dark-mode');
39
+ document.getElementById('theme-toggle').innerHTML = darkMode ?
40
+ '<i class="fas fa-sun"></i>' : '<i class="fas fa-moon"></i>';
41
+ }
42
+
43
+ // Function to send a chat message to the backend
44
+ async function sendMessage() {
45
+ const userInput = document.getElementById('user-input');
46
+ const messageText = userInput.value.trim();
47
+ const modelSelect = document.getElementById('model-select');
48
+ const selectedModel = modelSelect ? modelSelect.value : null;
49
+
50
+ if (!messageText) return;
51
+
52
+ // Clear input field
53
+ userInput.value = '';
54
+
55
+ // Add user message to chat
56
+ addMessageToChat('user', messageText);
57
+
58
+ // Show typing indicator
59
+ addTypingIndicator();
60
+
61
+ try {
62
+ // Send request to backend
63
+ const response = await fetch('/api/chat', {
64
+ method: 'POST',
65
+ headers: {
66
+ 'Content-Type': 'application/json',
67
+ },
68
+ body: JSON.stringify({
69
+ message: messageText,
70
+ chat_id: currentChatId,
71
+ model: selectedModel
72
+ }),
73
+ });
74
+
75
+ // Remove typing indicator
76
+ removeTypingIndicator();
77
+
78
+ if (response.ok) {
79
+ const data = await response.json();
80
+ currentChatId = data.chat_id;
81
+
82
+ // Add AI response to chat
83
+ addMessageToChat('assistant', data.response);
84
+
85
+ // Scroll to bottom of chat
86
+ scrollToBottom();
87
+ } else {
88
+ const errorData = await response.json();
89
+ addMessageToChat('system', `Error: ${errorData.detail || 'Something went wrong'}`);
90
+ }
91
+ } catch (error) {
92
+ // Remove typing indicator
93
+ removeTypingIndicator();
94
+ addMessageToChat('system', `Error: ${error.message || 'Failed to communicate with the server'}`);
95
+ }
96
+
97
+ // Scroll to bottom of chat
98
+ scrollToBottom();
99
+ }
100
+
101
+ // Add a message to the chat UI
102
+ function addMessageToChat(role, content) {
103
+ const chatMessages = document.getElementById('chat-messages');
104
+
105
+ if (!chatMessages) return;
106
+
107
+ const messageDiv = document.createElement('div');
108
+ messageDiv.className = `message ${role}-message`;
109
+
110
+ const contentDiv = document.createElement('div');
111
+ contentDiv.className = 'message-content';
112
+
113
+ // Simple markdown-like formatting
114
+ let formattedContent = content
115
+ .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // Bold
116
+ .replace(/\*(.*?)\*/g, '<em>$1</em>') // Italic
117
+ .replace(/```([\s\S]*?)```/g, '<pre><code>$1</code></pre>') // Code blocks
118
+ .replace(/`(.*?)`/g, '<code>$1</code>') // Inline code
119
+ .replace(/\n/g, '<br>'); // Line breaks
120
+
121
+ contentDiv.innerHTML = formattedContent;
122
+ messageDiv.appendChild(contentDiv);
123
+ chatMessages.appendChild(messageDiv);
124
+ }
125
+
126
+ // Add typing indicator
127
+ function addTypingIndicator() {
128
+ const chatMessages = document.getElementById('chat-messages');
129
+ if (!chatMessages) return;
130
+
131
+ const indicator = document.createElement('div');
132
+ indicator.className = 'message assistant-message typing-indicator';
133
+ indicator.id = 'typing-indicator';
134
+
135
+ const dots = document.createElement('div');
136
+ dots.className = 'typing-dots';
137
+ for (let i = 0; i < 3; i++) {
138
+ const dot = document.createElement('span');
139
+ dots.appendChild(dot);
140
+ }
141
+
142
+ indicator.appendChild(dots);
143
+ chatMessages.appendChild(indicator);
144
+ scrollToBottom();
145
+ }
146
+
147
+ // Remove typing indicator
148
+ function removeTypingIndicator() {
149
+ const indicator = document.getElementById('typing-indicator');
150
+ if (indicator) {
151
+ indicator.remove();
152
+ }
153
+ }
154
+
155
+ // Scroll to the bottom of the chat
156
+ function scrollToBottom() {
157
+ const chatMessages = document.getElementById('chat-messages');
158
+ if (chatMessages) {
159
+ chatMessages.scrollTop = chatMessages.scrollHeight;
160
+ }
161
+ }
162
+
163
+ // Admin Panel Functions
164
+ function updateModel() {
165
+ const modelSelector = document.getElementById('model-selector');
166
+ const model = modelSelector.value;
167
+
168
+ fetch('/api/model', {
169
+ method: 'POST',
170
+ headers: {
171
+ 'Content-Type': 'application/json',
172
+ },
173
+ body: JSON.stringify({ model: model }),
174
+ })
175
+ .then(response => response.json())
176
+ .then(data => {
177
+ if (data.status === 'success') {
178
+ document.getElementById('current-model').textContent = data.model;
179
+ alert('Model updated successfully!');
180
+ }
181
+ })
182
+ .catch(error => alert('Error updating model: ' + error));
183
+ }
184
+
185
+ function addRule() {
186
+ const newRuleInput = document.getElementById('new-rule');
187
+ const rule = newRuleInput.value.trim();
188
+
189
+ if (!rule) return;
190
+
191
+ fetch('/api/rules', {
192
+ method: 'POST',
193
+ headers: {
194
+ 'Content-Type': 'application/json',
195
+ },
196
+ body: JSON.stringify({ rule: rule }),
197
+ })
198
+ .then(response => response.json())
199
+ .then(data => {
200
+ if (data.status === 'success') {
201
+ newRuleInput.value = '';
202
+ refreshRulesList(data.rules);
203
+ }
204
+ })
205
+ .catch(error => alert('Error adding rule: ' + error));
206
+ }
207
+
208
+ function deleteRule(ruleId) {
209
+ fetch(`/api/rules/${ruleId}`, {
210
+ method: 'DELETE',
211
+ })
212
+ .then(response => response.json())
213
+ .then(data => {
214
+ if (data.status === 'success') {
215
+ refreshRulesList(data.rules);
216
+ }
217
+ })
218
+ .catch(error => alert('Error deleting rule: ' + error));
219
+ }
220
+
221
+ function refreshRulesList(rules) {
222
+ const rulesList = document.getElementById('rules-list');
223
+ rulesList.innerHTML = '';
224
+
225
+ rules.forEach((rule, index) => {
226
+ const li = document.createElement('li');
227
+ li.innerHTML = `${rule} <button onclick="deleteRule(${index})">Delete</button>`;
228
+ rulesList.appendChild(li);
229
+ });
230
+ }
231
+
232
+ function viewChat(chatId) {
233
+ fetch(`/api/chats/${chatId}`)
234
+ .then(response => response.json())
235
+ .then(data => {
236
+ const chatViewer = document.getElementById('chat-viewer');
237
+ chatViewer.innerHTML = '<h3>Chat History</h3>';
238
+
239
+ const chatContainer = document.createElement('div');
240
+ chatContainer.className = 'admin-chat-history';
241
+
242
+ data.history.forEach(message => {
243
+ const messageDiv = document.createElement('div');
244
+ messageDiv.className = `admin-message ${message.role}-message`;
245
+ messageDiv.textContent = `${message.role.toUpperCase()}: ${message.content}`;
246
+ chatContainer.appendChild(messageDiv);
247
+ });
248
+
249
+ chatViewer.appendChild(chatContainer);
250
+ })
251
+ .catch(error => alert('Error viewing chat: ' + error));
252
+ }
253
+
254
+ // Load chats for the admin panel
255
+ function loadChats() {
256
+ if (document.getElementById('active-chats')) {
257
+ fetch('/api/chats')
258
+ .then(response => response.json())
259
+ .then(data => {
260
+ const chatsList = document.getElementById('active-chats');
261
+ chatsList.innerHTML = '';
262
+
263
+ data.chats.forEach(chatId => {
264
+ const li = document.createElement('li');
265
+ li.innerHTML = `<a href="#" onclick="viewChat('${chatId}')">${chatId}</a>`;
266
+ chatsList.appendChild(li);
267
+ });
268
+ })
269
+ .catch(error => console.error('Error loading chats:', error));
270
+ }
271
+ }
272
+
273
+ // Check if we're on the admin page and load chats
274
+ if (window.location.pathname === '/admin') {
275
+ loadChats();
276
+ }
static/style.css ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Reset and Base Styles */
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
7
+ }
8
+
9
+ :root {
10
+ --primary-color: #4a6fa5;
11
+ --secondary-color: #6b8cae;
12
+ --accent-color: #ff6b6b;
13
+ --text-color: #333;
14
+ --bg-color: #f8f9fa;
15
+ --card-bg: #ffffff;
16
+ --border-color: #e0e0e0;
17
+ --chat-user-bg: #e6f2ff;
18
+ --chat-assistant-bg: #f0f0f0;
19
+ --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
20
+ --transition: all 0.3s ease;
21
+ }
22
+
23
+ body {
24
+ background-color: var(--bg-color);
25
+ color: var(--text-color);
26
+ line-height: 1.6;
27
+ transition: var(--transition);
28
+ }
29
+
30
+ /* Dark mode styles */
31
+ body.dark-mode {
32
+ --primary-color: #5c88c5;
33
+ --secondary-color: #7fa3cc;
34
+ --accent-color: #ff8585;
35
+ --text-color: #e0e0e0;
36
+ --bg-color: #121212;
37
+ --card-bg: #1e1e1e;
38
+ --border-color: #383838;
39
+ --chat-user-bg: #2a405a;
40
+ --chat-assistant-bg: #2a2a2a;
41
+ --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
42
+ }
43
+
44
+ .app-container {
45
+ min-height: 100vh;
46
+ display: flex;
47
+ flex-direction: column;
48
+ }
49
+
50
+ /* Navigation Bar */
51
+ .navbar {
52
+ background-color: var(--primary-color);
53
+ color: white;
54
+ padding: 1rem 2rem;
55
+ display: flex;
56
+ justify-content: space-between;
57
+ align-items: center;
58
+ box-shadow: var(--shadow);
59
+ position: sticky;
60
+ top: 0;
61
+ z-index: 1000;
62
+ }
63
+
64
+ .logo {
65
+ font-size: 1.5rem;
66
+ font-weight: bold;
67
+ }
68
+
69
+ .nav-links {
70
+ display: flex;
71
+ align-items: center;
72
+ gap: 1.5rem;
73
+ }
74
+
75
+ .nav-links a {
76
+ color: white;
77
+ text-decoration: none;
78
+ font-weight: 500;
79
+ padding: 0.5rem 0;
80
+ border-bottom: 2px solid transparent;
81
+ transition: var(--transition);
82
+ }
83
+
84
+ .nav-links a:hover, .nav-links a.active {
85
+ border-bottom: 2px solid white;
86
+ }
87
+
88
+ #theme-toggle {
89
+ background: none;
90
+ border: none;
91
+ color: white;
92
+ cursor: pointer;
93
+ font-size: 1.2rem;
94
+ }
95
+
96
+ /* Common Section Styles */
97
+ .section {
98
+ padding: 4rem 2rem;
99
+ max-width: 1200px;
100
+ margin: 0 auto;
101
+ width: 100%;
102
+ }
103
+
104
+ .home-section {
105
+ display: flex;
106
+ flex-direction: column;
107
+ gap: 4rem;
108
+ }
109
+
110
+ /* Hero Section */
111
+ .hero {
112
+ text-align: center;
113
+ margin-bottom: 2rem;
114
+ }
115
+
116
+ .hero h1 {
117
+ font-size: 2.5rem;
118
+ margin-bottom: 1rem;
119
+ color: var(--primary-color);
120
+ }
121
+
122
+ .hero p {
123
+ font-size: 1.2rem;
124
+ margin-bottom: 2rem;
125
+ color: var(--secondary-color);
126
+ }
127
+
128
+ .cta-button {
129
+ display: inline-block;
130
+ background-color: var(--accent-color);
131
+ color: white;
132
+ padding: 0.8rem 1.5rem;
133
+ border-radius: 4px;
134
+ text-decoration: none;
135
+ font-weight: bold;
136
+ transition: var(--transition);
137
+ }
138
+
139
+ .cta-button:hover {
140
+ transform: translateY(-3px);
141
+ box-shadow: var(--shadow);
142
+ }
143
+
144
+ /* Features Section */
145
+ .features {
146
+ display: flex;
147
+ justify-content: center;
148
+ flex-wrap: wrap;
149
+ gap: 2rem;
150
+ margin: 2rem 0;
151
+ }
152
+
153
+ .feature-card {
154
+ background-color: var(--card-bg);
155
+ border-radius: 8px;
156
+ padding: 2rem;
157
+ box-shadow: var(--shadow);
158
+ flex: 1;
159
+ min-width: 250px;
160
+ max-width: 350px;
161
+ text-align: center;
162
+ transition: var(--transition);
163
+ }
164
+
165
+ .feature-card:hover {
166
+ transform: translateY(-5px);
167
+ }
168
+
169
+ .feature-card i {
170
+ font-size: 2.5rem;
171
+ color: var(--primary-color);
172
+ margin-bottom: 1rem;
173
+ }
174
+
175
+ .feature-card h3 {
176
+ margin-bottom: 1rem;
177
+ color: var(--primary-color);
178
+ }
179
+
180
+ /* Tech Stack Section */
181
+ .tech-stack {
182
+ text-align: center;
183
+ margin-top: 2rem;
184
+ }
185
+
186
+ .tech-stack h2 {
187
+ margin-bottom: 1.5rem;
188
+ color: var(--primary-color);
189
+ }
190
+
191
+ .tech-icons {
192
+ display: flex;
193
+ justify-content: center;
194
+ flex-wrap: wrap;
195
+ gap: 2rem;
196
+ }
197
+
198
+ .tech-icon {
199
+ display: flex;
200
+ flex-direction: column;
201
+ align-items: center;
202
+ gap: 0.5rem;
203
+ }
204
+
205
+ .tech-icon i {
206
+ font-size: 2rem;
207
+ color: var(--secondary-color);
208
+ }
209
+
210
+ /* Chat Section */
211
+ .chat-section {
212
+ display: flex;
213
+ justify-content: center;
214
+ align-items: center;
215
+ min-height: 80vh;
216
+ }
217
+
218
+ .chat-container {
219
+ background-color: var(--card-bg);
220
+ border-radius: 8px;
221
+ box-shadow: var(--shadow);
222
+ width: 100%;
223
+ max-width: 800px;
224
+ height: 600px;
225
+ display: flex;
226
+ flex-direction: column;
227
+ overflow: hidden;
228
+ }
229
+
230
+ .chat-header {
231
+ padding: 1rem;
232
+ background-color: var(--primary-color);
233
+ color: white;
234
+ display: flex;
235
+ justify-content: space-between;
236
+ align-items: center;
237
+ }
238
+
239
+ .model-selector {
240
+ display: flex;
241
+ align-items: center;
242
+ gap: 0.5rem;
243
+ }
244
+
245
+ #model-select {
246
+ padding: 0.25rem 0.5rem;
247
+ border: none;
248
+ border-radius: 4px;
249
+ background-color: white;
250
+ color: var(--text-color);
251
+ }
252
+
253
+ .chat-messages {
254
+ flex: 1;
255
+ padding: 1rem;
256
+ overflow-y: auto;
257
+ display: flex;
258
+ flex-direction: column;
259
+ gap: 1rem;
260
+ }
261
+
262
+ .message {
263
+ max-width: 80%;
264
+ padding: 0.75rem 1rem;
265
+ border-radius: 8px;
266
+ margin-bottom: 0.5rem;
267
+ }
268
+
269
+ .user-message {
270
+ align-self: flex-end;
271
+ background-color: var(--chat-user-bg);
272
+ color: var(--text-color);
273
+ border-bottom-right-radius: 0;
274
+ }
275
+
276
+ .assistant-message {
277
+ align-self: flex-start;
278
+ background-color: var(--chat-assistant-bg);
279
+ color: var(--text-color);
280
+ border-bottom-left-radius: 0;
281
+ }
282
+
283
+ .system-message {
284
+ align-self: center;
285
+ background-color: var(--secondary-color);
286
+ color: white;
287
+ text-align: center;
288
+ }
289
+
290
+ .message-content {
291
+ word-wrap: break-word;
292
+ }
293
+
294
+ .message-content pre {
295
+ background-color: #f0f0f0;
296
+ padding: 0.5rem;
297
+ border-radius: 4px;
298
+ overflow-x: auto;
299
+ margin: 0.5rem 0;
300
+ }
301
+ .message-content code {
302
+ background-color: rgba(0, 0, 0, 0.1);
303
+ padding: 0.1rem 0.3rem;
304
+ border-radius: 3px;
305
+ font-family: 'Courier New', monospace;
306
+ }
307
+
308
+ /* Typing indicator */
309
+ .typing-indicator {
310
+ padding: 0.5rem 1rem;
311
+ }
312
+
313
+ .typing-dots {
314
+ display: flex;
315
+ gap: 4px;
316
+ }
317
+
318
+ .typing-dots span {
319
+ width: 8px;
320
+ height: 8px;
321
+ background-color: #888;
322
+ border-radius: 50%;
323
+ display: inline-block;
324
+ opacity: 0.6;
325
+ animation: typing-dot 1.4s infinite;
326
+ }
327
+
328
+ .typing-dots span:nth-child(1) {
329
+ animation-delay: 0s;
330
+ }
331
+
332
+ .typing-dots span:nth-child(2) {
333
+ animation-delay: 0.2s;
334
+ }
335
+
336
+ .typing-dots span:nth-child(3) {
337
+ animation-delay: 0.4s;
338
+ }
339
+
340
+ @keyframes typing-dot {
341
+ 0%, 60%, 100% {
342
+ transform: translateY(0);
343
+ }
344
+ 30% {
345
+ transform: translateY(-4px);
346
+ }
347
+ }
348
+
349
+ .chat-input {
350
+ padding: 1rem;
351
+ display: flex;
352
+ gap: 0.5rem;
353
+ border-top: 1px solid var(--border-color);
354
+ }
355
+
356
+ #user-input {
357
+ flex: 1;
358
+ padding: 0.75rem;
359
+ border: 1px solid var(--border-color);
360
+ border-radius: 4px;
361
+ resize: none;
362
+ font-size: 1rem;
363
+ background-color: var(--card-bg);
364
+ color: var(--text-color);
365
+ }
366
+
367
+ #send-button {
368
+ background-color: var(--primary-color);
369
+ color: white;
370
+ border: none;
371
+ border-radius: 4px;
372
+ padding: 0 1rem;
373
+ cursor: pointer;
374
+ transition: var(--transition);
375
+ }
376
+
377
+ #send-button:hover {
378
+ background-color: var(--secondary-color);
379
+ }
380
+
381
+ /* Admin Panel Styles */
382
+ .admin-page {
383
+ padding: 2rem;
384
+ }
385
+
386
+ .admin-page h1 {
387
+ margin-bottom: 2rem;
388
+ color: var(--primary-color);
389
+ }
390
+
391
+ .admin-section {
392
+ background-color: var(--card-bg);
393
+ border-radius: 8px;
394
+ padding: 1.5rem;
395
+ margin-bottom: 2rem;
396
+ box-shadow: var(--shadow);
397
+ }
398
+
399
+ .admin-section h2 {
400
+ margin-bottom: 1rem;
401
+ color: var(--primary-color);
402
+ }
403
+
404
+ .admin-section select, .admin-section input {
405
+ padding: 0.5rem;
406
+ border: 1px solid var(--border-color);
407
+ border-radius: 4px;
408
+ margin-right: 0.5rem;
409
+ background-color: var(--bg-color);
410
+ color: var(--text-color);
411
+ }
412
+
413
+ .admin-section button {
414
+ background-color: var(--primary-color);
415
+ color: white;
416
+ border: none;
417
+ border-radius: 4px;
418
+ padding: 0.5rem 1rem;
419
+ cursor: pointer;
420
+ transition: var(--transition);
421
+ }
422
+
423
+ .admin-section button:hover {
424
+ background-color: var(--secondary-color);
425
+ }
426
+
427
+ #rules-list, #active-chats {
428
+ list-style: none;
429
+ margin: 1rem 0;
430
+ }
431
+
432
+ #rules-list li, #active-chats li {
433
+ margin-bottom: 0.5rem;
434
+ padding: 0.5rem;
435
+ background-color: var(--bg-color);
436
+ border-radius: 4px;
437
+ display: flex;
438
+ justify-content: space-between;
439
+ align-items: center;
440
+ }
441
+
442
+ #active-chats a {
443
+ color: var(--primary-color);
444
+ text-decoration: none;
445
+ }
446
+
447
+ #active-chats a:hover {
448
+ text-decoration: underline;
449
+ }
450
+
451
+ .admin-chat-history {
452
+ max-height: 400px;
453
+ overflow-y: auto;
454
+ padding: 1rem;
455
+ background-color: var(--bg-color);
456
+ border-radius: 4px;
457
+ margin-top: 1rem;
458
+ }
459
+
460
+ .admin-message {
461
+ padding: 0.5rem;
462
+ margin-bottom: 0.5rem;
463
+ border-radius: 4px;
464
+ }
465
+
466
+ .admin-message.user-message {
467
+ background-color: var(--chat-user-bg);
468
+ }
469
+
470
+ .admin-message.assistant-message {
471
+ background-color: var(--chat-assistant-bg);
472
+ }
473
+
474
+ /* Footer */
475
+ .footer {
476
+ background-color: var(--primary-color);
477
+ color: white;
478
+ text-align: center;
479
+ padding: 1rem;
480
+ margin-top: auto;
481
+ }
482
+
483
+ /* Responsive Styles */
484
+ @media (max-width: 768px) {
485
+ .section {
486
+ padding: 2rem 1rem;
487
+ }
488
+
489
+ .chat-container {
490
+ height: 80vh;
491
+ }
492
+
493
+ .message {
494
+ max-width: 90%;
495
+ }
496
+
497
+ .features {
498
+ flex-direction: column;
499
+ align-items: center;
500
+ }
501
+
502
+ .feature-card {
503
+ width: 100%;
504
+ max-width: 100%;
505
+ }
506
+ }