.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.active {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.dark .chat-panel {
    background: #1f2937;
    border: 1px solid #374151;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: between;
    align-items: center;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.chat-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.dark .chat-tabs {
    background: #374151;
    border-bottom-color: #4b5563;
}

.chat-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
}

.chat-tab.active {
    color: #667eea;
    background: white;
    border-bottom: 2px solid #667eea;
}

.dark .chat-tab {
    color: #9ca3af;
}

.dark .chat-tab.active {
    color: #667eea;
    background: #1f2937;
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.channels-list, .users-list {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.channel-item, .user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.channel-item:hover, .user-item:hover {
    background: #f1f5f9;
}

.dark .channel-item:hover, .dark .user-item:hover {
    background: #374151;
}

.channel-item.active, .user-item.active {
    background: #e0e7ff;
    color: #667eea;
}

.dark .channel-item.active, .dark .user-item.active {
    background: #3730a3;
    color: #a5b4fc;
}

.channel-icon, .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.channel-icon {
    background: #e0e7ff;
    color: #667eea;
}

.user-avatar {
    background: #f3f4f6;
    color: #6b7280;
    position: relative;
}

.user-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.status-online { background: #10b981; }
.status-away { background: #f59e0b; }
.status-busy { background: #ef4444; }
.status-offline { background: #6b7280; }

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fafafa;
    scroll-behavior: smooth;
}

.dark .chat-messages {
    background: #111827;
}

.message-group {
    margin-bottom: 16px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.dark .message-author {
    color: #d1d5db;
}

.message-time {
    font-size: 12px;
    color: #6b7280;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-left: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.dark .message-content {
    background: #374151;
    color: #d1d5db;
}

.message-own .message-content {
    background: #667eea;
    color: white;
    margin-left: auto;
    margin-right: 8px;
    max-width: 80%;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: #6b7280;
    border-radius: 50%;
    animation: typing 1.4s infinite both;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.chat-input {
    border-top: 1px solid #e2e8f0;
    padding: 16px;
    background: white;
}

.dark .chat-input {
    border-top-color: #4b5563;
    background: #1f2937;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    background: #f9fafb;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.message-input:focus {
    border-color: #667eea;
    background: white;
}

.dark .message-input {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.dark .message-input:focus {
    background: #1f2937;
    border-color: #667eea;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: scale(1);
}

.notification {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    transform: translateX(400px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

.notification.show {
    transform: translateX(0);
}

.dark .notification {
    background: #1f2937;
    color: #d1d5db;
    border: 1px solid #374151;
}

.notification-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 8px;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
}

.notification-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
}

.notification-content {
    font-size: 13px;
    color: #6b7280;
}

.dark .notification-content {
    color: #9ca3af;
}

@media (max-width: 768px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-panel {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 70px;
        right: -10px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}