.hidden { display:none !important; }

:root {
    --bubble-admin: #eceaff;
    --bubble-user: #dff1ff;
    --purple: #9b59ff;
    --header: linear-gradient(135deg,#a854ff,#6f4bff);
}

.chat-verify {
    height: 22px;
    vertical-align: -5px;
}

.msg-avatar {
    position: relative;
    width: 32px;
    height: 32px;
}

.avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-frame {
    position: absolute;
    inset: -2px;
    width: 36px;
    height: 36px;
    object-fit: contain;
    pointer-events: none;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #0be881;
}

.live-status .dot {
    width: 9px;
    height: 9px;
    background: #0be881;
    border-radius: 50%;
    position: relative;
    animation: dotBlink 1.4s infinite ease-in-out;
}

.live-status .dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(11, 232, 129, 0.7);
    animation: dotPulse 1.4s infinite;
}

.live-status.offline {
    color: #ff4d4d;
}

.live-status.offline .dot {
    width: 9px;
    height: 9px;
    background: #ff4d4d;
    border-radius: 50%;
    position: relative;
    animation: dotBlinkRed 1.4s infinite ease-in-out;
}

.live-status.offline .dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 77, 77, 0.7);
    animation: dotPulseRed 1.4s infinite;
}

.vti-chat-toggle {
    position: fixed;
    right: 20px;
    bottom: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #A66BFF, #35F2E9);
    border-radius: 50%;
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:30px;
    color:#fff;
    cursor:pointer;
    box-shadow:
        0 0 12px rgba(166, 107, 255, 0.45),
        0 0 20px rgba(53, 242, 233, 0.35);
    z-index:9999;
    -webkit-tap-highlight-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
}

.vti-chat-toggle {
    animation:
        vtiBreath 2.2s infinite ease-in-out,
        togglePulse 2.4s infinite ease-in-out;
}

@keyframes togglePulse {
    0% {
        box-shadow:
            0 0 12px rgba(166, 107, 255, 0.45),
            0 0 22px rgba(53, 242, 233, 0.30),
            0 0 0 0 rgba(166,107,255,0.12);
    }
    50% {
        box-shadow:
            0 0 18px rgba(166, 107, 255, 0.60),
            0 0 30px rgba(53, 242, 233, 0.45),
            0 0 0 12px rgba(166,107,255,0.05);
    }
    100% {
        box-shadow:
            0 0 12px rgba(166, 107, 255, 0.45),
            0 0 22px rgba(53, 242, 233, 0.30),
            0 0 0 0 rgba(166,107,255,0.0);
    }
}

@keyframes vtiBreath {
    0%   { transform: scale(1);     opacity: 0.80; }
    50%  { transform: scale(1.14);  opacity: 0.45; }
    100% { transform: scale(1);     opacity: 0.80; }
}

.vti-unread {
    position:absolute;
    right:-1px;
    top:-3px;
    width:20px;
    height:20px;
    background:#ff6b6b;
    border-radius:50%;
    font-family: 'Quicksand', sans-serif;
    font-size:13px;
    color:white;
    font-weight:700;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow: 0 0 8px rgba(166,107,255,0.6);
    animation: unreadPulse 1.5s infinite ease-in-out;
}

@keyframes unreadPulse {
    0%   { transform: scale(1);     opacity: 1; }
    50%  { transform: scale(1.08);  opacity: 0.75; }
    100% { transform: scale(1);     opacity: 1; }
}

.vti-chat-toggle i {
    transition:.25s ease;
    display:inline-block;
    font-size: 26px;
}

.body-lock {
    overflow: hidden !important;
    touch-action: none !important;
}

.vti-chat-box {
    position:fixed;
    right:20px;
    bottom:110px;
    width:380px;
    height:550px;
    background:white;
    border-radius:26px;
    display:flex;
    flex-direction:column;
    box-shadow:0 10px 40px rgba(0,0,0,.25);
    overflow:hidden;
    opacity:0;
    transform:translateY(40px) scale(.85);
    pointer-events:none;
    transition:.55s cubic-bezier(.22,.68,.14,1);
    z-index:9998;
    font-family: 'Quicksand', sans-serif;
}

