nilotpaldhar2004 commited on
Commit
5a34c77
Β·
unverified Β·
1 Parent(s): f73daf2

Revamp styles and improve UI elements in index.html

Browse files

Updated CSS variables for a new color palette and improved UI elements. Adjusted HTML for better accessibility and responsiveness.

Files changed (1) hide show
  1. static/index.html +147 -102
static/index.html CHANGED
@@ -11,28 +11,38 @@
11
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
12
 
13
  :root {
14
- --bg: #1a1814;
15
- --surface: #211f1b;
16
- --card: #272420;
17
- --card2: #2e2b27;
18
- --border: #373330;
19
- --border2: #443f3a;
20
- --accent: #e8a455;
21
- --accent2: #c8843a;
22
- --accent-dim: rgba(232,164,85,0.10);
23
- --accent-glow: rgba(232,164,85,0.20);
24
- --sql-keyword: #e8a455;
25
- --sql-func: #8ecfa8;
26
- --sql-string: #c8a97e;
27
- --sql-num: #a8c4e0;
28
- --sql-comment: #5c5650;
29
- --sql-op: #d4a574;
30
- --sql-default: #d4cfc9;
31
- --danger: #c96b5a;
32
- --success: #7ab897;
33
- --text: #e8e0d5;
34
- --text2: #b8afa4;
35
- --muted: #7a7268;
 
 
 
 
 
 
 
 
 
 
36
  --mono: 'JetBrains Mono', monospace;
37
  --sans: 'Inter', sans-serif;
38
  --radius: 8px;
@@ -43,118 +53,137 @@
43
 
44
  html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; overflow-x: hidden; }
45
 
 
46
  #app { display: grid; grid-template-rows: var(--header-h) 1fr; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
47
 
48
- /* Header */
49
  header { grid-column: 1/-1; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 100; }
50
  .logo-wrap { display: flex; align-items: center; gap: 10px; }
51
- .logo-icon { width: 30px; height: 30px; background: linear-gradient(135deg,var(--accent),var(--accent2)); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
52
  .logo-text { font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--text); letter-spacing: -0.2px; }
53
  .logo-text span { color: var(--accent); }
54
- #menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text2); font-size: 20px; padding: 4px; margin-right: 4px; }
55
  .header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
56
- .clear-btn { background: none; border: 1px solid var(--border2); color: var(--muted); font-size: 11px; padding: 4px 10px; border-radius: 5px; cursor: pointer; font-family: var(--mono); letter-spacing: 0.5px; transition: all 0.15s; }
57
- .clear-btn:hover { border-color: var(--danger); color: #e07a6a; }
58
  .status-wrap { display: flex; align-items: center; gap: 6px; }
59
  .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 3s ease-in-out infinite; }
60
- .status-dot.ready { background: var(--success); animation: pulse-ok 2s ease-in-out infinite; }
61
  @keyframes blink { 0%,100%{opacity:.4} 50%{opacity:1} }
62
- @keyframes pulse-ok { 0%,100%{box-shadow:0 0 0 0 var(--accent-glow)} 50%{box-shadow:0 0 0 4px transparent} }
63
- .badge { font-family: var(--mono); font-size: 10px; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border2); color: var(--muted); letter-spacing: 0.5px; }
64
- .badge.active { border-color: var(--accent2); color: var(--accent); background: var(--accent-dim); }
65
 
66
- /* Sidebar */
67
  aside { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; transition: transform 0.25s ease; }
68
  .aside-section { padding: 16px 14px 12px; border-bottom: 1px solid var(--border); }
69
  .section-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-bottom: 10px; }
 
 
70
  .upload-zone { border: 1.5px dashed var(--border2); border-radius: var(--radius); padding: 18px 12px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; background: var(--card); }
71
- .upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-dim); }
72
  .upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
73
  .upload-icon { font-size: 20px; margin-bottom: 6px; display: block; }
74
- .upload-zone p { font-size: 12px; color: var(--muted); line-height: 1.5; }
75
- .upload-zone p strong { color: var(--text2); font-weight: 500; }
76
- #file-info { display: none; background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 11px; font-size: 12px; }
 
 
77
  #file-info.show { display: block; }
78
  .file-name { font-family: var(--mono); font-size: 10px; color: var(--accent); word-break: break-all; margin-bottom: 7px; font-weight: 600; }
79
- .file-info-row { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 3px; }
80
- .file-info-row span:last-child { color: var(--text2); }
81
  .schema-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin-top: 9px; margin-bottom: 4px; }
82
- #schema-box { display: none; font-family: var(--mono); font-size: 10px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 8px; max-height: 100px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.7; }
83
  #schema-box.show { display: block; }
 
 
