:root { --goai-navy:#1a3a8f; --goai-blue:#2a52be; --goai-line:#e5eaf2; --goai-ink:#1f2937; --goai-font:'Be Vietnam Pro','Inter',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; }

@keyframes goaiFadeInUp { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes goaiPop { 0% { opacity: 0; transform: translateY(14px) scale(.94); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes goaiPopOut { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(14px) scale(.94); } }
@keyframes goaiRing { 0% { box-shadow: 0 4px 16px rgba(17,43,80,.16), 0 0 0 0 rgba(42,82,190,.35); } 70% { box-shadow: 0 4px 16px rgba(17,43,80,.16), 0 0 0 14px rgba(42,82,190,0); } 100% { box-shadow: 0 4px 16px rgba(17,43,80,.16), 0 0 0 0 rgba(42,82,190,0); } }
@keyframes goaiBlink { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes goaiLive { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); } 70% { box-shadow: 0 0 0 6px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
@keyframes goaiShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes goaiTeaser { 0% { opacity: 0; transform: translateX(12px) scale(.96); } 100% { opacity: 1; transform: translateX(0) scale(1); } }

#goai-chat-box *, .goai-floating-contact *, #goai-chat-btn *, #goai-teaser * { box-sizing: border-box; }
#goai-chat-box, #goai-teaser { font-family: var(--goai-font); -webkit-font-smoothing: antialiased; }
#goai-chat-box button, #goai-chat-box input, #goai-chat-box select, #goai-chat-box textarea { font-family: inherit; }

/* ===== Nút nổi (nền trắng) ===== */
.goai-floating-contact, #goai-chat-btn {
    position: fixed; right: 20px; width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; z-index: 99998;
    background: #fff; border: 1px solid var(--goai-line); padding: 0;
    transition: transform .25s cubic-bezier(.25,.8,.25,1), box-shadow .25s ease;
    box-shadow: 0 4px 16px rgba(17,43,80,.16); text-decoration: none; cursor: pointer;
}
.goai-floating-contact:hover, #goai-chat-btn:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 8px 22px rgba(17,43,80,.22); }
.goai-floating-contact:active, #goai-chat-btn:active { transform: scale(.94); }
.goai-floating-contact:focus-visible, #goai-chat-btn:focus-visible { outline: 3px solid rgba(42,82,190,.4); outline-offset: 2px; }

#goai-chat-btn { bottom: 164px; z-index: 99999; color: var(--goai-navy); animation: goaiRing 2.4s infinite; }
#goai-chat-btn .goai-ico-chat, #goai-chat-btn .goai-ico-close { position: absolute; transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s ease; }
#goai-chat-btn .goai-ico-close { opacity: 0; transform: rotate(-90deg) scale(.5); }
#goai-chat-btn.is-open { animation: none; }
#goai-chat-btn.is-open .goai-ico-chat { opacity: 0; transform: rotate(90deg) scale(.5); }
#goai-chat-btn.is-open .goai-ico-close { opacity: 1; transform: rotate(0) scale(1); }
#goai-btn-zalo { bottom: 92px; }
#goai-btn-zalo img { width: 34px; height: 34px; }
#goai-btn-phone { bottom: 20px; color: #10B981; }
#goai-btn-phone svg { width: 24px; height: 24px; }

.goai-floating-contact::after, #goai-chat-btn::after {
    content: attr(data-tooltip); position: absolute; right: 68px; background: #fff; color: #1f2937;
    padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; font-family: var(--goai-font);
    white-space: nowrap; opacity: 0; pointer-events: none; transition: all .25s ease; transform: translateX(8px);
    border: 1px solid var(--goai-line); box-shadow: 0 4px 14px rgba(17,43,80,.12);
}
.goai-floating-contact:hover::after, #goai-chat-btn:hover::after { opacity: 1; transform: translateX(0); }
#goai-chat-btn.is-open::after { display: none; }

/* ===== Bong bóng chào ===== */
#goai-teaser {
    display: none; position: fixed; right: 90px; bottom: 170px; z-index: 99997; max-width: 240px;
    align-items: center; gap: 8px; background: #fff; border: 1px solid var(--goai-line); border-radius: 14px 14px 4px 14px;
    padding: 10px 8px 10px 14px; font-size: 13.5px; font-weight: 500; color: #1f2937; cursor: pointer;
    box-shadow: 0 8px 26px rgba(17,43,80,.16); animation: goaiTeaser .4s cubic-bezier(.16,1,.3,1);
}
#goai-teaser.show { display: flex; }
#goai-teaser button { border: 0; background: #fff; color: #94a3b8; font-size: 18px; line-height: 1; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; flex-shrink: 0; transition: .2s; }
#goai-teaser button:hover { color: #1f2937; background: #f1f5f9; }

/* ===== Khung chat ===== */
#goai-chat-box {
    display: none; position: fixed; bottom: 20px; right: 90px; width: 350px; max-width: calc(100vw - 110px);
    height: 550px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
    background: #fff; border-radius: 18px; z-index: 99999; flex-direction: column; overflow: hidden;
    border: 1px solid var(--goai-line); box-shadow: 0 18px 50px rgba(17,43,80,.18), 0 2px 8px rgba(17,43,80,.06);
    transform-origin: bottom right;
}
#goai-chat-box.opening { animation: goaiPop .32s cubic-bezier(.16,1,.3,1); }
#goai-chat-box.closing { animation: goaiPopOut .2s ease forwards; }