.vti-chat-box .msg-bubble,
.vti-chat-box .vti-header-title,
.vti-chat-box .vti-header-info,
.vti-chat-box .welcome-text,
.vti-chat-box .welcome-title,
.vti-chat-box #vtiInput,
.vti-chat-box .msg-time,
.vti-chat-box .chat-text {
    font-family: 'Quicksand', sans-serif !important;
}

.vti-chat-box.active {
    opacity:1;
    transform:translateY(0) scale(1);
    pointer-events:auto;
}

.msg-link {
    color: #4f8cff;
    font-weight: 600;
    text-decoration: none !important;
    word-break: break-all;
    -webkit-tap-highlight-color: transparent;
    border: none;
    cursor: pointer;
}

.msg-link:hover {
    text-decoration: none !important;
}

.vti-chat-header {
    padding:12px;
    background: linear-gradient(135deg, #A66BFF, #35F2E9);
    display:flex;
    align-items:center;
    color:white;
}

.vti-header-avatar {
    width:46px;height:46px;
    border-radius:50%;
}

.chat-khung-avt {
    position: relative;
    width: 46px;
    height: 46px;
}
 
.chat-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.vti-header-info{
    flex:1;
    margin-left:12px;
}

.vti-header-title { 
    font-size:17px; 
    font-weight: bold; 
}

.live-status {
    font-weight: bold;
}
.vti-header-status { 
    font-size:13px; 
    opacity:.85; 
}

.vti-close-btn{
    font-size:28px;
    -webkit-tap-highlight-color: transparent;
    border: none;
    cursor: pointer;
    transition:.3s;
}

.vti-close-btn:hover { transform:rotate(120deg); }

.vti-welcome{
    position:absolute;
    left:50%;
    top:52%;
    transform:translate(-50%,-50%);
    text-align:center;
    width:85%;
    opacity:1;
    transition:.3s;
    color: #000 !important;
}

.vti-welcome.hidden { opacity:0; }

.welcome-text {
    width: 100%;  
    font-style: italic;
    white-space: normal;
    overflow-wrap: break-word;
    color: #000 !important;
}

.welcome-title {
    color: #000 !important;
}

.chat-cursor {
    display: inline-block;
    width: 2px;
    height: 15px;
    background: #ddd;
    transform: skewX(-12deg);
    animation: chat-blink .7s infinite;
}

@keyframes chat-blink {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.vti-messages {
    font-weight: bold;
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #fafafa;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.vti-messages::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.msg {
    display: flex;
    margin: 14px 0;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px) scale(.95);
    animation: msgFade .25s forwards;
}

.admin-msg { justify-content: flex-start; }
.user-msg  { justify-content: flex-end; }

.msg-inner {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.admin-msg .msg-bubble {
    position: relative;
}

.admin-msg .msg-bubble::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 10px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--bubble-admin);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.user-msg .msg-bubble {
    position: relative;
}

.user-msg .msg-bubble::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 10px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--bubble-user);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    color: #000 !important;
}