84
  .aside-section.suggestions { flex: 1; overflow-y: auto; }
85
  #suggestions-list { display: flex; flex-direction: column; gap: 5px; }
86
- .suggestion-chip { padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--card); font-size: 11px; color: var(--muted); cursor: pointer; transition: all 0.15s; text-align: left; font-family: var(--sans); }
87
  .suggestion-chip:hover { border-color: var(--accent2); color: var(--text); background: var(--accent-dim); }
88
 
89
- /* Main */
90
- main { display: flex; flex-direction: column; overflow: hidden; }
91
- #chat { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
92
- #empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; }
93
- .empty-icon { font-size: 36px; animation: float 4s ease-in-out infinite; }
94
- @keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
95
- #empty-state h2 { font-size: 15px; color: var(--text2); font-weight: 500; }
96
- #empty-state p { font-size: 12px; max-width: 320px; line-height: 1.7; }
97
-
98
- /* Messages */
99
- .msg { display: flex; flex-direction: column; gap: 3px; max-width: 780px; }
100
- .msg.user { align-self: flex-end; align-items: flex-end; }
 
 
101
  .msg.assistant { align-self: flex-start; align-items: flex-start; }
102
  .msg-meta { font-size: 10px; color: var(--muted); font-family: var(--mono); padding: 0 4px; }
103
  .bubble { padding: 11px 15px; border-radius: var(--radius-lg); font-size: 13.5px; line-height: 1.65; }
104
- .msg.user .bubble { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #1a1410; border-bottom-right-radius: 4px; font-weight: 500; }
105
- .msg.assistant .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); }
106
 
107
- /* SQL block */
108
- .sql-block { background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius); margin-top: 10px; overflow: hidden; }
109
  .sql-block-header { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; background: var(--card2); border-bottom: 1px solid var(--border); }
110
- .sql-block-header span { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
111
- .copy-btn { background: none; border: 1px solid var(--border2); color: var(--muted); font-size: 10px; padding: 3px 8px; border-radius: 4px; cursor: pointer; font-family: var(--mono); transition: all 0.15s; }
 
 
 
 
 
112
  .copy-btn:hover { border-color: var(--accent); color: var(--accent); }
113
- .sql-code { padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 2; color: var(--sql-default); white-space: pre-wrap; word-break: break-word; }
114
- .sql-code .kw { color: var(--sql-keyword); font-weight: 600; }
115
- .sql-code .fn { color: var(--sql-func); }
116
- .sql-code .st { color: var(--sql-string); }
117
- .sql-code .nm { color: var(--sql-num); }
118
- .sql-code .cm { color: var(--sql-comment); font-style: italic; }
119
- .sql-code .op { color: var(--sql-op); }
120
-
121
- /* Table */
122
- .result-table-wrap { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: 300px; }
 
 
 
123
  table { width: 100%; border-collapse: collapse; font-size: 12px; }
124
  thead th { position: sticky; top: 0; background: var(--card2); padding: 8px 13px; text-align: left; font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: 0.8px; border-bottom: 1px solid var(--border2); white-space: nowrap; }
125
  tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
126
  tbody tr:last-child { border-bottom: none; }
127
- tbody tr:hover { background: rgba(232,164,85,0.05); }
128
- td { padding: 7px 13px; color: var(--text2); white-space: nowrap; }
129
  .result-count { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 5px; padding-left: 2px; }
130
- .error-bubble { background: rgba(201,107,90,0.08); border: 1px solid rgba(201,107,90,0.3); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: #e07a6a; margin-top: 8px; font-family: var(--mono); }
 
 
131
 
132
  /* Thinking */
133
  .thinking { display: flex; gap: 5px; align-items: center; padding: 12px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); border-bottom-left-radius: 4px; }
134
  .thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: think 1.2s ease-in-out infinite; }
135
  .thinking span:nth-child(2){animation-delay:.2s} .thinking span:nth-child(3){animation-delay:.4s}
136
- @keyframes think { 0%,60%,100%{transform:translateY(0);opacity:.35} 30%{transform:translateY(-6px);opacity:1} }
137
 
138
- /* Input */
139
  .input-bar { padding: 12px 20px 14px; background: var(--surface); border-top: 1px solid var(--border); }
140
  .input-row { display: flex; gap: 9px; align-items: flex-end; }
