/* Chat Container */
.chat-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* Chat Sidebar */
.chat-sidebar {
    width: 320px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.chat-sidebar-header h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
}

.chat-sidebar-header p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
}

.chat-rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-room-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    border-bottom: 1px solid #e9ecef;
}

.chat-room-item:hover {
    background: #e9ecef;
}

.chat-room-item.active {
    background: #e3f2fd;
    border-left: 3px solid #007bff;
}

.chat-room-avatar {
    width: 48px;
    height: 48px;
    background: #007bff;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-room-info {
    flex: 1;
    min-width: 0;
}

.chat-room-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 14px;
}

.chat-room-last-message {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-time {
    font-size: 10px;
    color: #adb5bd;
    margin-top: 2px;
}

.chat-unread-badge {
    background: #dc3545;
    color: #fff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.chat-header-info h3 {
    margin: 0 0 3px 0;
    font-size: 16px;
    color: #333;
}

.chat-header-info p {
    margin: 0;
    font-size: 12px;
    color: #28a745;
}

.chat-header-actions {
    display: flex;
    gap: 10px;
}

.chat-action-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6c757d;
    border-radius: 50%;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

/* Message Bubbles */
.message {
    margin-bottom: 20px;
    display: flex;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
}

.message.sent .message-bubble {
    background: #007bff;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #6c757d;
}

.message.received .message-sender {
    color: #007bff;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 10px;
    margin-top: 5px;
    opacity: 0.7;
}

.message.sent .message-time {
    text-align: right;
}

.message-status {
    margin-left: 8px;
    font-size: 10px;
}

.message-status.sent {
    color: #ffc107;
}

.message-status.read {
    color: #28a745;
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #fff;
}

.chat-input-area textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area textarea:focus {
    border-color: #007bff;
}

.chat-input-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.chat-attach-btn,
.chat-send-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.chat-attach-btn {
    background: #e9ecef;
    color: #6c757d;
}

.chat-attach-btn:hover {
    background: #dee2e6;
}

.chat-send-btn {
    background: #007bff;
    color: #fff;
}

.chat-send-btn:hover {
    background: #0056b3;
}

/* Empty Chat State */
.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f8f9fa;
}

.empty-chat-content {
    max-width: 300px;
}

.empty-chat-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-chat h4 {
    margin: 0 0 8px 0;
    color: #333;
}

.empty-chat p {
    margin: 0;
    color: #6c757d;
    font-size: 13px;
}

/* Chat Loading */
.chat-loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #adb5bd;
    border-radius: 50%;
    animation: loadingPulse 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingPulse {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar,
.chat-rooms-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-rooms-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-rooms-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-rooms-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: calc(100vh - 160px);
    }
    
    .chat-sidebar {
        width: 100%;
        max-height: 300px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-header-info h3 {
        font-size: 14px;
    }
}