@enfin/chat 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +224 -0
  2. package/dist/assets/music/i_phone_message.mp3 +0 -0
  3. package/dist/call/WebRTCManager.d.ts +54 -0
  4. package/dist/call/WebRTCManager.js +274 -0
  5. package/dist/call/signaling.d.ts +3 -0
  6. package/dist/call/signaling.js +24 -0
  7. package/dist/call/types.d.ts +25 -0
  8. package/dist/call/types.js +13 -0
  9. package/dist/components/Chat.d.ts +14 -0
  10. package/dist/components/Chat.js +452 -0
  11. package/dist/components/index.d.ts +3 -0
  12. package/dist/components/index.js +2 -0
  13. package/dist/context/ChatContext.d.ts +59 -0
  14. package/dist/context/ChatContext.js +647 -0
  15. package/dist/esm/call/WebRTCManager.d.ts +54 -0
  16. package/dist/esm/call/WebRTCManager.js +274 -0
  17. package/dist/esm/call/signaling.d.ts +3 -0
  18. package/dist/esm/call/signaling.js +24 -0
  19. package/dist/esm/call/types.d.ts +25 -0
  20. package/dist/esm/call/types.js +13 -0
  21. package/dist/esm/components/Chat.d.ts +14 -0
  22. package/dist/esm/components/Chat.js +452 -0
  23. package/dist/esm/components/index.d.ts +3 -0
  24. package/dist/esm/components/index.js +2 -0
  25. package/dist/esm/context/ChatContext.d.ts +59 -0
  26. package/dist/esm/context/ChatContext.js +647 -0
  27. package/dist/esm/hooks/index.d.ts +6 -0
  28. package/dist/esm/hooks/index.js +6 -0
  29. package/dist/esm/hooks/useCall.d.ts +15 -0
  30. package/dist/esm/hooks/useCall.js +38 -0
  31. package/dist/esm/hooks/useChat.d.ts +23 -0
  32. package/dist/esm/hooks/useChat.js +40 -0
  33. package/dist/esm/hooks/useMessages.d.ts +17 -0
  34. package/dist/esm/hooks/useMessages.js +38 -0
  35. package/dist/esm/hooks/usePresence.d.ts +4 -0
  36. package/dist/esm/hooks/usePresence.js +12 -0
  37. package/dist/esm/hooks/useRooms.d.ts +9 -0
  38. package/dist/esm/hooks/useRooms.js +19 -0
  39. package/dist/esm/hooks/useSocket.d.ts +7 -0
  40. package/dist/esm/hooks/useSocket.js +92 -0
  41. package/dist/esm/index.d.ts +11 -0
  42. package/dist/esm/index.js +15 -0
  43. package/dist/esm/utils/index.d.ts +2 -0
  44. package/dist/esm/utils/index.js +2 -0
  45. package/dist/esm/utils/ringtone.d.ts +2 -0
  46. package/dist/esm/utils/ringtone.js +39 -0
  47. package/dist/esm/utils/testUtils.d.ts +102 -0
  48. package/dist/esm/utils/testUtils.js +153 -0
  49. package/dist/hooks/index.d.ts +6 -0
  50. package/dist/hooks/index.js +6 -0
  51. package/dist/hooks/useCall.d.ts +15 -0
  52. package/dist/hooks/useCall.js +38 -0
  53. package/dist/hooks/useChat.d.ts +23 -0
  54. package/dist/hooks/useChat.js +40 -0
  55. package/dist/hooks/useMessages.d.ts +17 -0
  56. package/dist/hooks/useMessages.js +38 -0
  57. package/dist/hooks/usePresence.d.ts +4 -0
  58. package/dist/hooks/usePresence.js +12 -0
  59. package/dist/hooks/useRooms.d.ts +9 -0
  60. package/dist/hooks/useRooms.js +19 -0
  61. package/dist/hooks/useSocket.d.ts +7 -0
  62. package/dist/hooks/useSocket.js +92 -0
  63. package/dist/index.d.ts +11 -0
  64. package/dist/index.js +15 -0
  65. package/dist/public/music/i_phone_message.mp3 +0 -0
  66. package/dist/style.css +1226 -0
  67. package/dist/utils/index.d.ts +2 -0
  68. package/dist/utils/index.js +2 -0
  69. package/dist/utils/ringtone.d.ts +2 -0
  70. package/dist/utils/ringtone.js +39 -0
  71. package/dist/utils/testUtils.d.ts +102 -0
  72. package/dist/utils/testUtils.js +153 -0
  73. package/package.json +44 -0