141
- #question-input { flex: 1; background: var(--card); border: 1.5px solid var(--border2); border-radius: var(--radius); padding: 10px 13px; font-size: 14px; font-family: var(--sans); color: var(--text); resize: none; min-height: 44px; max-height: 120px; outline: none; transition: border-color 0.2s; line-height: 1.5; }
142
- #question-input:focus { border-color: var(--accent); }
143
  #question-input::placeholder { color: var(--muted); }
144
- #question-input:disabled { opacity: 0.5; cursor: not-allowed; }
145
- #send-btn { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #1a1410; border: none; border-radius: var(--radius); width: 44px; height: 44px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; font-weight: 700; }
146
- #send-btn:hover { opacity: 0.88; transform: scale(1.04); }
147
- #send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
148
  .input-hint { font-size: 11px; color: var(--muted); margin-top: 5px; padding-left: 2px; }
149
 
150
  /* Toast */
151
- #toast { position: fixed; bottom: 20px; right: 20px; background: var(--card2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 9px 15px; font-size: 12px; font-family: var(--mono); color: var(--text); z-index: 9999; transform: translateY(50px); opacity: 0; transition: all 0.3s cubic-bezier(.34,1.56,.64,1); pointer-events: none; }
152
  #toast.show { transform: translateY(0); opacity: 1; }
153
- #toast.success { border-color: var(--success); color: #8ecfa8; }
154
- #toast.error { border-color: var(--danger); color: #e07a6a; }
155
 
156
  /* Loading bar */
157
- #loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg,var(--accent),var(--accent2)); z-index: 10000; transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease; }
158
  #loading-bar.active { transform: scaleX(0.8); }
159
  #loading-bar.done { transform: scaleX(1); opacity: 0; transition: opacity 0.4s 0.1s; }
160
 
@@ -162,9 +191,10 @@
162
  ::-webkit-scrollbar { width: 5px; height: 5px; }
163
  ::-webkit-scrollbar-track { background: transparent; }
164
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
 
165
 
166
- /* Overlay */
167
- #overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 90; }
168
  #overlay.show { display: block; }
169
 
170
  /* ── RESPONSIVE ── */
@@ -172,28 +202,31 @@
172
  :root { --sidebar-w: 240px; }
173
  #chat { padding: 14px 16px; }
174
  .input-bar { padding: 10px 16px 12px; }
 
175
  }
176
 
177
  @media (max-width: 640px) {
178
  :root { --header-h: 50px; }
179
  #app { grid-template-columns: 1fr; }
180
- #menu-btn { display: flex; }
181
- aside { position: fixed; top: var(--header-h); left: 0; width: 280px; height: calc(100vh - var(--header-h)); z-index: 95; transform: translateX(-100%); box-shadow: 4px 0 20px rgba(0,0,0,0.4); }
182
  aside.open { transform: translateX(0); }
183
  main { grid-column: 1; }
184
- .msg { max-width: 95%; }
 
185
  #chat { padding: 12px; gap: 12px; }
186
  .bubble { padding: 10px 13px; font-size: 13px; }
187
- .sql-code { font-size: 11.5px; padding: 12px; }
188
- td, thead th { padding: 7px 10px; }
189
  .input-bar { padding: 8px 12px 10px; }
190
  .input-hint { display: none; }
191
  .status-wrap .badge { display: none; }
 
192
  }
193
 
194
  @media (max-width: 380px) {
195
  .logo-text { font-size: 13px; }
196
- .clear-btn { padding: 3px 7px; font-size: 10px; }
197
  }
198
  </style>
199
  </head>
@@ -210,10 +243,10 @@
210
  <div class="logo-text">Query<span>Mind</span></div>
211
  </div>
212
  <div class="header-right">
213
- <button class="clear-btn" onclick="clearChat()">CLEAR</button>
214
  <div class="status-wrap">
215
  <span id="status-dot" class="status-dot"></span>
216
- <span id="status-label" class="badge">LOADING</span>
217
  </div>
218
  </div>
219
  </header>
@@ -237,7 +270,7 @@
237
  <div class="aside-section suggestions">
238
  <div class="section-label">Example Queries</div>
239
  <div id="suggestions-list">
240
- <div class="suggestion-chip" style="color:var(--muted);font-style:italic;cursor:default;">Upload CSV to see examples</div>
241
  </div>
242
  </div>
243
  </aside>
@@ -247,13 +280,13 @@
247
  <div id="empty-state">
248
  <div class="empty-icon">πŸ—‚οΈ</div>
249
  <h2>Ask anything about your data</h2>
250
- <p>Upload a CSV from the sidebar, then ask a question in plain English. QueryMind converts it to SQL and shows results.</p>
251
  </div>
252
  </div>
253
  <div class="input-bar">
254
  <div class="input-row">
