#tuvan-chat-toggle {
    position: fixed; bottom: 55px; right: 5px; background: #0073aa; color: #fff; border: 1px solid #ffffff91;
    padding: 0px 10px; border-radius: 50px; cursor: pointer; font-size: 16px; z-index: 9999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#tuvan-chat-widget {
    position: fixed; bottom: 80px; right: 20px; width: 340px; height: 450px; background: #fff;
    border: 1px solid #ccc; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    display: none; flex-direction: column; z-index: 9999; font-family: Arial, sans-serif; overflow: hidden;
}

/* HEADER */
#tuvan-chat-header {
    background: #0073aa; color: #fff; padding: 5px 5px 5px 15px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.tuvan-header-profile { display: flex; align-items: center; gap: 12px; }
.tuvan-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.4); }
.tuvan-header-info { display: flex; flex-direction: column; }
.tuvan-name { font-weight: bold; font-size: 15px; letter-spacing: 0.5px; }
.tuvan-status { font-size: 12px; color: #e1e1e1; margin-top: 2px; }
.tuvan-status::before { content: ''; display: inline-block; width: 8px; height: 8px; background-color: #4cd137; border-radius: 50%; margin-right: 5px; }
#tuvan-chat-header button { background: none; border: none; color: white; cursor: pointer; font-size: 18px; font-weight: bold; opacity: 0.8; margin-right: 0em; padding: 0em; min-height: unset; line-height: unset; }

/* MÀN HÌNH ĐĂNG NHẬP */
#tuvan-chat-login-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; flex: 1; min-height: 0; background: #f4f7f6; text-align: center;
}
.tuvan-login-icon { font-size: 45px; margin-bottom: 10px; }
.tuvan-login-text { font-size: 14px; color: #333; margin-bottom: 20px; line-height: 1.4; }
#tuvan-phone-input { width: 90%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 15px; text-align: center; outline: none; margin-bottom: 15px; }
#tuvan-phone-input:focus { border-color: #0073aa; }
#tuvan-start-btn { width: 90%; background: #0073aa; color: white; border: none; border-radius: 6px; font-size: 15px; font-weight: bold; cursor: pointer; margin-left: auto; margin-right: auto;}
.tuvan-login-note { font-size: 12px; color: #777; margin-top: 15px; font-style: italic; }

/* MÀN HÌNH CHAT */
#tuvan-chat-body { flex: 1; overflow-y: auto; padding: 15px; background: #f4f7f6; min-height: 0; }
.chat-msg-row { display: flex; gap: 10px; margin-bottom: 15px; align-items: flex-end; }
.chat-msg-row.bot { justify-content: flex-start; }
.chat-msg-row.user { justify-content: flex-end; }
.chat-msg-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; object-fit: cover; border: 2px solid #095d30b5; }
.chat-message { padding: 10px 14px; font-size: 14px; line-height: 1.4; max-width: 75%; word-wrap: break-word; }
.bot-message { background: #fff; color: #333; border: 1px solid #e0e0e0; border-radius: 15px 15px 15px 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.user-message { background: #0073aa; color: white; border-radius: 15px 15px 4px 15px; }
.chat-message.bot-message a { color: #0073aa; text-decoration: underline; font-weight: bold; }

/* ẢNH TRONG CHAT (Tích hợp hiệu ứng Kính lúp) */
.tuvan-chat-img { 
    max-width: 100%; max-height: 220px; object-fit: contain; border-radius: 5px; margin-bottom: 5px; 
    display: block; cursor: zoom-in; transition: opacity 0.2s;
}
.tuvan-chat-img:hover { opacity: 0.85; }

/* KHUNG FOOTER VÀ ICON SVG */
#tuvan-chat-footer { 
    display: flex; padding: 10px 12px; border-top: 1px solid #eee; background: #fff; align-items: center; flex-shrink: 0; 
}
#tuvan-chat-attach { 
    display: flex; justify-content: center; align-items: center; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: #606770; margin-right: 8px; transition: all 0.2s ease; margin-bottom: 0em;
}
#tuvan-chat-attach:hover { background-color: #e4e6eb; color: #0073aa; }
#tuvan-chat-attach svg { width: 18px; height: 18px; transform: rotate(45deg); }
#tuvan-chat-input { flex-grow: 1; padding: 10px 15px; border: 1px solid #ddd; border-radius: 20px; outline: none; font-size: 14px; background: #f4f7f6; margin-bottom: 0em; }
#tuvan-chat-send { background: #0073aa; color: white; border: none; padding: 0px 10px; margin-left: 5px; border-radius: 50%; cursor: pointer; font-weight: unset; font-size: 14px; transition: opacity 0.2s; margin-right: 0em; min-width: 38px; text-transform: none; margin-bottom: 0em; }
#tuvan-chat-send:hover { opacity: 0.8; }

/* POPUP PHÓNG TO ẢNH (LIGHTBOX) */
.tuvan-image-modal {
    display: none; position: fixed; z-index: 100000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px); align-items: center; justify-content: center;
}
.tuvan-image-modal-content {
    max-width: 90%; max-height: 90vh; border-radius: 8px; box-shadow: 0 4px 25px rgba(0,0,0,0.5);
    animation: tuvanZoomIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes tuvanZoomIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tuvan-image-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; transition: 0.3s; }
.tuvan-image-close:hover { color: #d63638; }