.user-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.18);
    font-family: 'Segoe UI', Tahoma, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
    z-index: 9999;
}
.user-chat.closed { transform: translateY(100%); }

.chat-header {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: #fff;
    padding: 14px 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-close-btn { font-size: 22px; font-weight: bold; }

.chat-body { flex: 1; display: flex; flex-direction: column; }

.chat-messages {
    position: relative;
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #f5f7fa;
}
.msg {
    margin-bottom: 12px;
    max-width: 78%;
}
.msg.user-msg   { margin-left: auto; }
.msg.other-msg  { margin-right: auto; }

.msg-nick {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 2px;
}
.msg-bubble {
    padding: 9px 13px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.user-msg .msg-bubble {
    background: #2575fc;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}
.other-msg .msg-bubble {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 18px 18px 18px 4px;
}
.msg-time {
    font-size: 10px;
    color: #888;
    margin-top: 3px;
    text-align: right;
}

.chat-input-area {
    display: flex;
    border-top: 1px solid #eaeaea;
    background: #fff;
    padding: 8px;
}
#user-nick-input,
#user-msg-input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    font-size: 14px;
    outline: none;
}
#user-nick-input { max-width: 90px; margin-right: 4px; }
#user-msg-input  { margin-right: 4px; }
.chat-input-area button {
    background: #2575fc;
    color: #fff;
    border: none;
    padding: 0 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
}
.chat-input-area button:hover { background: #1a5bb8; }