File size: 11,313 Bytes
526b4b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
096629f
 
 
 
 
 
 
 
 
 
 
 
 
 
526b4b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
096629f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526b4b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/* ============================================================
   MMaxAI Hosting Panel β€” AI chat overlay
   ------------------------------------------------------------
   Floating overlay that opens from either the dedicated
   "Ask AI" button in the topbar or the inline cmd-bar
   Enter-press.  Layout uses the same dark Copilot tokens
   already defined in copilot.css, so it picks up theme
   changes automatically.
   ============================================================ */

/* AI trigger button (topbar) β€” sits between Cmd+K and the
   language toggle.  Mirrors the .search-trigger shape. */
.ai-trigger {
    display: inline-flex; align-items: center; gap: 10px;
    width: auto;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
    text-align: left;
}
.ai-trigger:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.ai-trigger svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--accent-2); }
.ai-trigger .label { flex: 1; }
.ai-trigger kbd {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
}

/* AI trigger β€” a touch more eye-catching so people actually notice it.
   Slightly stronger border, accent-tinted icon, and a soft glow on hover. */
.ai-trigger-primary {
    background: linear-gradient(180deg, rgba(124,108,255,0.10), rgba(124,108,255,0.04));
    border-color: rgba(124,108,255,0.45);
    color: var(--text);
}
.ai-trigger-primary:hover {
    background: linear-gradient(180deg, rgba(124,108,255,0.18), rgba(124,108,255,0.06));
    border-color: rgba(124,108,255,0.75);
    box-shadow: 0 0 0 3px rgba(124,108,255,0.12);
}
.ai-trigger-primary svg { color: var(--accent); }

/* Hide the AI trigger when no API key is set.  The JS toggles
   ``[data-ai-disabled]`` on <body> based on /api/ai/status. */
body[data-ai-disabled="true"] .ai-trigger { display: none; }

/* ---- Overlay shell ---- */
.ai-overlay {
    position: fixed; inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.ai-overlay[data-open="true"] {
    display: flex;
    pointer-events: auto;
    animation: ai-fade 140ms var(--ease);
}
@keyframes ai-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ai-backdrop {
    position: absolute; inset: 0;
    background: rgba(4, 6, 14, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ai-panel {
    position: relative;
    width: min(720px, calc(100% - 32px));
    height: min(720px, calc(100vh - 80px));
    background: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ai-pop 180ms var(--ease);
}
@keyframes ai-pop {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1);     opacity: 1; }
}

@media (max-width: 720px) {
    .ai-panel {
        height: calc(100vh - 24px);
        border-radius: var(--radius);
    }
}

/* ---- Header ---- */
.ai-head {
    display: flex; align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 28, 0.4);
}
.ai-head-left {
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 0;
}
.ai-spark { color: var(--accent-2); flex: 0 0 auto; }
.ai-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}
.ai-sub {
    margin-top: 1px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.ai-head-right {
    display: flex; align-items: center; gap: 6px;
    flex: 0 0 auto;
}
.ai-model-tag {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    margin-right: 4px;
}
.ai-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: grid; place-items: center;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ai-icon:hover { background: var(--surface-hover); color: var(--text); }

/* ---- Transcript scroll ---- */
.ai-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
    /* Reserve room for the scrollbar so messages don't get a
       1-frame jump when content overflows vs when it doesn't. */
    scrollbar-gutter: stable;
}
/* WebKit (Chrome / Edge / Safari) β€” slim, themed scrollbar */
.ai-transcript::-webkit-scrollbar { width: 8px; height: 8px; }
.ai-transcript::-webkit-scrollbar-track { background: transparent; }
.ai-transcript::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.14);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.ai-transcript::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); background-clip: padding-box; border: 2px solid transparent; }

/* ---- Message bubbles ---- */
.ai-msg {
    display: flex;
    width: 100%;
    animation: ai-bubble-in 160ms var(--ease);
}
@keyframes ai-bubble-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-msg-user { justify-content: flex-end; }
.ai-msg-assistant { justify-content: flex-start; }

.ai-bubble {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.ai-msg-user .ai-bubble {
    background: var(--surface-2);
    color: var(--text);
    border-bottom-right-radius: 4px;
}
.ai-msg-assistant .ai-bubble {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.ai-msg-error .ai-bubble {
    background: rgba(248, 113, 113, 0.10);
    color: var(--status-error);
    border: 1px solid rgba(248, 113, 113, 0.32);
}

/* Markdown-ish styling inside assistant bubbles.  Light touch β€”
   the upstream is instructed to keep replies short, so we don't
   need a full markdown renderer. */
.ai-bubble code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent-2);
}
.ai-bubble pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.55;
}
.ai-bubble pre code {
    background: transparent;
    padding: 0;
    color: var(--text);
}
.ai-bubble strong { font-weight: 600; }
.ai-bubble em { font-style: italic; color: var(--text-muted); }

.ai-msg-meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-faint);
}

/* Quick-reply chips on the empty-state bubble. */
.ai-hint {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ai-quick {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.ai-quick:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

/* Typing indicator β€” three pulsing dots. */
.ai-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 1em;
}
.ai-typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: ai-bounce 1.2s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

/* ---- Input form ---- */
.ai-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: rgba(10, 14, 28, 0.4);
}
.ai-form textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 200px;
    line-height: 1.45;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.ai-form textarea:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.18);
}
.ai-form textarea::placeholder { color: var(--text-faint); }

.ai-send {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--text);
    color: var(--bg);
    display: grid; place-items: center;
    border: 0;
    cursor: pointer;
    transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    flex: 0 0 auto;
}
.ai-send:hover { opacity: 0.9; }
.ai-send:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-send svg { width: 14px; height: 14px; }
.ai-send.is-streaming { background: var(--status-error); color: #1f0405; }

/* Disabled state β€” overlay still renders the empty hint but the
   input doesn't accept content.  Toggled by JS when /api/ai/status
   reports `enabled: false`. */
body[data-ai-disabled="true"] .ai-form textarea { display: none; }
body[data-ai-disabled="true"] .ai-send { display: none; }
body[data-ai-disabled="true"] .ai-form {
    padding: 18px;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
}
body[data-ai-disabled="true"] .ai-form::before {
    content: "AI assistant is not configured on this panel. Set NVIDIA_API_KEY in env.";
}

/* Empty-state message is hidden once there's any conversation. */
.ai-transcript[data-has-messages="true"] [data-empty] { display: none; }

/* Mobile stacking β€” chat bubble spans more of the width on small
   screens, signature stays legible. */
@media (max-width: 540px) {
    .ai-bubble { max-width: 95%; }
    .ai-form { padding: 10px; }
    .ai-form textarea { font-size: 15px; }
}

/* ---- Cmd-bar β†’ AI button trigger (topbar) is hidden on mobile
   to leave room for the Cmd+K shortcut. ---- */
@media (max-width: 720px) {
    .ai-trigger .label { display: none; }
}