/* Chat Widget CSS */
.chat-widget-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 300px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    transition: height 0.3s ease,
        width 0.3s ease;
}

.chat-widget-header {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e6ea;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-header:hover {
    background: #e9ecef;
}

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

.chat-widget-controls i {
    margin-left: 10px;
    cursor: pointer;
    color: #6c757d;
}

.chat-widget-body {
    height: 400px;
    display: flex;
    flex-direction: column;
}

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

.chat-room-item {
    padding: 10px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    display: flex;
    align-items: center;
}

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

.chat-room-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-room-info {
    flex: 1;
}

.chat-room-name {
    font-weight: 500;
    font-size: 13px;
}

.chat-room-last-msg {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.chat-messages-area {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.chat-message-bubble {
    max-width: 80%;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    font-size: 13px;
    position: relative;
    word-wrap: break-word;
}

.chat-message-bubble.sent {
    background: #00882b;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-message-bubble.received {
    background: #e9ecef;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid #e2e6ea;
    display: flex;
}

.chat-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: none;
    height: 40px;
    font-size: 13px;
}

.chat-send-btn {
    margin-left: 8px;
    background: #00882b;
    color: white;
    border: none;
    padding: 0 12px;
    border-radius: 4px;
    cursor: pointer;
}

.chat-back-btn {
    margin-right: 10px;
    cursor: pointer;
}

/* Collapsed State */
.chat-widget-container.collapsed {
    height: 40px;
    width: 200px;
    overflow: hidden;
}

.chat-widget-container.collapsed .chat-widget-body {
    display: none;
}

/* Expanded State */
.chat-widget-container.expanded {
    height: 500px;
    width: 350px;
}

/* Unread Badge on Room Item */
.chat-room-unread {
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 8px;
}

/* Global Unread Badge in Header */
.chat-unread-badge {
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 6px;
}