/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    width: 320px;
    display: flex;
    flex-direction: column;
}

.chat-bubble-btn {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color, #0d6efd);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-left: auto;
    transition: transform 0.2s;
}

.chat-bubble-btn:hover {
    transform: scale(1.1);
}

.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    overflow: hidden;
    margin-bottom: 15px;
    display: none; /* Hidden by default */
    height: 450px;
    flex-direction: column;
}

.chat-header {
    background: var(--primary-color, #0d6efd);
    color: white;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-body {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    position: relative;
}

.user-list {
    display: block;
}

.user-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.user-item:hover {
    background: #e9ecef;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dee2e6;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #495057;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: 14px;
    display: block;
    color: #1a3a5c; /* Explicit dark color */
}

.user-role {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unread-badge {
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.message-area {
    display: none;
    flex-direction: column;
    height: 100%;
}

.messages-list {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.msg {
    max-width: 80%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    position: relative;
}

.msg-sent {
    background: var(--primary-color, #0d6efd);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.msg-received {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.msg-time {
    font-size: 9px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
    text-align: right;
}

.chat-input {
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 15px;
    font-size: 13px;
    outline: none;
}

.chat-input button {
    background: var(--primary-color, #0d6efd);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