255
  <textarea id="question-input" placeholder="e.g. Show top 10 rows by sales…" rows="1" disabled></textarea>
256
- <button id="send-btn" disabled>↑</button>
257
  </div>
258
  <div class="input-hint">Enter to send &nbsp;Β·&nbsp; Shift+Enter new line</div>
259
  </div>
@@ -285,7 +318,7 @@
285
  checkHealth();
286
 
287
  let toastTimer;
288
- function showToast(msg,type='success'){ toast.textContent=msg; toast.className=`show ${type}`; clearTimeout(toastTimer); toastTimer=setTimeout(()=>toast.className='',3000); }
289
 
290
  function startLoading(){ loadingBar.className='active'; isLoading=true; sendBtn.disabled=true; input.disabled=true; }
291
  function stopLoading(){ loadingBar.className='done'; isLoading=false; if(sessionId){sendBtn.disabled=false;input.disabled=false;} setTimeout(()=>loadingBar.className='',600); }
@@ -351,19 +384,31 @@
351
  }
352
 
353
  function highlightSQL(raw){
354
- const kw=/\b(SELECT|FROM|WHERE|AND|OR|NOT|IN|IS|NULL|LIKE|BETWEEN|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|DISTINCT|AS|JOIN|LEFT|RIGHT|INNER|OUTER|ON|UNION|ALL|INSERT|UPDATE|DELETE|CREATE|TABLE|DROP|ALTER|WITH|CASE|WHEN|THEN|ELSE|END|EXISTS|BY|ASC|DESC|INTO|VALUES|SET)\b/gi;
355
  const fn=/\b(COUNT|SUM|AVG|MAX|MIN|COALESCE|NULLIF|IFNULL|ROUND|FLOOR|CEIL|ABS|LENGTH|UPPER|LOWER|TRIM|SUBSTR|REPLACE|CAST|DATE|DATETIME|NOW|RANDOM|IIF|GROUP_CONCAT)\b/gi;
356
  return escapeHtml(raw)
357
  .replace(/(--[^\n]*)/g,m=>`<span class="cm">${m}</span>`)
358
- .replace(/('([^'\\]|\\.)*')/g,m=>`<span class="st">${m}</span>`)
359
- .replace(/\b(\d+(\.\d+)?)\b/g,m=>`<span class="nm">${m}</span>`)
360
  .replace(kw,m=>`<span class="kw">${m}</span>`)
361
  .replace(fn,m=>`<span class="fn">${m}</span>`)
362
- .replace(/([=<>!]+|[+\-*\/])/g,m=>`<span class="op">${m}</span>`);
363
  }
364
 