package/dist/style.css ADDED
@@ -0,0 +1,1226 @@
1
+ /* @enfin/chat - Default Styles */
2
+ /* White theme by default; pass theme="dark" to Chat to enable dark mode */
3
+
4
+ /* ============================================
5
+ THEME VARIABLES
6
+ ============================================ */
7
+
8
+ /* Light theme (default) */
9
+ .theme-light {
10
+ --bg-container: #ffffff;
11
+ --bg-sidebar: #f7f8fa;
12
+ --bg-header: #ffffff;
13
+ --bg-room-header: #ffffff;
14
+ --bg-message-area: #f5f5f5;
15
+ --bg-input: #ffffff;
16
+ --bg-message-sent: #dcf8c6;
17
+ --bg-message-received: #ffffff;
18
+ --bg-hover: #eef0f3;
19
+ --bg-active: #e3f2fd;
20
+ --border-color: #e0e0e0;
21
+ --text-primary: #303030;
22
+ --text-secondary: #777777;
23
+ --text-on-header: #303030;
24
+ --online-dot: #4caf50;
25
+ --accent: #1976d2;
26
+ --accent-hover: #1565c0;
27
+ --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
28
+ }
29
+
30
+ /* Dark theme */
31
+ .theme-dark {
32
+ --bg-container: #0d1b2a;
33
+ --bg-sidebar: #1b263b;
34
+ --bg-header: #1b263b;
35
+ --bg-room-header: #1b263b;
36
+ --bg-message-area: #0d1b2a;
37
+ --bg-input: #1b263b;
38
+ --bg-message-sent: #1565c0;
39
+ --bg-message-received: #2c3e50;
40
+ --bg-hover: #2c3e50;
41
+ --bg-active: #1565c0;
42
+ --border-color: #2c3e50;
43
+ --text-primary: #ffffff;
44
+ --text-secondary: #b0bec5;
45
+ --text-on-header: #ffffff;
46
+ --online-dot: #4caf50;
47
+ --accent: #64b5f6;
48
+ --accent-hover: #90caf9;
49
+ --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
50
+ }
51
+
52
+ /* ============================================
53
+ CHAT CONTAINER
54
+ ============================================ */
55
+
56
+ .chat-container {
57
+ display: flex;
58
+ flex-direction: column;
59
+ height: 100vh;
60
+ width: 100%;
61
+ background: var(--bg-container);
62
+ color: var(--text-primary);
63
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
64
+ overflow: hidden;
65
+ }
66
+
67
+ /* ============================================
68
+ TOP APP HEADER
69
+ ============================================ */
70
+
71
+ .app-topbar {
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: space-between;
75
+ padding: 10px 20px;
76
+ background: var(--bg-header);
77
+ color: var(--text-on-header);
78
+ border-bottom: 1px solid var(--border-color);
79
+ min-height: 56px;
80
+ flex-shrink: 0;
81
+ }
82
+
83
+ .app-brand {
84
+ font-size: 18px;
85
+ font-weight: 600;
86
+ color: var(--accent);
87
+ letter-spacing: 0.3px;
88
+ }
89
+
90
+ .app-user {
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 10px;
94
+ }
95
+
96
+ .app-user-avatar {
97
+ width: 36px;
98
+ height: 36px;
99
+ border-radius: 50%;
100
+ background: var(--accent);
101
+ color: #fff;
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ font-weight: 600;
106
+ font-size: 14px;
107
+ flex-shrink: 0;
108
+ }
109
+
110
+ .app-user-name {
111
+ font-size: 14px;
112
+ font-weight: 500;
113
+ color: var(--text-on-header);
114
+ }
115
+
116
+ .app-switch-btn {
117
+ width: 32px;
118
+ height: 32px;
119
+ background: transparent;
120
+ color: var(--accent);
121
+ border: 1px solid var(--border-color);
122
+ border-radius: 50%;
123
+ cursor: pointer;
124
+ font-size: 16px;
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ transition: background 0.15s, border-color 0.15s, transform 0.15s;
129
+ flex-shrink: 0;
130
+ }
131
+
132
+ .app-switch-btn:hover {
133
+ background: var(--bg-hover);
134
+ border-color: var(--accent);
135
+ transform: rotate(180deg);
136
+ }
137
+
138
+ /* Body: sidebar + main area */
139
+ .chat-body {
140
+ display: flex;
141
+ flex: 1;
142
+ min-height: 0;
143
+ }
144
+
145
+ /* ============================================
146
+ SIDEBAR (USERS LIST)
147
+ ============================================ */
148
+
149
+ .chat-sidebar {
150
+ width: 280px;
151
+ border-right: 1px solid var(--border-color);
152
+ display: flex;
153
+ flex-direction: column;
154
+ background: var(--bg-sidebar);
155
+ min-height: 0;
156
+ }
157
+
158
+ .chat-sidebar-header {
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: space-between;
162
+ padding: 14px 16px;
163
+ font-size: 13px;
164
+ font-weight: 600;
165
+ text-transform: uppercase;
166
+ letter-spacing: 0.5px;
167
+ color: var(--text-secondary);
168
+ border-bottom: 1px solid var(--border-color);
169
+ min-height: 44px;
170
+ }
171
+
172
+ .refresh-users-btn {
173
+ width: 26px;
174
+ height: 26px;
175
+ background: transparent;
176
+ border: none;
177
+ color: var(--text-secondary);
178
+ cursor: pointer;
179
+ font-size: 16px;
180
+ display: flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ border-radius: 50%;
184
+ transition: background 0.15s, color 0.15s;
185
+ }
186
+
187
+ .refresh-users-btn:hover {
188
+ background: var(--bg-hover);
189
+ color: var(--accent);
190
+ }
191
+
192
+ .user-list {
193
+ flex: 1;
194
+ overflow-y: auto;
195
+ min-height: 0;
196
+ }
197
+
198
+ .user-item {
199
+ display: flex;
200
+ align-items: center;
201
+ padding: 12px 16px;
202
+ cursor: pointer;
203
+ border-bottom: 1px solid var(--border-color);
204
+ transition: background 0.15s;
205
+ gap: 12px;
206
+ }
207
+
208
+ .user-item:hover {
209
+ background: var(--bg-hover);
210
+ }
211
+
212
+ .user-item.active {
213
+ background: var(--bg-active);
214
+ }
215
+
216
+ .user-avatar {
217
+ width: 40px;
218
+ height: 40px;
219
+ border-radius: 50%;
220
+ background: var(--accent);
221
+ color: #fff;
222
+ display: flex;
223
+ align-items: center;
224
+ justify-content: center;
225
+ font-weight: 600;
226
+ font-size: 15px;
227
+ flex-shrink: 0;
228
+ overflow: hidden;
229
+ }
230
+
231
+ .user-avatar img {
232
+ width: 100%;
233
+ height: 100%;
234
+ object-fit: cover;
235
+ }
236
+
237
+ .user-avatar-wrapper {
238
+ position: relative;
239
+ flex-shrink: 0;
240
+ }
241
+
242
+ .user-status {
243
+ font-size: 11px;
244
+ margin-top: 2px;
245
+ }
246
+
247
+ .status-online {
248
+ color: var(--online-dot);
249
+ font-weight: 500;
250
+ }
251
+
252
+ .status-offline {
253
+ color: var(--text-secondary);
254
+ }
255
+
256
+ /* ============================================
257
+ ONLINE INDICATOR DOT
258
+ ============================================ */
259
+
260
+ .online-indicator {
261
+ position: absolute;
262
+ bottom: -2px;
263
+ right: -2px;
264
+ width: 14px;
265
+ height: 14px;
266
+ background: var(--online-dot);
267
+ border: 2px solid var(--bg-sidebar);
268
+ border-radius: 50%;
269
+ box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
270
+ animation: pulse-online 2s infinite;
271
+ }
272
+
273
+ .online-indicator-sm {
274
+ width: 12px;
275
+ height: 12px;
276
+ border-width: 2px;
277
+ }
278
+
279
+ @keyframes pulse-online {
280
+ 0% {
281
+ box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
282
+ }
283
+ 70% {
284
+ box-shadow: 0 0 0 6px rgba(76, 175, 80, 0);
285
+ }
286
+ 100% {
287
+ box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
288
+ }
289
+ }
290
+
291
+ .user-info {
292
+ flex: 1;
293
+ overflow: hidden;
294
+ min-width: 0;
295
+ }
296
+
297
+ .user-name {
298
+ font-weight: 500;
299
+ font-size: 14px;
300
+ white-space: nowrap;
301
+ overflow: hidden;
302
+ text-overflow: ellipsis;
303
+ color: var(--text-primary);
304
+ }
305
+
306
+ /* ============================================
307
+ MAIN CHAT AREA
308
+ ============================================ */
309
+
310
+ .chat-main {
311
+ flex: 1;
312
+ display: flex;
313
+ flex-direction: column;
314
+ background: var(--bg-message-area);
315
+ min-height: 0;
316
+ }
317
+
318
+ /* Selected peer header (above messages) */
319
+ .chat-room-header {
320
+ display: flex;
321
+ align-items: center;
322
+ padding: 10px 16px;
323
+ background: var(--bg-room-header);
324
+ color: var(--text-on-header);
325
+ border-bottom: 1px solid var(--border-color);
326
+ gap: 12px;
327
+ min-height: 60px;
328
+ }
329
+
330
+ .chat-room-avatar {
331
+ width: 40px;
332
+ height: 40px;
333
+ border-radius: 50%;
334
+ background: var(--accent);
335
+ color: #fff;
336
+ display: flex;
337
+ align-items: center;
338
+ justify-content: center;
339
+ font-weight: 600;
340
+ font-size: 16px;
341
+ flex-shrink: 0;
342
+ }
343
+
344
+ .chat-room-avatar-wrapper {
345
+ position: relative;
346
+ flex-shrink: 0;
347
+ }
348
+
349
+ .chat-room-status {
350
+ font-size: 12px;
351
+ color: var(--text-secondary);
352
+ margin-top: 1px;
353
+ }
354
+
355
+ .chat-room-info {
356
+ flex: 1;
357
+ min-width: 0;
358
+ }
359
+
360
+ .chat-room-name {
361
+ font-size: 16px;
362
+ font-weight: 600;
363
+ white-space: nowrap;
364
+ overflow: hidden;
365
+ text-overflow: ellipsis;
366
+ color: var(--text-on-header);
367
+ }
368
+
369
+ /* Call button in room header */
370
+ .call-button {
371
+ width: 40px;
372
+ height: 40px;
373
+ background: transparent;
374
+ color: var(--accent);
375
+ border: 1px solid var(--border-color);
376
+ border-radius: 50%;
377
+ cursor: pointer;
378
+ display: flex;
379
+ align-items: center;
380
+ justify-content: center;
381
+ transition: background 0.15s, border-color 0.15s;
382
+ flex-shrink: 0;
383
+ }
384
+
385
+ .call-button:hover:not(:disabled) {
386
+ background: var(--bg-hover);
387
+ border-color: var(--accent);
388
+ }
389
+
390
+ .call-button:disabled {
391
+ opacity: 0.4;
392
+ cursor: not-allowed;
393
+ }
394
+
395
+ .call-button-active {
396
+ background: #f44336;
397
+ color: white;
398
+ border-color: #f44336;
399
+ animation: pulse-call 1.5s infinite;
400
+ }
401
+
402
+ .call-button-active:hover:not(:disabled) {
403
+ background: #d32f2f;
404
+ border-color: #d32f2f;
405
+ }
406
+
407
+ .call-button-calling {
408
+ background: #4caf50;
409
+ color: white;
410
+ border-color: #4caf50;
411
+ animation: pulse-call 1.2s infinite;
412
+ }
413
+
414
+ @keyframes pulse-call {
415
+ 0% {
416
+ box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
417
+ }
418
+ 70% {
419
+ box-shadow: 0 0 0 8px rgba(244, 67, 54, 0);
420
+ }
421
+ 100% {
422
+ box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
423
+ }
424
+ }
425
+
426
+ .call-icon {
427
+ font-size: 16px;
428
+ line-height: 1;
429
+ }
430
+
431
+ .message-area {
432
+ flex: 1;
433
+ overflow-y: auto;
434
+ padding: 16px;
435
+ min-height: 0;
436
+ }
437
+
438
+ .messages {
439
+ display: flex;
440
+ flex-direction: column;
441
+ gap: 6px;
442
+ }
443
+
444
+ /* ============================================
445
+ MESSAGE BUBBLES
446
+ ============================================ */
447
+
448
+ .message {
449
+ display: flex;
450
+ max-width: 70%;
451
+ }
452
+
453
+ .message.sent {
454
+ align-self: flex-end;
455
+ }
456
+
457
+ .message.received {
458
+ align-self: flex-start;
459
+ }
460
+
461
+ .message-content {
462
+ padding: 8px 12px;
463
+ border-radius: 8px;
464
+ position: relative;
465
+ box-shadow: var(--shadow);
466
+ color: var(--text-primary);
467
+ }
468
+
469
+ .message.sent .message-content {
470
+ background: var(--bg-message-sent);
471
+ border-top-right-radius: 0;
472
+ }
473
+
474
+ .message.received .message-content {
475
+ background: var(--bg-message-received);
476
+ border-top-left-radius: 0;
477
+ border: 1px solid var(--border-color);
478
+ }
479
+
480
+ .message-sender {
481
+ font-size: 12px;
482
+ font-weight: 600;
483
+ margin-bottom: 2px;
484
+ color: var(--accent);
485
+ }
486
+
487
+ .message-body {
488
+ word-wrap: break-word;
489
+ font-size: 14px;
490
+ line-height: 1.4;
491
+ color: var(--text-primary);
492
+ }
493
+
494
+ .message-body a {
495
+ color: var(--accent);
496
+ text-decoration: underline;
497
+ }
498
+
499
+ .message-time {
500
+ font-size: 10px;
501
+ color: var(--text-secondary);
502
+ margin-top: 2px;
503
+ text-align: right;
504
+ }
505
+
506
+ /* File message bubble */
507
+ .file-message {
508
+ display: flex;
509
+ align-items: center;
510
+ gap: 8px;
511
+ padding: 4px 0;
512
+ }
513
+
514
+ .file-link {
515
+ color: var(--accent);
516
+ text-decoration: underline;
517
+ font-weight: 500;
518
+ display: flex;
519
+ align-items: center;
520
+ gap: 6px;
521
+ }
522
+
523
+ .file-icon {
524
+ font-size: 16px;
525
+ flex-shrink: 0;
526
+ }
527
+
528
+ /* Image message bubble */
529
+ .image-message {
530
+ display: block;
531
+ text-decoration: none;
532
+ max-width: 100%;
533
+ }
534
+
535
+ .message-image {
536
+ display: block;
537
+ max-width: 280px;
538
+ max-height: 300px;
539
+ border-radius: 6px;
540
+ cursor: pointer;
541
+ object-fit: cover;
542
+ }
543
+
544
+ /* ============================================
545
+ FILE PREVIEW (in input area)
546
+ ============================================ */
547
+
548
+ .file-preview {
549
+ display: flex;
550
+ align-items: center;
551
+ gap: 10px;
552
+ padding: 10px 12px;
553
+ background: var(--bg-hover);
554
+ border-top: 1px solid var(--border-color);
555
+ position: relative;
556
+ }
557
+
558
+ .file-preview-image {
559
+ max-width: 80px;
560
+ max-height: 80px;
561
+ border-radius: 6px;
562
+ object-fit: cover;
563
+ border: 1px solid var(--border-color);
564
+ }
565
+
566
+ .file-preview-doc {
567
+ display: flex;
568
+ align-items: center;
569
+ gap: 8px;
570
+ flex: 1;
571
+ min-width: 0;
572
+ }
573
+
574
+ .file-preview-icon {
575
+ font-size: 24px;
576
+ flex-shrink: 0;
577
+ }
578
+
579
+ .file-preview-name {
580
+ font-size: 13px;
581
+ color: var(--text-primary);
582
+ white-space: nowrap;
583
+ overflow: hidden;
584
+ text-overflow: ellipsis;
585
+ }
586
+
587
+ .file-preview-remove {
588
+ width: 28px;
589
+ height: 28px;
590
+ background: transparent;
591
+ color: var(--text-secondary);
592
+ border: none;
593
+ border-radius: 50%;
594
+ cursor: pointer;
595
+ font-size: 14px;
596
+ display: flex;
597
+ align-items: center;
598
+ justify-content: center;
599
+ flex-shrink: 0;
600
+ margin-left: auto;
601
+ transition: background 0.15s, color 0.15s;
602
+ }
603
+
604
+ .file-preview-remove:hover {
605
+ background: var(--bg-message-received);
606
+ color: #f44336;
607
+ }
608
+
609
+ /* ============================================
610
+ TYPING INDICATOR
611
+ ============================================ */
612
+
613
+ .typing-indicator {
614
+ display: flex;
615
+ align-items: center;
616
+ gap: 4px;
617
+ padding: 6px 12px;
618
+ font-size: 12px;
619
+ color: var(--text-secondary);
620
+ }
621
+
622
+ .typing-dot {
623
+ width: 6px;
624
+ height: 6px;
625
+ background: var(--text-secondary);
626
+ border-radius: 50%;
627
+ animation: typing 1.4s infinite;
628
+ }
629
+
630
+ .typing-dot:nth-child(2) {
631
+ animation-delay: 0.2s;
632
+ }
633
+
634
+ .typing-dot:nth-child(3) {
635
+ animation-delay: 0.4s;
636
+ }
637
+
638
+ @keyframes typing {
639
+ 0%, 60%, 100% {
640
+ transform: translateY(0);
641
+ }
642
+ 30% {
643
+ transform: translateY(-4px);
644
+ }
645
+ }
646
+
647
+ /* ============================================
648
+ MESSAGE INPUT
649
+ ============================================ */
650
+
651
+ .message-input-container {
652
+ position: relative;
653
+ background: var(--bg-input);
654
+ border-top: 1px solid var(--border-color);
655
+ }
656
+
657
+ .emoji-picker {
658
+ display: grid;
659
+ grid-template-columns: repeat(8, 1fr);
660
+ gap: 4px;
661
+ padding: 10px 12px;
662
+ background: var(--bg-input);
663
+ border: 1px solid var(--border-color);
664
+ border-radius: 8px;
665
+ max-width: 320px;
666
+ position: absolute;
667
+ bottom: calc(100% + 8px);
668
+ left: 12px;
669
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
670
+ z-index: 10;
671
+ }
672
+
673
+ .emoji-option {
674
+ background: transparent;
675
+ border: none;
676
+ font-size: 22px;
677
+ cursor: pointer;
678
+ padding: 4px;
679
+ border-radius: 4px;
680
+ transition: background 0.15s;
681
+ }
682
+
683
+ .emoji-option:hover {
684
+ background: var(--bg-hover);
685
+ }
686
+
687
+ .message-input-form {
688
+ display: flex;
689
+ padding: 10px 12px;
690
+ background: var(--bg-input);
691
+ gap: 8px;
692
+ align-items: center;
693
+ }
694
+
695
+ .input-button {
696
+ width: 36px;
697
+ height: 36px;
698
+ background: transparent;
699
+ color: var(--text-secondary);
700
+ border: none;
701
+ border-radius: 50%;
702
+ cursor: pointer;
703
+ font-size: 20px;
704
+ display: flex;
705
+ align-items: center;
706
+ justify-content: center;
707
+ transition: background 0.15s, color 0.15s;
708
+ flex-shrink: 0;
709
+ }
710
+
711
+ .input-button:hover:not(:disabled) {
712
+ background: var(--bg-hover);
713
+ color: var(--accent);
714
+ }
715
+
716
+ .input-button:disabled {
717
+ opacity: 0.4;
718
+ cursor: not-allowed;
719
+ }
720
+
721
+ .message-input-field {
722
+ flex: 1;
723
+ padding: 10px 14px;
724
+ border: 1px solid var(--border-color);
725
+ border-radius: 22px;
726
+ font-size: 14px;
727
+ outline: none;
728
+ background: var(--bg-input);
729
+ color: var(--text-primary);
730
+ transition: border-color 0.2s;
731
+ }
732
+
733
+ .message-input-field:focus {
734
+ border-color: var(--accent);
735
+ }
736
+
737
+ .message-input-form button[type="submit"] {
738
+ width: 40px;
739
+ height: 40px;
740
+ background: var(--accent);
741
+ color: white;
742
+ border: none;
743
+ border-radius: 50%;
744
+ cursor: pointer;
745
+ font-size: 16px;
746
+ display: flex;
747
+ align-items: center;
748
+ justify-content: center;
749
+ transition: background 0.2s;
750
+ flex-shrink: 0;
751
+ }
752
+
753
+ .message-input-form button[type="submit"]:hover:not(:disabled) {
754
+ background: var(--accent-hover);
755
+ }
756
+
757
+ .message-input-form button[type="submit"]:disabled {
758
+ background: #b0b0b0;
759
+ cursor: not-allowed;
760
+ }
761
+
762
+ /* ============================================
763
+ STATES
764
+ ============================================ */
765
+
766
+ .no-room-selected {
767
+ flex: 1;
768
+ display: flex;
769
+ flex-direction: column;
770
+ align-items: center;
771
+ justify-content: center;
772
+ color: var(--text-secondary);
773
+ font-size: 14px;
774
+ background: var(--bg-message-area);
775
+ }
776
+
777
+ .no-room-selected p {
778
+ margin: 0;
779
+ }
780
+
781
+ .no-users {
782
+ padding: 16px;
783
+ text-align: center;
784
+ color: var(--text-secondary);
785
+ font-size: 13px;
786
+ }
787
+
788
+ .chat-loading,
789
+ .chat-error {
790
+ flex: 1;
791
+ display: flex;
792
+ flex-direction: column;
793
+ align-items: center;
794
+ justify-content: center;
795
+ color: var(--text-secondary);
796
+ }
797
+
798
+ .spinner {
799
+ width: 40px;
800
+ height: 40px;
801
+ border: 3px solid var(--border-color);
802
+ border-top-color: var(--accent);
803
+ border-radius: 50%;
804
+ animation: spin 1s linear infinite;
805
+ }
806
+
807
+ @keyframes spin {
808
+ to {
809
+ transform: rotate(360deg);
810
+ }
811
+ }
812
+
813
+ .chat-error button {
814
+ padding: 8px 16px;
815
+ background: var(--accent);
816
+ color: white;
817
+ border: none;
818
+ border-radius: 4px;
819
+ cursor: pointer;
820
+ }
821
+
822
+ /* ============================================
823
+ CALL OVERLAY
824
+ ============================================ */
825
+
826
+ .call-overlay {
827
+ position: absolute;
828
+ bottom: 80px;
829
+ right: 16px;
830
+ background: #1b263b;
831
+ border-radius: 12px;
832
+ padding: 16px;
833
+ color: white;
834
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
835
+ z-index: 100;
836
+ }
837
+
838
+ .call-header {
839
+ font-size: 14px;
840
+ margin-bottom: 12px;
841
+ }
842
+
843
+ .call-actions {
844
+ display: flex;
845
+ gap: 8px;
846
+ }
847
+
848
+ .call-actions button {
849
+ padding: 8px 16px;
850
+ border: none;
851
+ border-radius: 4px;
852
+ cursor: pointer;
853
+ font-size: 13px;
854
+ }
855
+
856
+ .btn-accept {
857
+ background: #4caf50;
858
+ color: white;
859
+ }
860
+
861
+ .btn-reject,
862
+ .btn-end {
863
+ background: #f44336;
864
+ color: white;
865
+ }
866
+
867
+ .btn-muted {
868
+ background: #ff9800;
869
+ color: white;
870
+ }
871
+
872
+ /* ============================================
873
+ FULL CALL VIEW (WhatsApp-style)
874
+ Replaces the entire message area when the active call
875
+ is in the currently-viewed room.
876
+ ============================================ */
877
+
878
+ .full-call-view {
879
+ position: absolute;
880
+ inset: 0;
881
+ display: flex;
882
+ flex-direction: column;
883
+ background: var(--bg-message-area);
884
+ z-index: 50;
885
+ }
886
+
887
+ .full-call-stage {
888
+ flex: 1;
889
+ display: flex;
890
+ flex-direction: column;
891
+ align-items: center;
892
+ justify-content: center;
893
+ gap: 18px;
894
+ padding: 32px 16px;
895
+ }
896
+
897
+ .full-call-avatar {
898
+ width: 160px;
899
+ height: 160px;
900
+ border-radius: 50%;
901
+ background: var(--accent);
902
+ color: #fff;
903
+ display: flex;
904
+ align-items: center;
905
+ justify-content: center;
906
+ font-size: 64px;
907
+ font-weight: 600;
908
+ position: relative;
909
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
910
+ animation: pulse-call 2.4s infinite;
911
+ }
912
+
913
+ .full-call-online-dot {
914
+ position: absolute;
915
+ bottom: 6px;
916
+ right: 6px;
917
+ width: 24px;
918
+ height: 24px;
919
+ background: var(--online-dot);
920
+ border: 3px solid var(--bg-message-area);
921
+ border-radius: 50%;
922
+ }
923
+
924
+ .full-call-name {
925
+ font-size: 24px;
926
+ font-weight: 600;
927
+ color: var(--text-primary);
928
+ text-align: center;
929
+ word-break: break-word;
930
+ }
931
+
932
+ .full-call-timer {
933
+ font-size: 16px;
934
+ color: var(--text-secondary);
935
+ font-variant-numeric: tabular-nums;
936
+ letter-spacing: 0.5px;
937
+ }
938
+
939
+ .full-call-error {
940
+ color: #f44336;
941
+ font-size: 13px;
942
+ text-align: center;
943
+ max-width: 320px;
944
+ }
945
+
946
+ .full-call-controls {
947
+ display: flex;
948
+ justify-content: space-around;
949
+ align-items: center;
950
+ padding: 24px 16px 32px;
951
+ gap: 16px;
952
+ background: var(--bg-message-area);
953
+ border-top: 1px solid var(--border-color);
954
+ }
955
+
956
+ .full-call-btn {
957
+ flex: 1;
958
+ max-width: 96px;
959
+ display: flex;
960
+ flex-direction: column;
961
+ align-items: center;
962
+ gap: 6px;
963
+ background: transparent;
964
+ border: 1px solid var(--border-color);
965
+ color: var(--text-primary);
966
+ border-radius: 50%;
967
+ width: 64px;
968
+ height: 64px;
969
+ cursor: pointer;
970
+ transition: background 0.15s, border-color 0.15s, transform 0.1s;
971
+ position: relative;
972
+ }
973
+
974
+ .full-call-btn:hover {
975
+ background: var(--bg-hover);
976
+ border-color: var(--accent);
977
+ transform: scale(1.05);
978
+ }
979
+
980
+ .full-call-btn-icon {
981
+ font-size: 24px;
982
+ line-height: 1;
983
+ }
984
+
985
+ .full-call-btn-label {
986
+ position: absolute;
987
+ bottom: -22px;
988
+ left: 50%;
989
+ transform: translateX(-50%);
990
+ font-size: 12px;
991
+ color: var(--text-secondary);
992
+ white-space: nowrap;
993
+ }
994
+
995
+ .full-call-btn-active {
996
+ background: var(--accent);
997
+ border-color: var(--accent);
998
+ color: #fff;
999
+ }
1000
+
1001
+ .full-call-btn-end {
1002
+ background: #f44336;
1003
+ border-color: #f44336;
1004
+ color: #fff;
1005
+ animation: pulse-call 1.5s infinite;
1006
+ }
1007
+
1008
+ .full-call-btn-end:hover {
1009
+ background: #d32f2f;
1010
+ border-color: #d32f2f;
1011
+ }
1012
+
1013
+ /* ============================================
1014
+ GLOBAL CALL COMPONENTS
1015
+ ============================================ */
1016
+
1017
+ /* Busy banner - appears at the top of the screen for 4 seconds */
1018
+ .busy-banner {
1019
+ position: fixed;
1020
+ top: 10px;
1021
+ left: 50%;
1022
+ transform: translateX(-50%);
1023
+ background: #ff9800;
1024
+ color: white;
1025
+ padding: 12px 24px;
1026
+ border-radius: 8px;
1027
+ font-size: 14px;
1028
+ font-weight: 500;
1029
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
1030
+ display: flex;
1031
+ align-items: center;
1032
+ gap: 8px;
1033
+ z-index: 1000;
1034
+ animation: slideDown 0.3s ease-out;
1035
+ }
1036
+
1037
+ .busy-banner-icon {
1038
+ font-size: 16px;
1039
+ }
1040
+
1041
+ .busy-banner-close {
1042
+ background: none;
1043
+ border: none;
1044
+ color: white;
1045
+ font-size: 18px;
1046
+ cursor: pointer;
1047
+ padding: 0;
1048
+ line-height: 1;
1049
+ }
1050
+
1051
+ .busy-banner-close:hover {
1052
+ opacity: 0.8;
1053
+ }
1054
+
1055
+ /* Incoming call popup - fixed at top of screen */
1056
+ .incoming-call-popup {
1057
+ position: fixed;
1058
+ top: 60px;
1059
+ left: 50%;
1060
+ transform: translateX(-50%);
1061
+ z-index: 1000;
1062
+ }
1063
+
1064
+ .incoming-call-card {
1065
+ background: white;
1066
+ border-radius: 16px;
1067
+ padding: 20px;
1068
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
1069
+ display: flex;
1070
+ align-items: center;
1071
+ gap: 16px;
1072
+ min-width: 320px;
1073
+ }
1074
+
1075
+ .incoming-call-icon {
1076
+ font-size: 28px;
1077
+ }
1078
+
1079
+ .incoming-call-title {
1080
+ font-weight: 600;
1081
+ color: #333;
1082
+ margin: 0 0 4px 0;
1083
+ }
1084
+
1085
+ .incoming-call-subtitle {
1086
+ font-size: 14px;
1087
+ color: #666;
1088
+ margin: 0;
1089
+ }
1090
+
1091
+ .incoming-call-actions {
1092
+ display: flex;
1093
+ gap: 12px;
1094
+ }
1095
+
1096
+ .incoming-call-actions button {
1097
+ padding: 10px 20px;
1098
+ border: none;
1099
+ border-radius: 8px;
1100
+ font-weight: 500;
1101
+ cursor: pointer;
1102
+ transition: transform 0.1s;
1103
+ }
1104
+
1105
+ .incoming-call-actions button:hover {
1106
+ transform: scale(1.05);
1107
+ }
1108
+
1109
+ /* Active call modal - fixed, shows for both caller and callee */
1110
+ .active-call-modal {
1111
+ position: fixed;
1112
+ bottom: 20px;
1113
+ right: 20px;
1114
+ z-index: 1000;
1115
+ }
1116
+
1117
+ .active-call-card {
1118
+ background: #1b263b;
1119
+ border-radius: 12px;
1120
+ padding: 12px;
1121
+ color: white;
1122
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
1123
+ display: flex;
1124
+ align-items: center;
1125
+ gap: 12px;
1126
+ }
1127
+
1128
+ .active-call-icon {
1129
+ font-size: 24px;
1130
+ }
1131
+
1132
+ .active-call-title {
1133
+ font-weight: 500;
1134
+ }
1135
+
1136
+ .active-call-error {
1137
+ color: #ff6b6b;
1138
+ font-size: 12px;
1139
+ margin-top: 4px;
1140
+ }
1141
+
1142
+ .active-call-actions {
1143
+ display: flex;
1144
+ gap: 8px;
1145
+ }
1146
+
1147
+ .active-call-actions button {
1148
+ padding: 8px 12px;
1149
+ border: none;
1150
+ border-radius: 6px;
1151
+ cursor: pointer;
1152
+ font-size: 13px;
1153
+ transition: transform 0.1s;
1154
+ }
1155
+
1156
+ .active-call-actions button:hover {
1157
+ transform: scale(1.05);
1158
+ }
1159
+
1160
+ /* In-call banner - inside the chat area when in a call */
1161
+ .in-call-banner {
1162
+ background: #f8f9fa;
1163
+ border: 1px solid #e9ecef;
1164
+ border-radius: 8px;
1165
+ padding: 10px 16px;
1166
+ display: flex;
1167
+ justify-content: space-between;
1168
+ align-items: center;
1169
+ margin-top: 8px;
1170
+ }
1171
+
1172
+ .in-call-banner-status {
1173
+ display: flex;
1174
+ align-items: center;
1175
+ gap: 8px;
1176
+ }
1177
+
1178
+ .in-call-banner-dot {
1179
+ width: 8px;
1180
+ height: 8px;
1181
+ background: #4caf50;
1182
+ border-radius: 50%;
1183
+ animation: pulse 2s infinite;
1184
+ }
1185
+
1186
+ .in-call-banner-actions {
1187
+ display: flex;
1188
+ gap: 8px;
1189
+ }
1190
+
1191
+ .in-call-banner-actions button {
1192
+ padding: 6px 12px;
1193
+ border: none;
1194
+ border-radius: 4px;
1195
+ cursor: pointer;
1196
+ font-size: 13px;
1197
+ transition: transform 0.1s;
1198
+ }
1199
+
1200
+ .in-call-banner-actions button:hover {
1201
+ transform: scale(1.05);
1202
+ }
1203
+
1204
+ /* Animation keyframes */
1205
+ @keyframes slideDown {
1206
+ from {
1207
+ opacity: 0;
1208
+ transform: translate(-50%, -20px);
1209
+ }
1210
+ to {
1211
+ opacity: 1;
1212
+ transform: translate(-50%, 0);
1213
+ }
1214
+ }
1215
+
1216
+ @keyframes pulse {
1217
+ 0% {
1218
+ box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
1219
+ }
1220
+ 70% {
1221
+ box-shadow: 0 0 0 4px rgba(76, 175, 80, 0);
1222
+ }
1223
+ 100% {
1224
+ box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
1225
+ }
1226
+ }