/* Tooltip */

#chatTooltip {
    position: fixed;
    right: 120px;
    bottom: 120px;
    background: #1e88e5;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

#closeTooltip {
    cursor: pointer;
    font-size: 14px;
}


/* ============================
   CHAT NEON LIGHT
============================ */

#mesBtn {
    position: fixed;
    right: 50px;
    bottom: 100px;
    width: 60px;
    height: 60px;
    background: #1e88e5;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(30, 136, 229, 0.8);
    z-index: 999;
    animation: neonPulse 2s infinite ease-in-out;
}

#mesBtn img {
    width: 30px;
    height: 30px;
}


/* Neon pulse animation */

@keyframes neonPulse {
    0% {
        box-shadow: 0 0 8px rgba(30, 136, 229, 0.6), 0 0 15px rgba(30, 136, 229, 0.4);
    }
    50% {
        box-shadow: 0 0 18px rgba(30, 136, 229, 0.9), 0 0 30px rgba(30, 136, 229, 0.7);
    }
    100% {
        box-shadow: 0 0 8px rgba(30, 136, 229, 0.6), 0 0 15px rgba(30, 136, 229, 0.4);
    }
}


/* ============================
    LOGIN ALERT
============================ */

#loginAlert {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 280px;
    padding: 15px;
    display: none;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    background: white;
    /* không tô màu nền */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 2000;
}

#loginAlert a {
    color: #d35400;
    font-weight: bold;
}


/* ============================
    POPUP CHAT
============================ */

#mesPopup {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 360px;
    height: 480px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    z-index: 998;
}

#mesPopup .header {
    background: #1e88e5;
    color: white;
    padding: 10px;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
    height: 28px;
    font-size: 16px;
}

#mesBody {
    background: #ebecf0;
    text-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

#popupInput {
    width: 100%;
    font: inherit;
    border-radius: 8px;
    border: none;
    resize: none;
    overflow-y: auto;
    line-height: 1.4;
    padding: 0;
}

#popupInput:focus {
    outline: none;
}

.btn-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #ddd;
}

.btn-chat-input textarea {
    flex: 1;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
}

.btn-chat-input input:focus {
    border-color: #1e88e5;
}

.btn-chat-input button {
    padding: 8px 12px;
    background: #1e88e5;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
    flex-shrink: 0;
}

.btn-chat-input button:hover {
    background: #1565c0;
}


/* ============================
    MESSAGES
============================ */


/* Message incoming */

.msg-incoming {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
}

.msg-incoming .avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #c6cad2;
    overflow: hidden;
    object-fit: cover;
    font-size: .625rem;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    border-radius: 50%;
}

.msg-incoming .msg-body {
    display: inline-block;
    max-width: 80%;
    background: #fff;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    text-align: left;
}

.msg-incoming .msg-body p {
    margin: 0;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}


/* Message outgoing */

.msg-outgoing {
    display: flex;
    position: relative;
    justify-content: flex-end;
    padding: 6px;
    border-radius: 6px;
}

.msg-outgoing .msg-body {
    display: inline-block;
    position: relative;
    max-width: 80%;
    background: #3082d1;
    padding: 12px;
    border-radius: 10px;
    color: #fff;
    text-align: left;
}

.msg-outgoing .msg-body p {
    margin: 0;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}


/* Message sent time */

.msg-time {
    display: block;
    font-size: 11px;
    color: #44546f;
    margin-top: 4px;
}

.msg-outgoing .msg-time {
    color: #cbcbcb;
}

.date-wrap {
    text-align: center;
}

.date-separator {
    display: inline-block;
    padding: 4px 10px;
    margin: 14px 0;
    font-size: 12px;
    background: #b1b1b1;
    color: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, .08);
}

#chat-date-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 12px;
    display: none;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}


/* Delete message */

.msg-body::before {
    content: "";
    position: absolute;
    left: -32px;
    top: 0;
    width: 32px;
    height: 100%;
}

.delete-msg {
    position: absolute;
    top: 50%;
    left: -28px;
    transform: translateY(-50%);
    padding: 4px 6px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.msg-body::before {
    content: "";
    position: absolute;
    left: -32px;
    top: 0;
    width: 32px;
    height: 100%;
}

.msg-body:hover .delete-msg,
.delete-msg:hover {
    opacity: 1;
    pointer-events: auto;
    background: #e43f3f;
    color: #fff;
}