sw-fe/src/components/Chat/ChatWindow.css

325 lines
5.6 KiB
CSS

.chat-window {
width: 320px;
height: 420px;
background: rgba(15, 23, 42, 0.95);
border: 1px solid rgba(148, 163, 184, 0.3);
border-radius: 12px 12px 0 0;
box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
display: flex;
flex-direction: column;
overflow: hidden;
backdrop-filter: blur(12px);
}
.chat-window--minimized {
height: auto;
cursor: pointer;
}
.chat-window--minimized:hover {
background: rgba(30, 41, 59, 0.95);
}
/* Header */
.chat-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
background: linear-gradient(135deg, rgba(30, 58, 138, 0.8), rgba(59, 130, 246, 0.6));
border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.chat-user {
display: flex;
align-items: center;
gap: 10px;
}
.chat-avatar-sm {
width: 32px;
height: 32px;
border-radius: 50%;
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: 600;
font-size: 14px;
position: relative;
overflow: hidden;
}
.chat-avatar-sm img {
width: 100%;
height: 100%;
object-fit: cover;
}
.chat-avatar-sm.online::after {
content: "";
position: absolute;
bottom: 0;
right: 0;
width: 10px;
height: 10px;
background: #22c55e;
border: 2px solid rgba(15, 23, 42, 0.95);
border-radius: 50%;
}
.chat-user-info {
display: flex;
flex-direction: column;
}
.chat-username {
font-weight: 600;
font-size: 14px;
color: #f1f5f9;
}
.chat-status {
font-size: 11px;
color: #22c55e;
}
.chat-actions {
display: flex;
gap: 4px;
}
.chat-minimize,
.chat-close {
width: 26px;
height: 26px;
border: none;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
color: #e2e8f0;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
transition: background 0.2s;
}
.chat-minimize:hover,
.chat-close:hover {
background: rgba(255, 255, 255, 0.2);
}
/* Messages */
.chat-messages {
flex: 1;
overflow-y: auto;
padding: 12px;
display: flex;
flex-direction: column;
gap: 8px;
}
.chat-empty {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: rgba(148, 163, 184, 0.7);
font-size: 13px;
}
.chat-msg {
max-width: 80%;
padding: 8px 12px;
border-radius: 16px;
background: rgba(59, 130, 246, 0.15);
color: #e2e8f0;
font-size: 13px;
line-height: 1.4;
align-self: flex-start;
}
.chat-msg--mine {
background: linear-gradient(135deg, #3b82f6, #2563eb);
color: white;
align-self: flex-end;
}
.chat-msg-content {
word-break: break-word;
}
.chat-msg-meta {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 4px;
margin-top: 4px;
}
.chat-msg-time {
font-size: 10px;
color: rgba(148, 163, 184, 0.7);
}
.chat-msg--mine .chat-msg-time {
color: rgba(255, 255, 255, 0.7);
}
.chat-msg-status {
font-size: 10px;
color: rgba(255, 255, 255, 0.6);
}
.chat-msg-status i {
font-size: 10px;
}
.chat-msg-status i.read {
color: #22c55e;
}
/* Typing indicator */
.chat-typing {
display: flex;
gap: 4px;
padding: 8px 12px;
align-self: flex-start;
}
.chat-typing-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: rgba(148, 163, 184, 0.5);
animation: typingBounce 1.4s infinite ease-in-out both;
}
.chat-typing-dot:nth-child(1) {
animation-delay: 0s;
}
.chat-typing-dot:nth-child(2) {
animation-delay: 0.2s;
}
.chat-typing-dot:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes typingBounce {
0%,
80%,
100% {
transform: scale(0.6);
opacity: 0.4;
}
40% {
transform: scale(1);
opacity: 1;
}
}
/* Input */
.chat-input-area {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
border-top: 1px solid rgba(148, 163, 184, 0.2);
background: rgba(15, 23, 42, 0.6);
}
.chat-input {
flex: 1;
padding: 8px 14px;
border: 1px solid rgba(148, 163, 184, 0.3);
border-radius: 20px;
background: rgba(30, 41, 59, 0.8);
color: #f1f5f9;
font-size: 13px;
outline: none;
}
.chat-input::placeholder {
color: rgba(148, 163, 184, 0.6);
}
.chat-input:focus {
border-color: #3b82f6;
}
.chat-send {
width: 36px;
height: 36px;
border: none;
border-radius: 50%;
background: linear-gradient(135deg, #3b82f6, #2563eb);
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
transition: transform 0.2s, opacity 0.2s;
}
.chat-send:hover:not(:disabled) {
transform: scale(1.05);
}
.chat-send:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Light theme */
body[data-theme="light"] .chat-window {
background: rgba(255, 255, 255, 0.98);
border-color: rgba(148, 163, 184, 0.4);
}
body[data-theme="light"] .chat-header {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(99, 102, 241, 0.8));
}
body[data-theme="light"] .chat-username {
color: #f1f5f9;
}
body[data-theme="light"] .chat-messages {
background: #f8fafc;
}
body[data-theme="light"] .chat-msg {
background: rgba(59, 130, 246, 0.1);
color: #1e293b;
}
body[data-theme="light"] .chat-input-area {
background: rgba(255, 255, 255, 0.9);
}
body[data-theme="light"] .chat-input {
background: #f1f5f9;
color: #1e293b;
border-color: rgba(148, 163, 184, 0.4);
}
/* Responsive */
@media (max-width: 640px) {
.chat-window {
width: 100%;
max-width: 100vw;
height: 50vh;
height: 50dvh; /* Dynamic viewport height - accounts for keyboard */
max-height: calc(100vh - 60px);
max-height: calc(100dvh - 60px);
border-radius: 16px 16px 0 0;
}
.chat-input-area {
padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
}
}