365
  function buildResultHtml(sql,results){
366
- let html=`<div class="sql-block"><div class="sql-block-header"><span>Generated SQL</span><button class="copy-btn" onclick="copySql(this)">Copy</button></div><div class="sql-code">${highlightSQL(sql)}</div></div>`;
 
 
 
 
 
 
 
 
 
 
 
 
367
  if(!results||results.length===0) return html+`<div style="margin-top:9px;font-size:12px;color:var(--muted);">No rows returned.</div>`;
368
  const cols=Object.keys(results[0]);
369
  let tbl=`<div class="result-table-wrap"><table><thead><tr>${cols.map(c=>`<th>${escapeHtml(c)}</th>`).join('')}</tr></thead><tbody>`;
 
11
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
12
 
13
  :root {
14
+ /* ── Core palette: slate/blue professional ── */
15
+ --bg: #0d1117;
16
+ --surface: #161b22;
17
+ --card: #1c2128;
18
+ --card2: #21262d;
19
+ --border: #30363d;
20
+ --border2: #3d444d;
21
+
22
+ /* ── Accent: cool indigo-blue ── */
23
+ --accent: #58a6ff;
24
+ --accent2: #388bfd;
25
+ --accent-dim: rgba(88,166,255,0.08);
26
+ --accent-glow: rgba(88,166,255,0.18);
27
+
28
+ /* ── SQL syntax colors (VSCode Dark+ inspired) ── */
29
+ --sql-keyword: #ff7b72; /* red-orange β€” SELECT FROM WHERE */
30
+ --sql-func: #d2a8ff; /* purple β€” COUNT AVG MAX */
31
+ --sql-string: #a5d6ff; /* light blue β€” 'string values' */
32
+ --sql-num: #79c0ff; /* blue β€” numbers */
33
+ --sql-comment: #484f58; /* grey β€” comments */
34
+ --sql-op: #ffa657; /* orange β€” = < > operators */
35
+ --sql-table: #56d364; /* green β€” table/column identifiers */
36
+ --sql-default: #c9d1d9; /* light grey β€” base text */
37
+
38
+ /* ── Semantic ── */
39
+ --danger: #f85149;
40
+ --success: #3fb950;
41
+ --warn: #d29922;
42
+ --text: #e6edf3;
43
+ --text2: #8b949e;
44
+ --muted: #484f58;
45
+
46
  --mono: 'JetBrains Mono', monospace;
47
  --sans: 'Inter', sans-serif;
48
  --radius: 8px;
 
53
 
54
  html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; overflow-x: hidden; }
55
 
56
+ /* ── Layout ── */
57
  #app { display: grid; grid-template-rows: var(--header-h) 1fr; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
58
 
59
+ /* ── Header ── */
60
  header { grid-column: 1/-1; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 100; }
61
  .logo-wrap { display: flex; align-items: center; gap: 10px; }
62
+ .logo-icon { width: 30px; height: 30px; background: linear-gradient(135deg, #388bfd, #58a6ff); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; box-shadow: 0 0 12px rgba(88,166,255,0.3); }
63
  .logo-text { font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--text); letter-spacing: -0.2px; }
64
  .logo-text span { color: var(--accent); }
65
+ #menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text2); font-size: 20px; padding: 4px; margin-right: 4px; line-height: 1; }
66
  .header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
67
+ .clear-btn { background: none; border: 1px solid var(--border2); color: var(--text2); font-size: 10px; padding: 4px 10px; border-radius: 5px; cursor: pointer; font-family: var(--mono); letter-spacing: 0.8px; transition: all 0.15s; text-transform: uppercase; }
68
+ .clear-btn:hover { border-color: var(--danger); color: var(--danger); background: rgba(248,81,73,0.06); }
69
  .status-wrap { display: flex; align-items: center; gap: 6px; }
70
  .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 3s ease-in-out infinite; }
71
+ .status-dot.ready { background: var(--success); animation: pulse-ok 2.5s ease-in-out infinite; }
72
  @keyframes blink { 0%,100%{opacity:.4} 50%{opacity:1} }
73
+ @keyframes pulse-ok { 0%,100%{box-shadow:0 0 0 0 rgba(63,185,80,0.4)} 50%{box-shadow:0 0 0 5px transparent} }
74
+ .badge { font-family: var(--mono); font-size: 10px; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border2); color: var(--text2); letter-spacing: 0.5px; }
75
+ .badge.active { border-color: rgba(88,166,255,0.4); color: var(--accent); background: var(--accent-dim); }
76
 
77
+ /* ── Sidebar ── */
78
  aside { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; transition: transform 0.25s ease; }
79
  .aside-section { padding: 16px 14px 12px; border-bottom: 1px solid var(--border); }
80
  .section-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-bottom: 10px; }
81
+
82
+ /* Upload */
83
  .upload-zone { border: 1.5px dashed var(--border2); border-radius: var(--radius); padding: 18px 12px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; background: var(--card); }
84
+ .upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 3px rgba(88,166,255,0.08); }
85
  .upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
86
  .upload-icon { font-size: 20px; margin-bottom: 6px; display: block; }
87
+ .upload-zone p { font-size: 12px; color: var(--text2); line-height: 1.5; }
88
+ .upload-zone p strong { color: var(--text); font-weight: 500; }
89
+
90
+ /* File info */
91
+ #file-info { display: none; background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 11px; font-size: 12px; margin-top: 10px; }
92
  #file-info.show { display: block; }
93
  .file-name { font-family: var(--mono); font-size: 10px; color: var(--accent); word-break: break-all; margin-bottom: 7px; font-weight: 600; }
94
+ .file-info-row { display: flex; justify-content: space-between; color: var(--text2); margin-bottom: 3px; }
95
+ .file-info-row span:first-child { color: var(--muted); }
96
  .schema-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin-top: 9px; margin-bottom: 4px; }
97
+ #schema-box { display: none; font-family: var(--mono); font-size: 10px; color: var(--text2); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 8px; max-height: 100px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.7; }
98
  #schema-box.show { display: block; }
99
+
100
+ /* Suggestions */
101
  .aside-section.suggestions { flex: 1; overflow-y: auto; }
102
  #suggestions-list { display: flex; flex-direction: column; gap: 5px; }
103
+ .suggestion-chip { padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border); background: transparent; font-size: 11px; color: var(--text2); cursor: pointer; transition: all 0.15s; text-align: left; font-family: var(--sans); line-height: 1.4; }
104
  .suggestion-chip:hover { border-color: var(--accent2); color: var(--text); background: var(--accent-dim); }
