#khanhnq-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Bong bóng chat ── */
#chat-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #00b09b, #0084ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 132, 255, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: cs-float 3s ease-in-out infinite;
}
#chat-bubble:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 28px rgba(0, 132, 255, 0.5);
}
@keyframes cs-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* ── Khung chat ── */
#chat-box {
    width: 360px;
    max-height: 480px;
    background: #f8fafc;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: cs-slide-up 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: none;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.06);
}
@keyframes cs-slide-up {
    from { opacity: 0; transform: translateY(24px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
#chat-box-header {
    background: linear-gradient(135deg, #00b09b, #0084ff);
    color: #fff;
    padding: 16px 18px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
#chat-box-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 24px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #00b09b, #0084ff);
    transform: rotate(45deg);
    border-radius: 3px;
}
#chat-box-header .cs-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
#chat-box-header .cs-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: cs-blink 1.5s infinite;
}
@keyframes cs-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
#chat-box-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
#chat-box-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ── Body ── */
#chat-box-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
    overflow-anchor: none;
}

/* ── Welcome message ── */
#chat-welcome {
    font-size: 13.5px;
    color: #475569;
    line-height: 1.65;
    margin-bottom: 18px;
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    position: relative;
}
#chat-welcome::before {
    content: '💬';
    position: absolute;
    top: -10px;
    left: -6px;
    font-size: 20px;
    background: #f8fafc;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Grid kênh liên hệ ── */
#chat-channels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ── Nút kênh ── */
.chat-channel-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}
.chat-channel-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
}
.chat-channel-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: #fff;
}
.chat-channel-btn:active {
    transform: translateY(-1px);
}

/* ── Icon trong nút ── */
.chat-channel-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}
.chat-channel-icon svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

/* ── Nút cuối hàng lẻ (center nếu còn 1) ── */
#chat-channels .chat-channel-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
}

/* ── Footer ── */
#chat-box-footer {
    text-align: center;
    padding: 10px 16px 14px;
    font-size: 11px;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
}

/* ── Responsive ── */
@media (max-width: 420px) {
    #khanhnq-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    #chat-box {
        width: calc(100vw - 32px);
        max-height: 75vh;
    }
}
