/* Chatbot tra cứu TTHC */
.chat-fab[hidden] { display: none; }
.chat-box { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 32px)); display: flex; flex-direction: column; background: #fff; border: 1px solid #c9d3e0; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.28); overflow: hidden; }
.chat-box[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #0b4a8b; color: #fff; }
.chat-x { background: transparent; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.chat-ctx { padding: 6px 14px; background: #eef4fb; font-size: .85rem; color: #0b3a6b; }
.chat-ctx[hidden] { display: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #f7f9fc; }
.chat-msg { max-width: 92%; padding: 8px 12px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; font-size: .95rem; }
.chat-msg p { margin: 0 0 4px; }
.chat-msg.me { align-self: flex-end; background: #0b4a8b; color: #fff; }
.chat-msg.bot { align-self: flex-start; background: #fff; border: 1px solid #d9dee7; }
.chat-msg.err, .chat-msg.insufficient, .chat-msg.out_of_scope, .chat-msg.unavailable { border-color: #f0d58c; background: #fff9e8; }
.chat-msg.wait { color: #64748b; font-style: italic; }
.chat-src { list-style: none; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px dashed #cbd5e1; font-size: .85rem; }
.chat-src-h { color: #64748b; }
.chat-help { font-size: .85rem; color: #6b4b00; margin: 6px 0 0; }
.chat-sug { padding: 6px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-sug[hidden] { display: none; }
.chat-chip { text-align: left; background: #eef4fb; border: 1px solid #c9d8ec; border-radius: 8px; padding: 6px 10px; cursor: pointer; color: #0b3a6b; font-size: .88rem; }
.chat-form { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #e2e8f0; }
.chat-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #b8c4d4; border-radius: 8px; font-size: 1rem; }
.chat-form button { padding: 8px 14px; border: 0; border-radius: 8px; background: #0b4a8b; color: #fff; cursor: pointer; }
.chat-form button:disabled { opacity: .5; }
.chat-note { margin: 0; padding: 4px 12px 8px; font-size: .75rem; color: #64748b; }
@media print { .chat-fab, .chat-box { display: none !important; } }

.chat-msg.admin{border-color:#b7dfc6;background:#e8f6ee}
.chat-msg.escalated{border-color:#f0d58c;background:#fff9e8}


/* Nút Hỏi trợ lý: robot chào mời */
.chat-fab { position: fixed; right: 18px; bottom: 18px; z-index: 50; width: 74px; height: 74px; padding: 0; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(145deg, #0b4a8b, #2b7bd0); box-shadow: 0 10px 24px rgba(11,83,148,.4); display: grid; place-items: center; animation: chatbob 2.8s ease-in-out infinite; }
.chat-fab[hidden] { display: none; }
.chat-fab::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid rgba(11,83,148,.4); animation: chatring 2.8s ease-out infinite; pointer-events: none; }
.chat-fab svg { width: 50px; height: 50px; }
.chat-fab:hover { animation-play-state: paused; filter: brightness(1.08); }
.chat-fab:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.chat-online { position: absolute; right: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #22c55e; border: 3px solid #fff; }
.chat-fab.has-new .chat-online { background: #d9534f; width: 20px; height: 20px; right: 0; top: 0; animation: chatpulse 1.2s infinite; }
.rb-eye { transform-box: fill-box; transform-origin: center; animation: chatblink 4.2s infinite; }
.rb-ant { animation: chatant 1.4s ease-in-out infinite; }
.chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-greet { position: fixed; right: 18px; bottom: 104px; z-index: 50; max-width: 240px; background: #fff; color: #1d2733; border: 1px solid #d9dee7; border-radius: 18px 18px 4px 18px; padding: 10px 28px 10px 14px; box-shadow: 0 10px 26px rgba(0,0,0,.18); font-size: .92rem; line-height: 1.4; animation: chatpop .5s both; }
.chat-greet[hidden] { display: none; }
.chat-greet p { margin: 0; } .chat-greet strong { color: #0b4a8b; }
.chat-greet-x { position: absolute; right: 6px; top: 4px; background: none; border: 0; font-size: 1.15rem; color: #64748b; cursor: pointer; line-height: 1; }
@keyframes chatbob { 50% { translate: 0 -7px; } }
@keyframes chatring { 0% { scale: .9; opacity: .9; } 70%, 100% { scale: 1.35; opacity: 0; } }
@keyframes chatblink { 0%, 92%, 100% { scale: 1 1; } 95% { scale: 1 .1; } }
@keyframes chatant { 50% { opacity: .35; } }
@keyframes chatpulse { 50% { opacity: .6; scale: 1.25; } }
@keyframes chatpop { from { opacity: 0; translate: 0 10px; scale: .9; } to { opacity: 1; translate: 0 0; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .chat-fab, .chat-fab::before, .rb-eye, .rb-ant, .chat-greet, .chat-fab.has-new .chat-online { animation: none !important; } }
@media (max-width: 480px) { .chat-greet { max-width: 200px; } }