105
 
106
+ /* ── Main ── */
107
+ main { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
108
+ #chat { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
109
+
110
+ /* Empty state */
111
+ #empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text2); text-align: center; padding: 40px 20px; }
112
+ .empty-icon { font-size: 38px; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 4px 12px rgba(88,166,255,0.2)); }
113
+ @keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
114
+ #empty-state h2 { font-size: 15px; color: var(--text); font-weight: 500; }
115
+ #empty-state p { font-size: 12px; max-width: 300px; line-height: 1.7; color: var(--text2); }
116
+
117
+ /* ── Messages ── */
118
+ .msg { display: flex; flex-direction: column; gap: 3px; max-width: 800px; width: 100%; }
119
+ .msg.user { align-self: flex-end; align-items: flex-end; max-width: 75%; }
120
  .msg.assistant { align-self: flex-start; align-items: flex-start; }
121
  .msg-meta { font-size: 10px; color: var(--muted); font-family: var(--mono); padding: 0 4px; }
122
  .bubble { padding: 11px 15px; border-radius: var(--radius-lg); font-size: 13.5px; line-height: 1.65; }
123
+ .msg.user .bubble { background: var(--accent2); color: #fff; border-bottom-right-radius: 4px; font-weight: 400; }
124
+ .msg.assistant .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); width: 100%; }
125
 