#goai-head { flex-shrink: 0; position: relative; background: #fff; color: var(--goai-navy); padding: 12px 14px 12px 18px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; border-bottom: 1px solid #eef2f7; }
.goai-head-title { display: flex; align-items: center; gap: 9px; }
.goai-online-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; animation: goaiLive 2s infinite; }
.goai-head-actions { display: flex; gap: 4px; align-items: center; }
.goai-head-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: #fff; color: var(--goai-blue); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.goai-head-btn svg { transition: transform .5s cubic-bezier(.34,1.56,.64,1); }
.goai-head-btn:hover { background: #eef3ff; color: var(--goai-navy); }
.goai-head-btn:hover svg { transform: rotate(180deg); }
.goai-head-btn.goai-close { padding: 6px; width: 32px; height: 32px; justify-content: center; color: #64748b; }
.goai-head-btn.goai-close:hover { color: #1f2937; background: #f1f5f9; }
.goai-head-btn.goai-close:hover svg { transform: rotate(90deg); }
.goai-head-btn:focus-visible, .goai-opt:focus-visible, .goai-suggestion-chips button:focus-visible { outline: 2px solid var(--goai-blue); outline-offset: 2px; }

#goai-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 20px 16px; background: #fff; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #d5dce8 transparent; }
#goai-body.in-chat { overflow: hidden; padding: 0; }
.goai-q { font-size: 14.5px; color: var(--goai-ink); margin: 0 0 16px 0; line-height: 1.5; font-weight: 600; text-align: center; animation: goaiFadeInUp .45s ease both; }
#goai-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }

.goai-opt { position: relative; width: 100%; text-align: left; padding: 12px 38px 12px 16px; background: #fff; border: 1px solid var(--goai-line); border-radius: 12px; font-size: 13.5px; color: #334155; cursor: pointer; font-weight: 500; transition: border-color .2s, color .2s, transform .2s cubic-bezier(.25,.8,.25,1), box-shadow .2s; box-shadow: 0 1px 3px rgba(17,43,80,.04); animation: goaiFadeInUp .45s ease both; }
.goai-opt:nth-child(1) { animation-delay: .05s; } .goai-opt:nth-child(2) { animation-delay: .1s; } .goai-opt:nth-child(3) { animation-delay: .15s; }
.goai-opt:nth-child(4) { animation-delay: .2s; } .goai-opt:nth-child(5) { animation-delay: .25s; } .goai-opt:nth-child(6) { animation-delay: .3s; }
.goai-opt::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-top: 2px solid var(--goai-blue); border-right: 2px solid var(--goai-blue); transform: translate(-6px,-50%) rotate(45deg); opacity: 0; transition: all .22s ease; }
.goai-opt-ext::after { display: none; }
.goai-opt:hover { border-color: var(--goai-blue); color: var(--goai-navy); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(26,58,143,.10); }
.goai-opt:hover::after { opacity: 1; transform: translate(0,-50%) rotate(45deg); }
.goai-opt:active { transform: scale(.985); box-shadow: none; }
.form-trigger { font-weight: 700; color: var(--goai-navy); border-color: #c7d2fe; }

#goai-msgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 10px; background: #fff; scrollbar-width: thin; scrollbar-color: #d5dce8 transparent; }
#goai-msgs::-webkit-scrollbar { width: 6px; } #goai-msgs::-webkit-scrollbar-thumb { background: #d5dce8; border-radius: 6px; }
.goai-msg-wrapper { display: flex; align-items: flex-end; gap: 10px; animation: goaiFadeInUp .3s ease both; }
.goai-msg-wrapper.user { justify-content: flex-end; }
.goai-msg-wrapper.bot { justify-content: flex-start; }
.goai-bot-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--goai-line); background: #fff; }
.goai-msg { padding: 11px 15px; border-radius: 14px; max-width: 85%; font-size: 14px; line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; background: #fff; }
.goai-msg.user { color: var(--goai-navy); font-weight: 500; border: 1.5px solid var(--goai-blue); border-bottom-right-radius: 4px; }
.goai-msg.bot { color: var(--goai-ink); border: 1px solid var(--goai-line); border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(17,43,80,.05); }
.goai-msg strong { font-weight: 700; color: #111827; }

.goai-typing { display: flex; gap: 4px; align-items: center; padding: 4px 2px; }
.goai-dot { width: 6px; height: 6px; background-color: var(--goai-blue); border-radius: 50%; animation: goaiBlink 1.4s infinite both; }
.goai-dot:nth-child(1) { animation-delay: -0.32s; }
.goai-dot:nth-child(2) { animation-delay: -0.16s; }

.goai-suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.goai-suggestion-chips button { background: #fff; color: #1d4ed8; border: 1px solid #bfdbfe; padding: 7px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; white-space: normal; text-align: left; line-height: 1.3; animation: goaiFadeInUp .35s ease both; }
.goai-suggestion-chips button:nth-child(2) { animation-delay: .08s; } .goai-suggestion-chips button:nth-child(3) { animation-delay: .16s; }
.goai-suggestion-chips button:hover { border-color: #1d4ed8; background: #f0f5ff; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(29,78,216,.15); }
.goai-suggestion-chips button:active { transform: scale(.97); }

/* Form */
.goai-inline-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding: 14px; background: #fff; border-radius: 12px; border: 1px solid var(--goai-line); white-space: normal; }
.goai-inline-form input, .goai-inline-form select, .goai-inline-form textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; outline: none; transition: border-color .2s, box-shadow .2s; background: #fff; color: var(--goai-ink); }
.goai-inline-form select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.goai-inline-form textarea { resize: vertical; min-height: 60px; max-height: 100px; }
.goai-inline-form input::placeholder, .goai-inline-form textarea::placeholder { color: #94a3b8; }
.goai-inline-form input:focus, .goai-inline-form select:focus, .goai-inline-form textarea:focus { border-color: var(--goai-blue); box-shadow: 0 0 0 3px rgba(42,82,190,.14); }
.goai-inline-form .error-input { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.10) !important; animation: goaiShake .3s; }
.goai-error-msg { color: #ef4444; font-size: 12.5px; font-weight: 600; text-align: center; display: none; line-height: 1.4; }
.goai-inline-form button { background: var(--goai-navy); color: #fff; border: none; padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer; margin-top: 4px; transition: all .2s; font-size: 14px; }
.goai-inline-form button:hover:not(:disabled) { background: var(--goai-blue); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(26,58,143,.22); }
.goai-inline-form button:active:not(:disabled) { transform: scale(.98); }
.goai-inline-form button:disabled { background: #94a3b8; cursor: not-allowed; }

/* Ô nhập */
#goai-input-area { flex-shrink: 0; display: flex; padding: 10px 12px; border-top: 1px solid #eef2f7; gap: 8px; background: #fff; align-items: center; }
#goai-inp { flex: 1; min-width: 0; height: 36px; border: 1px solid #dbe2ec; background: #fff; border-radius: 20px; padding: 0 14px; outline: none; font-size: 13px; transition: .2s; text-overflow: ellipsis; color: var(--goai-ink); }
#goai-inp:focus { border-color: var(--goai-blue); box-shadow: 0 0 0 3px rgba(42,82,190,.12); }
#goai-inp:disabled { background: #fff; cursor: not-allowed; color: #94a3b8; border-style: dashed; }
#goai-inp::placeholder { color: #94a3b8; }
#goai-input-area.shake { animation: goaiShake .35s; }
#goai-send-btn { background: var(--goai-navy); color: #fff; border: none; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .2s; }
#goai-send-btn:hover:not(:disabled) { background: var(--goai-blue); transform: scale(1.08) rotate(-10deg); }
#goai-send-btn:active:not(:disabled) { transform: scale(.92); }
#goai-send-btn:disabled { background: #cbd5e1; cursor: not-allowed; }

/* Nút cuộn xuống & toast */
#goai-scroll-down { position: absolute; left: 50%; bottom: 72px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--goai-line); background: #fff; color: var(--goai-navy); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 14px rgba(17,43,80,.15); opacity: 0; pointer-events: none; transform: translate(-50%,8px); transition: all .25s ease; z-index: 3; padding: 0; }
#goai-scroll-down.show { opacity: 1; pointer-events: auto; transform: translate(-50%,0); }
#goai-scroll-down:hover { transform: translate(-50%,-2px); }
#goai-toast { position: absolute; left: 12px; right: 12px; bottom: 64px; background: #fff; color: #1f2937; border: 1px solid #bfdbfe; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; line-height: 1.4; box-shadow: 0 6px 20px rgba(17,43,80,.15); opacity: 0; transform: translateY(8px); pointer-events: none; transition: all .25s ease; z-index: 4; }
#goai-toast.show { opacity: 1; transform: translateY(0); }
#goai-conversation { position: relative; }

/* Hộp xác nhận */
#goai-confirm { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(255,255,255,.88); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#goai-confirm.show { display: flex; animation: goaiFadeInUp .2s ease; }
.goai-confirm-card { background: #fff; border: 1px solid var(--goai-line); border-radius: 14px; padding: 18px; box-shadow: 0 12px 34px rgba(17,43,80,.18); text-align: center; width: 100%; }
.goai-confirm-card p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--goai-ink); font-weight: 500; }
.goai-confirm-actions { display: flex; gap: 8px; }
.goai-confirm-actions button { flex: 1; padding: 10px; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .2s; }
.goai-cf-cancel { background: #fff; border: 1px solid #cbd5e1; color: #475569; }
.goai-cf-cancel:hover { border-color: var(--goai-blue); color: var(--goai-navy); }
.goai-cf-ok { background: var(--goai-navy); border: 1px solid var(--goai-navy); color: #fff; }
.goai-cf-ok:hover { background: var(--goai-blue); }

@media (max-width: 480px) {
    .goai-floating-contact, #goai-chat-btn { right: 16px; width: 50px; height: 50px; }
    #goai-chat-btn { bottom: 140px; }
    #goai-btn-zalo { bottom: 78px; }
    #goai-btn-phone { bottom: 16px; }
    #goai-chat-box { bottom: 16px; right: 16px; width: calc(100vw - 32px); max-width: none; height: 80vh; height: 80dvh; max-height: 600px; }
    #goai-teaser { right: 76px; bottom: 146px; max-width: calc(100vw - 100px); }
    #goai-inp { font-size: 16px; }
    .goai-floating-contact::after, #goai-chat-btn::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    #goai-chat-box *, #goai-chat-box, #goai-chat-btn, #goai-teaser, .goai-opt { animation: none !important; transition-duration: .01ms !important; }
}
/* ===== Bảng màu gốc (giống bản cũ) ===== */
:root { --goai-grad: linear-gradient(135deg, #1a3a8f 0%, #2a52be 100%); }
.goai-floating-contact, #goai-chat-btn { border: 0; box-shadow: 0 4px 15px rgba(0,0,0,.15); }
#goai-chat-btn { background: var(--goai-grad); color: #fff; }
#goai-btn-zalo { background: #fff; }
#goai-btn-phone { background: #10B981; color: #fff; }
.goai-floating-contact::after, #goai-chat-btn::after { background: rgba(31,41,55,.9); color: #fff; border: 0; box-shadow: none; }

#goai-chat-box { box-shadow: 0 10px 40px rgba(0,0,0,.15); }
#goai-head { background: var(--goai-grad); color: #fff; border-bottom: 0; }
.goai-head-btn { background: transparent; color: #fff; opacity: .85; }
.goai-head-btn:hover, .goai-head-btn.goai-close:hover { background: rgba(255,255,255,.16); color: #fff; opacity: 1; }
.goai-head-btn.goai-close { color: #fff; }

#goai-body, #goai-msgs { background: #f8fafc; }
.goai-opt { border-color: #e2e8f0; }
.goai-opt:hover { background: #f0f4ff; }
.form-trigger { background: #eff6ff; border-color: #c7d2fe; }

.goai-msg.user { background: var(--goai-grad); color: #fff; border: 0; font-weight: 400; box-shadow: 0 2px 5px rgba(0,0,0,.04); }
.goai-msg.bot { background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 2px 5px rgba(0,0,0,.04); }
.goai-dot { background: #94a3b8; }

.goai-suggestion-chips button { background: #eff6ff; border-color: #bfdbfe; }
.goai-suggestion-chips button:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; box-shadow: 0 4px 10px rgba(29,78,216,.2); }

.goai-inline-form { background: #f8fafc; border-color: #e2e8f0; }
.goai-inline-form button { background: var(--goai-grad); box-shadow: 0 4px 12px rgba(26,58,143,.2); }
.goai-inline-form button:hover:not(:disabled) { background: var(--goai-grad); box-shadow: 0 6px 15px rgba(26,58,143,.3); }
.goai-inline-form button:disabled { background: #94a3b8; box-shadow: none; }

#goai-input-area { border-top-color: #f1f5f9; }
#goai-inp { background: #f8fafc; border-color: #e2e8f0; }
#goai-inp:focus { background: #fff; }
#goai-inp:disabled { background: #f1f5f9; border-style: solid; }
#goai-send-btn { background: var(--goai-grad); box-shadow: 0 2px 8px rgba(26,58,143,.2); }
#goai-send-btn:hover:not(:disabled) { background: var(--goai-grad); }
#goai-send-btn:disabled { background: var(--goai-grad); opacity: .5; }
.goai-cf-ok { background: var(--goai-grad); }
.goai-cf-ok:hover { background: var(--goai-grad); filter: brightness(1.1); }

/* ===== Tích hợp vào website: ẩn cụm nút khi banner cookie đang mở (giống hành vi cũ của website) ===== */
.cookie-choice-open #goai-chat-btn, .cookie-choice-open #goai-btn-zalo, .cookie-choice-open #goai-btn-phone, .cookie-choice-open #goai-teaser { display: none !important; }