.user-bubble  { background: var(--bubble-user); color: #000 !important; }
.admin-bubble { background: var(--bubble-admin); color: #000 !important; }

/* .msg-time {
    margin-top: 4px;
    font-size: 11px;
    opacity: .55;
    padding: 0;
}
*/

.msg-time {
    opacity: 0;
    font-size: 11px;
    margin-top: 4px;
    transition: opacity .2s ease;
    pointer-events: none;
    color: #555;
    font-weight: 600;
}

.msg-inner:hover .msg-time,
.msg-inner:active .msg-time {
    opacity: 1;
}

.vti-input-box{
    gap: 6px;
    padding:10px;
    display:flex;
    align-items: center;
    border-top:1px solid #e0e0e0;
    background:white;
    -webkit-tap-highlight-color: transparent;
    border: none;
}

.vti-input-box input {
    flex: 1;
    padding: 8px 14px;
    height: 41px;
    box-sizing: border-box;
    border-radius: 50px !important;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, #A66BFF, #35F2E9) border-box !important;
    border: 2px solid transparent !important;
    outline: none !important;
    font-size: 16px !important;
    font-family: 'Quicksand', sans-serif !important;
    font-weight: 600 !important;
    color: #333 !important;
    min-width:0;
}

.vti-input-box input::placeholder {
    font-family: 'Quicksand', sans-serif !important;
    color: #999 !important;
    font-weight: 600 !important;
    opacity: 1 !important;
}

.vti-input-box input::-webkit-input-placeholder {
    font-family: 'Quicksand', sans-serif !important;
    color: #999 !important;
    font-weight: 600 !important;
}

.vti-input-box input::-moz-placeholder {
    font-family: 'Quicksand', sans-serif !important;
    color: #999 !important;
    font-weight: 600 !important;
}

.vti-input-box input:-ms-input-placeholder {
    font-family: 'Quicksand', sans-serif !important;
    color: #999 !important;
    font-weight: 600 !important;
}

.send-btn {
    position: relative;
    width:41px;
    height:41px;
    border-radius:50%;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, #A66BFF, #35F2E9) border-box;
    border: 2px solid transparent;
    font-size:20px;
    cursor:pointer;
    display:flex;
    justify-content:center;
    align-items:center;
    transition:.15s ease;
    color: transparent;
}

.send-btn::before {
    content: "\f1d8";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 20px;
    background: linear-gradient(135deg, #A66BFF, #35F2E9);
    -webkit-background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
}

.send-btn:active {
    transform:scale(.85);
}

.send-count {
    font-family: 'Quicksand', sans-serif;
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(135deg, #A66BFF, #35F2E9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: none;
}

.send-btn.cooldown::before {
    display: none;
}

.send-btn.cooldown .send-count {
    display: block;
}

.vti-btn {
    position: relative;
    width: 41px;
    height: 41px;
    border-radius: 50%;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, #A66BFF, #35F2E9) border-box;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: .15s ease;
    color: transparent;
}

.vti-btn {
    transition: transform 0.12s cubic-bezier(.25, .46, .45, .94);
}

.vti-btn:active {
    transform: scale(.85);
}

.vti-btn::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 20px;
    background: linear-gradient(135deg, #A66BFF, #35F2E9);
    -webkit-background-clip: text;
    color: transparent;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn::before {
    content: "\f1d8";
}

.image-btn::before {
    content: "\f03e";
}

.emoji-btn::before {
    content: "\f118";
}

.emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 10px;
    width: 270px;
    max-height: 240px;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, #A66BFF, #35F2E9) border-box;
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    overflow-y: auto;
    z-index: 9999;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.emoji-picker::-webkit-scrollbar {
    display: none;
}

.emoji-picker span {
    font-size: 27px;
    cursor: pointer;
    transition: .15s;
}

.welcome-icon {
    text-align: center;
    margin-bottom: 10px;
}

.welcome-icon i {
    font-size: 48px;
    background: linear-gradient(135deg, #A66BFF, #35F2E9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    animation: iconPulse 1.8s ease-in-out infinite;
}

.msg-image {
    max-width: 180px;
    border-radius: 12px;
    display: block;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

@keyframes msgFade {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dotBlink {
    0%   { transform: scale(1);     opacity: 1; }
    50%  { transform: scale(1.25);  opacity: .4; }
    100% { transform: scale(1);     opacity: 1; }
}

@keyframes dotPulse {
    0% {
        transform: scale(1.2);
        opacity: 0.9;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

@keyframes dotBlinkRed {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes dotPulseRed {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

@media(max-width:480px){
    .vti-chat-box{
        width:91%;
        right:4%;
        height:70%;
    }
    .emoji-picker {
        width: 230px;
        max-height: 230px;
    }
    .emoji-picker span {
        font-size: 30px;
    }
}