126
+ /* ── SQL Block ── */
127
+ .sql-block { background: #010409; border: 1px solid var(--border2); border-radius: var(--radius); margin-top: 10px; overflow: hidden; }
128
  .sql-block-header { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; background: var(--card2); border-bottom: 1px solid var(--border); }
129
+ .sql-block-label { display: flex; align-items: center; gap: 6px; }
130
+ .sql-dot { width: 8px; height: 8px; border-radius: 50%; }
131
+ .sql-dot-r { background: #f85149; }
132
+ .sql-dot-y { background: #d29922; }
133
+ .sql-dot-g { background: #3fb950; }
134
+ .sql-block-header span.sql-lang { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text2); margin-left: 4px; }
135
+ .copy-btn { background: none; border: 1px solid var(--border2); color: var(--text2); font-size: 10px; padding: 3px 8px; border-radius: 4px; cursor: pointer; font-family: var(--mono); transition: all 0.15s; }
136
  .copy-btn:hover { border-color: var(--accent); color: var(--accent); }
137
+
138
+ /* SQL syntax highlighting */
139
+ .sql-code { padding: 16px 18px; font-family: var(--mono); font-size: 12.5px; line-height: 2; color: var(--sql-default); white-space: pre-wrap; word-break: break-word; }
140
+ .sql-code .kw { color: var(--sql-keyword); font-weight: 600; } /* SELECT FROM WHERE */
141
+ .sql-code .fn { color: var(--sql-func); } /* COUNT AVG */
142
+ .sql-code .st { color: var(--sql-string); } /* 'strings' */
143
+ .sql-code .nm { color: var(--sql-num); } /* numbers */
144
+ .sql-code .cm { color: var(--sql-comment); font-style: italic; } /* -- comments */
145
+ .sql-code .op { color: var(--sql-op); } /* = < > */
146
+ .sql-code .id { color: var(--sql-table); } /* identifiers */
147
+
148
+ /* ── Result Table ── */
149
+ .result-table-wrap { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: 280px; }
150
  table { width: 100%; border-collapse: collapse; font-size: 12px; }
151
  thead th { position: sticky; top: 0; background: var(--card2); padding: 8px 13px; text-align: left; font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: 0.8px; border-bottom: 1px solid var(--border2); white-space: nowrap; }
152
  tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
153
  tbody tr:last-child { border-bottom: none; }
154
+ tbody tr:hover { background: rgba(88,166,255,0.04); }
155
+ td { padding: 7px 13px; color: var(--text2); white-space: nowrap; font-size: 12px; }
156
  .result-count { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 5px; padding-left: 2px; }
157
+
158
+ /* Error */
159
+ .error-bubble { background: rgba(248,81,73,0.06); border: 1px solid rgba(248,81,73,0.25); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: #ffa198; margin-top: 8px; font-family: var(--mono); }
160
 
161
  /* Thinking */
162
  .thinking { display: flex; gap: 5px; align-items: center; padding: 12px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); border-bottom-left-radius: 4px; }
163
  .thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: think 1.2s ease-in-out infinite; }
164
  .thinking span:nth-child(2){animation-delay:.2s} .thinking span:nth-child(3){animation-delay:.4s}
165
+ @keyframes think { 0%,60%,100%{transform:translateY(0);opacity:.3} 30%{transform:translateY(-6px);opacity:1} }
166
 
167
+ /* ── Input Bar ── */
168
  .input-bar { padding: 12px 20px 14px; background: var(--surface); border-top: 1px solid var(--border); }
169
  .input-row { display: flex; gap: 9px; align-items: flex-end; }
170
+ #question-input { flex: 1; background: var(--card); border: 1.5px solid var(--border2); border-radius: var(--radius); padding: 10px 13px; font-size: 14px; font-family: var(--sans); color: var(--text); resize: none; min-height: 44px; max-height: 120px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; line-height: 1.5; }
171
+ #question-input:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(88,166,255,0.1); }
172
  #question-input::placeholder { color: var(--muted); }
173
+ #question-input:disabled { opacity: 0.4; cursor: not-allowed; }
174
+ #send-btn { background: var(--accent2); color: #fff; border: none; border-radius: var(--radius); width: 44px; height: 44px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; font-weight: 700; }
175
+ #send-btn:hover { background: var(--accent); box-shadow: 0 0 12px rgba(88,166,255,0.35); transform: scale(1.04); }
176
+ #send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }
177
  .input-hint { font-size: 11px; color: var(--muted); margin-top: 5px; padding-left: 2px; }
178
 
179
  /* Toast */
180
+ #toast { position: fixed; bottom: 20px; right: 20px; background: var(--card2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 9px 15px; font-size: 12px; font-family: var(--mono); color: var(--text); z-index: 9999; transform: translateY(50px); opacity: 0; transition: all 0.3s cubic-bezier(.34,1.56,.64,1); pointer-events: none; max-width: 280px; }
181
  #toast.show { transform: translateY(0); opacity: 1; }
182
+ #toast.success { border-color: rgba(63,185,80,0.4); color: #56d364; }
183
+ #toast.error { border-color: rgba(248,81,73,0.4); color: #ffa198; }
184
 
185
  /* Loading bar */
186
+ #loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent2), var(--accent), #79c0ff); z-index: 10000; transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease; }
187
  #loading-bar.active { transform: scaleX(0.8); }
188
  #loading-bar.done { transform: scaleX(1); opacity: 0; transition: opacity 0.4s 0.1s; }
189
 
 
191
  ::-webkit-scrollbar { width: 5px; height: 5px; }
192
  ::-webkit-scrollbar-track { background: transparent; }
193
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
194
+ ::-webkit-scrollbar-thumb:hover { background: var(--text2); }
195
 
196
+ /* Mobile overlay */
197
+ #overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90; backdrop-filter: blur(2px); }
198
  #overlay.show { display: block; }
199
 
200
  /* ── RESPONSIVE ── */
 
202
  :root { --sidebar-w: 240px; }
203
  #chat { padding: 14px 16px; }
204
  .input-bar { padding: 10px 16px 12px; }
205
+ .msg.user { max-width: 85%; }
206
  }
207
 
208
  @media (max-width: 640px) {
209
  :root { --header-h: 50px; }
210
  #app { grid-template-columns: 1fr; }
211
+ #menu-btn { display: flex; align-items: center; }
212
+ aside { position: fixed; top: var(--header-h); left: 0; width: 80vw; max-width: 300px; height: calc(100vh - var(--header-h)); z-index: 95; transform: translateX(-100%); box-shadow: 6px 0 24px rgba(0,0,0,0.5); }
213
  aside.open { transform: translateX(0); }
214
  main { grid-column: 1; }
215
+ .msg { max-width: 100%; }
216
+ .msg.user { max-width: 88%; }
217
  #chat { padding: 12px; gap: 12px; }
218
  .bubble { padding: 10px 13px; font-size: 13px; }
219
+ .sql-code { font-size: 11px; padding: 12px; line-height: 1.8; }
220
+ td, thead th { padding: 6px 10px; font-size: 11px; }
221
  .input-bar { padding: 8px 12px 10px; }
222
  .input-hint { display: none; }
223
  .status-wrap .badge { display: none; }
224
+ #toast { bottom: 12px; right: 12px; left: 12px; max-width: none; }
225
  }
226
 
227
  @media (max-width: 380px) {
228
  .logo-text { font-size: 13px; }
229
+ .clear-btn { padding: 3px 7px; font-size: 9px; }
230
  }
231
  </style>
232
  </head>
 
243
  <div class="logo-text">Query<span>Mind</span></div>
244
  </div>
245
  <div class="header-right">
246
+ <button class="clear-btn" onclick="clearChat()">Clear</button>
247
  <div class="status-wrap">
248
  <span id="status-dot" class="status-dot"></span>
249
+ <span id="status-label" class="badge">Loading</span>
250
  </div>
251
  </div>
252
  </header>
 
270
  <div class="aside-section suggestions">
271
  <div class="section-label">Example Queries</div>
272
  <div id="suggestions-list">
273
+ <div class="suggestion-chip" style="cursor:default;font-style:italic;">Upload CSV to see examples</div>
274
  </div>
275
  </div>
276
  </aside>
 
280
  <div id="empty-state">
281
  <div class="empty-icon">πŸ—‚οΈ</div>
282
  <h2>Ask anything about your data</h2>
283
+ <p>Upload a CSV from the sidebar, then ask a question in plain English. QueryMind converts it to SQL and shows results instantly.</p>
284
  </div>
285
  </div>
286
  <div class="input-bar">
287
  <div class="input-row">
288
  <textarea id="question-input" placeholder="e.g. Show top 10 rows by sales…" rows="1" disabled></textarea>
289
+ <button id="send-btn" disabled title="Send (Enter)">↑</button>
290
  </div>
291
  <div class="input-hint">Enter to send &nbsp;Β·&nbsp; Shift+Enter new line</div>
292
  </div>
 
318
  checkHealth();
319
 
320
  let toastTimer;
321
+ function showToast(msg,type='success'){ toast.textContent=msg; toast.className=`show ${type}`; clearTimeout(toastTimer); toastTimer=setTimeout(()=>toast.className='',3200); }
322
 
323
  function startLoading(){ loadingBar.className='active'; isLoading=true; sendBtn.disabled=true; input.disabled=true; }
324
  function stopLoading(){ loadingBar.className='done'; isLoading=false; if(sessionId){sendBtn.disabled=false;input.disabled=false;} setTimeout(()=>loadingBar.className='',600); }
 
384
  }
385
 
386
  function highlightSQL(raw){
387
+ const kw=/\b(SELECT|FROM|WHERE|AND|OR|NOT|IN|IS|NULL|LIKE|BETWEEN|ORDER\s+BY|GROUP\s+BY|HAVING|LIMIT|OFFSET|DISTINCT|AS|JOIN|LEFT|RIGHT|INNER|OUTER|ON|UNION|ALL|INSERT|UPDATE|DELETE|CREATE|TABLE|DROP|ALTER|WITH|CASE|WHEN|THEN|ELSE|END|EXISTS|BY|ASC|DESC|INTO|VALUES|SET)\b/gi;
388
  const fn=/\b(COUNT|SUM|AVG|MAX|MIN|COALESCE|NULLIF|IFNULL|ROUND|FLOOR|CEIL|ABS|LENGTH|UPPER|LOWER|TRIM|SUBSTR|REPLACE|CAST|DATE|DATETIME|NOW|RANDOM|IIF|GROUP_CONCAT)\b/gi;
389
  return escapeHtml(raw)
390
  .replace(/(--[^\n]*)/g,m=>`<span class="cm">${m}</span>`)
391
+ .replace(/('(?:[^'\\]|\\.)*')/g,m=>`<span class="st">${m}</span>`)
392
+ .replace(/\b(\d+(?:\.\d+)?)\b/g,m=>`<span class="nm">${m}</span>`)
393
  .replace(kw,m=>`<span class="kw">${m}</span>`)
394
  .replace(fn,m=>`<span class="fn">${m}</span>`)
395
+ .replace(/(?<![<\w])([=<>!]+|[+\-*\/])(?![\w>])/g,m=>`<span class="op">${m}</span>`);
396
  }
397
 
398
  function buildResultHtml(sql,results){
399
+ let html=`
400
+ <div class="sql-block">
401
+ <div class="sql-block-header">
402
+ <div class="sql-block-label">
403
+ <span class="sql-dot sql-dot-r"></span>
404
+ <span class="sql-dot sql-dot-y"></span>
405
+ <span class="sql-dot sql-dot-g"></span>
406
+ <span class="sql-lang">SQL</span>
407
+ </div>
408
+ <button class="copy-btn" onclick="copySql(this)">Copy</button>
409
+ </div>
410
+ <div class="sql-code">${highlightSQL(sql)}</div>
411
+ </div>`;
412
  if(!results||results.length===0) return html+`<div style="margin-top:9px;font-size:12px;color:var(--muted);">No rows returned.</div>`;
413
  const cols=Object.keys(results[0]);
414
  let tbl=`<div class="result-table-wrap"><table><thead><tr>${cols.map(c=>`<th>${escapeHtml(c)}</th>`).join('')}</tr></thead><tbody>`;