/** Chatbox CSS - Styles cho widget chat nổi và toàn bộ giao diện hội thoại. Logic: Toggle Button, Chat Box, Messages/Bubbles, Canned Responses, Admin/User List, Context Menu. */

@font-face{font-family:'MVChatInter';src:url('../../fonts/Inter-Regular.woff2') format('woff2'),url('../../fonts/Inter-Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:'MVChatGilroy';src:url('../../fonts/SVN-GilroyBold.woff2') format('woff2'),url('../../fonts/SVN-GilroyBold.ttf') format('truetype');font-weight:700;font-style:normal;font-display:swap;}

/* Standalone base: the injected chat cannot rely on the parent theme style.css. */
#mv-chat-widget { font-size: 16px !important; font-style: normal !important; font-weight: 400 !important; line-height: 1.5 !important; letter-spacing: 0 !important; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
#mv-chat-widget, #mv-chat-widget *, #mv-chat-widget *::before, #mv-chat-widget *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; letter-spacing: 0; font-family: 'MVChatInter', 'Inter', Arial, sans-serif; font-style: normal; }
#mv-chat-widget button, #mv-chat-widget input, #mv-chat-widget textarea, #mv-chat-widget select { font-family: inherit; }
#mv-chat-widget button { appearance: none; -webkit-appearance: none; outline: none !important; }
#mv-chat-widget button:focus { outline: none !important; }
#mv-chat-widget button:focus-visible { box-shadow: 0 0 0 3px rgba(13, 62, 154, 0.16) !important; }
#mv-chat-widget a { text-decoration: none; color: inherit; }
#mv-chat-widget .btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 32px; border-radius: 50px; font-weight: 700; font-size: 15px; cursor: pointer; transition: all .4s cubic-bezier(.25,.8,.25,1); border: none; position: relative; overflow: hidden; font-family: 'MVChatGilroy', 'SVN-Gilroy Bold', 'MVChatInter', 'Inter', sans-serif; white-space: nowrap; text-decoration: none; line-height: 1.2; }
#mv-chat-widget .btn:disabled { opacity: .72; cursor: not-allowed; transform: none; box-shadow: none; }
#mv-chat-widget .btn-primary { background: var(--vibe-gradient); background-size: 101% 100%; color: #fff; box-shadow: 0 2px 8px rgba(108,46,231,.16); }
#mv-chat-widget .btn-primary::before { content: ''; position: absolute; top: 0; left: -100%; width: 75%; height: 100%; background: linear-gradient(120deg,rgba(255,255,255,0) 0%,rgba(255,255,255,.4) 50%,rgba(255,255,255,0) 100%); transform: skewX(-25deg); transition: left .75s ease-in-out; }
#mv-chat-widget .btn-primary:hover { filter: brightness(1.04); color: #fff; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(108,46,231,.24); }
#mv-chat-widget .btn-primary:hover::before { left: 120%; }
#mv-chat-widget .btn-full, #mv-chat-widget .w-100 { width: 100%; }
#mv-chat-widget .mt-2 { margin-top: 8px; }
#mv-chat-widget .btn-pulse { animation: mv-chat-pulse-purple 2s infinite; }
#mv-chat-widget .btn-spinner { width: 20px; height: 20px; box-sizing: border-box; border: 3px solid rgba(13,62,154,.15); border-top-color: var(--primary); border-radius: 50%; animation: mv-chat-spin .8s linear infinite; display: inline-block; margin: 0; flex-shrink: 0; }
#mv-chat-widget .btn .btn-spinner { margin-right: 8px; border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes mv-chat-pulse-purple { 0% { box-shadow: 0 0 0 0 rgba(108,46,231,.7); } 70% { box-shadow: 0 0 0 20px rgba(108,46,231,0); } 100% { box-shadow: 0 0 0 0 rgba(108,46,231,0); } }
@keyframes mv-chat-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#mv-chat-widget { position: fixed; bottom: var(--mv-floating-chat-bottom, 30px); right: var(--mv-floating-right, 30px); z-index: 10001; font-family: 'MVChatInter', 'Inter', Arial, sans-serif; }
#mv-chat-widget svg { pointer-events: none; } /* Fix lỗi extension indexOf */

/* Nút Toggle Floating (Với micro-animations ấn tượng) */
#mv-chat-toggle { width: 60px; height: 60px; border-radius: 50%; background: var(--vibe-gradient); color: white; border: none; box-shadow: 0 3px 10px rgba(108, 46, 231, 0.18); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); position: relative; }
#mv-chat-toggle:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 5px 14px rgba(108, 46, 231, 0.24); }
#mv-chat-toggle:active { transform: translateY(-2px) scale(0.94); }
#mv-chat-toggle svg { width: 28px; height: 28px; transition: 0.3s; position: absolute; max-width: 100%; }
#mv-chat-toggle .icon-close { opacity: 0; transform: scale(0) rotate(-90deg); }
#mv-chat-widget.active #mv-chat-toggle .icon-chat { opacity: 0; transform: scale(0) rotate(90deg); }
#mv-chat-widget.active #mv-chat-toggle .icon-close { opacity: 1; transform: scale(1) rotate(0); }

/* Hộp Chat (Chat Box Container với hiệu ứng Glassmorphism) */
#mv-chat-box { position: absolute; bottom: 80px; right: 0; width: 390px; height: min(480px, calc(100dvh - 112px)); min-height: min(380px, calc(100dvh - 112px)); max-height: calc(100dvh - 112px); background: rgba(255, 255, 255, 0.95); border-radius: 24px; box-shadow: 0 24px 70px -24px rgba(15, 23, 42, 0.3), 0 8px 24px rgba(15, 23, 42, 0.08); display: flex; flex-direction: column; overflow: hidden; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.96); transform-origin: bottom right; transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); border: none !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
#mv-chat-widget.active #mv-chat-box { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* Chat Header (Màu sắc pha trộn hiệu ứng kính mờ thời thượng) */
.mv-chat-header { background: var(--vibe-gradient); background-size: 101% 100%; color: white; padding: 18px 20px; display: flex; align-items: center; gap: 8px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
#mv-chat-back-btn { transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease; }
#mv-chat-back-btn:hover { transform: translateX(-3px) scale(1.05); opacity: 0.85; }
.mv-chat-header-avatar { width: 42px; height: 42px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22); transition: transform 0.3s ease; }
.mv-chat-header-avatar:hover { transform: scale(1.04); }
.mv-chat-header-info { min-width: 0; flex: 1; }
.mv-chat-header-info h4 { margin: 0 0 2px 0 !important; font-family: 'MVChatGilroy', 'SVN-Gilroy Bold', 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 15px !important; font-weight: 700 !important; line-height: 1.25 !important; color: white !important; }
.mv-chat-status-dot { width: 8px; height: 8px; background: #4ade80; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px #4ade80; animation: statusDotPulse 2s infinite; }
@keyframes statusDotPulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); } 70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
#chat-header-topic { white-space: normal !important; max-width: none !important; overflow: visible !important; margin: 0 !important; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 13px !important; font-weight: 400 !important; line-height: 1.35 !important; }

/* Chat Tools Buttons */
.mv-chat-tool-btn { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255,255,255,0.08); color: white; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all .2s cubic-bezier(0.4, 0, 0.2, 1); padding: 0; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04); }
.mv-chat-tool-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255,255,255,0.14); transform: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
.mv-chat-tool-btn:active { transform: scale(0.94); }
.mv-chat-tool-btn.btn-danger:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255,255,255,0.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
.mv-chat-tool-btn svg { width: 16px; height: 16px; }
#mv-chat-widget .mv-chat-admin-filter-btn[hidden],
#mv-chat-widget .mv-chat-filter-menu[hidden],
#mv-chat-widget .mv-chat-tools-menu[hidden] { display: none !important; }

.mv-chat-mode-menu-btn { position: relative; width: auto; min-width: 0; max-width: 132px; height: 32px; padding: 0 10px 0 12px; border-radius: 999px; gap: 6px; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 12px !important; font-weight: 700 !important; line-height: 1 !important; }
.mv-chat-mode-menu-btn .mv-chat-mode-current { min-width: 0; max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-chat-mode-menu-btn .mv-chat-mode-chevron { width: 14px; height: 14px; flex: 0 0 14px; transition: transform .16s ease; }
.mv-chat-mode-menu-btn[aria-expanded="true"], .mv-chat-admin-filter-btn[aria-expanded="true"], .mv-chat-admin-filter-btn.active, .mv-chat-more-tools-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.28); border-color: rgba(255,255,255,0.28); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16); }
.mv-chat-mode-menu-btn[aria-expanded="true"] .mv-chat-mode-chevron { transform: rotate(180deg); }

/* Khung chuyển chế độ và lọc (Glassmorphism mờ mịn) */
.mv-chat-mode-bar { position: absolute; top: 82px; right: 16px; width: 300px; z-index: 70; background: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.6); border-radius: 16px; padding: 10px; box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.mv-chat-mode-bar::before, .mv-chat-mode-bar::after { display: none; }
.mv-chat-filter-menu { position: absolute; top: 82px; right: 58px; width: 300px; z-index: 72; background: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.6); border-radius: 16px; padding: 10px; box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.mv-chat-tools-menu { position: absolute; top: 82px; right: 16px; width: 218px; z-index: 74; background: rgba(255,255,255,0.98); border: 1px solid rgba(226,232,240,0.95); border-radius: 15px; padding: 7px; box-shadow: 0 18px 42px rgba(15,23,42,0.16); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.mv-chat-tools-menu-items { display: flex; flex-direction: column; gap: 3px; }
.mv-chat-tools-menu-item { appearance: none; width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: #334155; cursor: pointer; font-family: 'MVChatInter', 'Inter', Arial, sans-serif; font-size: 13px; font-weight: 600; text-align: left; transition: background .16s ease, color .16s ease; }
.mv-chat-tools-menu-item:hover { background: #f1f5f9; color: #0d3e9a; }
.mv-chat-tools-menu-item.btn-danger { color: #dc2626; }
.mv-chat-tools-menu-item.btn-danger:hover { background: #fef2f2; color: #dc2626; }
#mv-chat-widget .mv-chat-tools-menu-item.mv-ai-clear-thread { color: #0d3e9a; box-shadow: none !important; filter: none !important; }
#mv-chat-widget .mv-chat-tools-menu-item.mv-ai-clear-thread:hover { background: #eff6ff; color: #0d3e9a; box-shadow: none !important; transform: none !important; filter: none !important; }
.mv-chat-tools-menu-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.mv-chat-tools-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-chat-filter-options { display: flex; flex-direction: column; gap: 4px; }
.mv-chat-filter-option { appearance: none; -webkit-appearance: none; position: relative; width: 100%; min-height: 48px; border: 0 !important; border-radius: 12px; background: transparent !important; padding: 9px 34px 9px 12px !important; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; cursor: pointer; box-shadow: none !important; transition: background .16s ease, transform .16s ease; }
.mv-chat-filter-option:hover { background: rgba(15, 23, 42, 0.04) !important; transform: translateY(-1px); }
.mv-chat-filter-option.active { background: #eff6ff !important; }
.mv-chat-filter-option.active::after { content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; transform: translateY(-50%); box-shadow: 0 0 0 3px rgba(22,163,74,0.12); }
.mv-chat-filter-option-label { font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 13px !important; font-weight: 700 !important; line-height: 1.25 !important; color: #0f172a !important; letter-spacing: 0 !important; }
.mv-chat-filter-option.active .mv-chat-filter-option-label { color: #0d3e9a !important; }
.mv-chat-filter-option-desc { margin-top: 2px; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 11px !important; font-weight: 400 !important; line-height: 1.25 !important; color: #7c8aa0 !important; letter-spacing: 0 !important; }
.mv-chat-mode-options { display: flex; flex-direction: column; gap: 4px; }
.mv-chat-mode-option { appearance: none; -webkit-appearance: none; position: relative; width: 100%; min-height: 48px; border: 0 !important; border-radius: 12px; background: transparent !important; padding: 9px 34px 9px 12px !important; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; cursor: pointer; box-shadow: none !important; transition: background .16s ease, color .16s ease, transform .16s ease; }
.mv-chat-mode-option:hover { background: rgba(15, 23, 42, 0.04) !important; transform: translateY(-1px); }
.mv-chat-mode-option.active { background: #eff6ff !important; }
.mv-chat-mode-option.active::after { content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; transform: translateY(-50%); box-shadow: 0 0 0 3px rgba(22,163,74,0.12); }
.mv-chat-mode-option-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 13px !important; font-weight: 700 !important; line-height: 1.25 !important; color: #0f172a !important; letter-spacing: 0 !important; }
.mv-chat-mode-option.active .mv-chat-mode-option-label { color: #0d3e9a !important; }
.mv-chat-mode-option-desc { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 11px !important; font-weight: 400 !important; line-height: 1.25 !important; color: #7c8aa0 !important; letter-spacing: 0 !important; }
#mv-chat-widget .mv-chat-mode-option:focus, #mv-chat-widget .mv-chat-mode-option:focus-visible { outline: none !important; box-shadow: none !important; }
.mv-chat-segment { display: none !important; flex-direction: column; gap: 2px; background: transparent; border: 0; border-radius: 10px; padding: 0; min-width: 0; box-shadow: none; overflow: visible; }
.mv-chat-segment + .mv-chat-segment { margin-top: 6px; padding-top: 6px; border-top: 1px solid #eef2f7; }
.mv-chat-mode-btn { appearance: none; -webkit-appearance: none; outline: none !important; border: 0 !important; background: transparent !important; color: #64748b !important; border-radius: 9px; min-width: 0; height: 34px; min-height: 34px; padding: 0 34px 0 12px !important; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-weight: 400 !important; font-size: 12px !important; line-height: 34px !important; cursor: pointer; transition: background .16s ease, color .16s ease; white-space: nowrap; letter-spacing: 0 !important; text-align: left; overflow: hidden; text-overflow: ellipsis; position: relative; }
.mv-chat-mode-btn.active { background: #eff6ff !important; color: #0d3e9a !important; font-weight: 700 !important; box-shadow: none !important; }
.mv-chat-mode-btn.active::after { content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; transform: translateY(-50%); box-shadow: 0 0 0 3px rgba(22,163,74,0.12); }
.mv-chat-mode-btn:hover { color: #0d3e9a !important; background: rgba(15, 23, 42, 0.04) !important; }
.mv-chat-mode-btn:focus, .mv-chat-mode-btn:focus-visible { outline: none !important; box-shadow: none !important; }
.mv-chat-mode-btn.active:focus-visible { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10), 0 0 0 2px rgba(13, 62, 154, 0.14) !important; }

/* Màn hình Nhập Thông Tin (Cho Khách mới) */
#mv-chat-auth { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; min-height: 0; padding: 14px 20px 10px; text-align: center; overflow: hidden; background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); scrollbar-width: none; -ms-overflow-style: none; }
#mv-chat-auth::-webkit-scrollbar { display: none; width: 0; height: 0; }
#mv-chat-auth h3 { font-size: 1.02rem; color: var(--text-main); margin-bottom: 4px; }
#mv-chat-auth p { font-size: 0.84rem; color: #66768d; margin-bottom: 8px; }
.mv-auth-input { width: 100%; height: 44px; padding: 0 16px; border-radius: 14px; border: 1px solid #dce5f2; margin-bottom: 8px; background: rgba(255, 255, 255, .9); color: #243653; font-size: 0.92rem; line-height: 44px; font-family: 'MVChatInter', 'Inter', sans-serif; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.mv-auth-input::placeholder { color: #8492a6; opacity: 1; }
.mv-auth-input:focus { border-color: rgba(13, 62, 154, .55); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(13, 62, 154, 0.1), 0 8px 20px rgba(15, 23, 42, .05); }

/* =================================================
   KHÓA CHẶT LAYOUT TRÁNH VỠ
   ================================================= */
#mv-chat-widget #mv-chat-core { flex: 1 1 0% !important; flex-direction: column !important; overflow: hidden !important; height: 100% !important; width: 100% !important; }
#mv-chat-widget.active #mv-chat-core[style*="display: flex"], #mv-chat-widget.active #mv-chat-core[style*="display: block"] { display: flex !important; }
#mv-chat-widget #mv-chat-messages { flex: 1 1 0% !important; overflow-y: auto !important; display: flex !important; flex-direction: column !important; padding: 20px !important; background: #f8fafc !important; gap: 12px !important; height: 100% !important; position: relative !important; }
#mv-chat-widget #mv-chat-messages::-webkit-scrollbar { width: 6px; }
#mv-chat-widget #mv-chat-messages::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; }
#mv-chat-widget #mv-chat-messages::before { content: ""; margin-top: auto !important; }
#mv-chat-widget #mv-chat-footer { flex-shrink: 0 !important; border-top: 1px solid var(--border) !important; background: #fff !important; z-index: 10 !important; margin-top: 0 !important; padding: 10px 16px !important; display: flex !important; align-items: flex-end !important; gap: 8px !important; }
#mv-chat-widget #mv-chat-footer.is-hidden { display: none !important; }
#mv-chat-widget .mv-chat-search-panel { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-bottom: 1px solid #e2e8f0; background: rgba(255,255,255,0.96); }
#mv-chat-widget .mv-chat-search-field { flex: 1 1 auto; min-width: 0; height: 34px; display: flex; align-items: center; gap: 7px; margin: 0; padding: 0 10px; border: 1px solid #dbe3ef; border-radius: 999px; background: #f8fafc; color: #64748b; }
#mv-chat-widget .mv-chat-search-field svg { width: 15px; height: 15px; flex: 0 0 15px; }
#mv-chat-widget .mv-chat-search-field input { width: 100%; min-width: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; color: #0f172a; font-size: 13px; line-height: 34px; padding: 0; }
#mv-chat-widget .mv-chat-search-count { flex: 0 0 auto; min-width: 38px; color: #64748b; font-size: 11px; font-weight: 700; text-align: center; white-space: nowrap; }
#mv-chat-widget .mv-chat-search-nav,
#mv-chat-widget .mv-chat-search-close { width: 30px; height: 30px; flex: 0 0 30px; display: flex; align-items: center; justify-content: center; border: 1px solid #dbe3ef; border-radius: 50%; background: #fff; color: #475569; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
#mv-chat-widget .mv-chat-search-nav svg,
#mv-chat-widget .mv-chat-search-close svg { width: 15px; height: 15px; }
#mv-chat-widget .mv-chat-search-nav:hover,
#mv-chat-widget .mv-chat-search-close:hover { background: #eff6ff; border-color: #bfdbfe; color: #0d3e9a; }
#mv-chat-widget .mv-chat-search-nav:disabled { opacity: .45; cursor: not-allowed; background: #f8fafc; color: #94a3b8; }
#mv-chat-widget .mv-chat-search-match { outline: 2px solid rgba(237, 9, 164, .32); outline-offset: 2px; }
#mv-chat-widget .mv-chat-search-current { outline-color: rgba(13, 62, 154, .58); box-shadow: 0 8px 22px rgba(13, 62, 154, .14); }

/* Bong bóng chat */
.mv-msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.46; animation: chatFadeIn 0.3s ease; word-wrap: break-word; flex-shrink: 0; overflow: visible !important; position: relative; transition: margin-bottom 0.2s ease; }
@keyframes chatFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.mv-msg.has-reaction { margin-bottom: 18px !important; }
.mv-msg:not(.has-reaction) { margin-bottom: 4px; }
.mv-msg-system { background: #ffffff; color: var(--text-body); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.mv-msg-user { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; box-shadow: 0 2px 5px rgba(13, 62, 154, 0.2); }
.mv-chat-time { font-size: 10px; opacity: 0.7; margin-top: 6px; text-align: right; }
.mv-msg-system .mv-chat-time { text-align: left; }
.mv-msg img { max-width: 100%; height: auto; border-radius: 8px; margin-top: 5px; }
#mv-chat-widget .mv-msg.mv-msg-ai { max-width: 82%; padding: 11px 13px 9px; border-color: #dfe8f7; background: linear-gradient(180deg, #fff 0%, #fbfdff 100%); border-bottom-left-radius: 5px; box-shadow: 0 10px 24px rgba(15, 23, 42, .06); }
#mv-chat-widget .mv-msg.mv-msg-ai .mv-msg-body { color: #1e293b; font-size: 14.5px; line-height: 1.46; }
#mv-chat-widget .mv-msg.mv-msg-ai .mv-ai-md-heading { display: block; margin: 0 0 6px; color: #12234a; font-size: 14.5px; font-weight: 800; line-height: 1.34; }
#mv-chat-widget .mv-msg.mv-msg-ai .mv-ai-md-heading + br,
#mv-chat-widget .mv-msg.mv-msg-ai .mv-ai-md-heading + br + br { display: none; }
#mv-chat-widget .mv-msg.mv-msg-ai strong:not(.mv-ai-md-heading) { font-weight: 750; color: #14346f; }
#mv-chat-widget .mv-msg.mv-msg-ai a { color: #0d3e9a; font-weight: 700; text-decoration: none; border-bottom: 1px solid rgba(13, 62, 154, .22); }
#mv-chat-widget .mv-msg.mv-msg-ai code { padding: 1px 5px; border-radius: 6px; background: #eef4ff; color: #0d3e9a; font-size: .9em; }
#mv-chat-widget .mv-msg.mv-msg-ai pre { margin: 7px 0 2px; padding: 9px 10px; border-radius: 10px; background: #0f172a; color: #e2e8f0; overflow-x: auto; line-height: 1.45; }

/* Form nhập nội dung Footer */
.mv-chat-input-wrapper { flex: 1; min-width: 0; min-height: 36px; background: #f1f5f9; border-radius: 50px; padding: 7px 14px; display: flex; align-items: center; border: none !important; outline: none !important; box-shadow: none !important; transition: border-radius .16s ease, padding .16s ease, background .16s ease; }
.mv-chat-input-wrapper.is-multiline { border-radius: 20px !important; padding-top: 8px !important; padding-bottom: 8px !important; align-items: flex-start; }
#mv-chat-widget .mv-chat-input-wrapper:has(.mv-chat-input-field:placeholder-shown) { min-height: 36px !important; border-radius: 50px !important; padding-top: 7px !important; padding-bottom: 7px !important; align-items: center !important; }
.mv-chat-input-wrapper:hover, .mv-chat-input-wrapper:focus, .mv-chat-input-wrapper:active, .mv-chat-input-wrapper:focus-within { border: none !important; outline: none !important; box-shadow: none !important; }
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field { display: block; position: relative; top: var(--mv-chat-input-top, -1px); width: 100%; min-width: 0; height: 20px; min-height: 20px !important; max-height: 80px !important; padding: 0 !important; margin: 0 !important; border: none !important; background: transparent !important; outline: none !important; resize: none; overflow-x: hidden; overflow-y: hidden; font-size: 14.5px; line-height: 20px !important; color: var(--text-main); font-family: 'MVChatInter', 'Inter', sans-serif; box-shadow: none !important; appearance: none; -webkit-appearance: none; vertical-align: top; scrollbar-width: none !important; -ms-overflow-style: none !important; }
#mv-chat-widget .mv-chat-input-wrapper.is-multiline .mv-chat-input-field { line-height: 20px !important; }
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field:placeholder-shown { height: 20px !important; overflow-y: hidden !important; --mv-chat-input-top: -1px; }
.mv-chat-input-wrapper .mv-chat-input-field:hover, .mv-chat-input-wrapper .mv-chat-input-field:focus, .mv-chat-input-wrapper .mv-chat-input-field:active { background: transparent !important; background-color: transparent !important; border: none !important; outline: none !important; box-shadow: none !important; }
.mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; background: transparent; }
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:single-button,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical:decrement,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical:increment,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical:start,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical:end,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical:start:decrement,
#mv-chat-widget .mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-button:vertical:end:increment { display: none !important; width: 0 !important; height: 0 !important; min-width: 0 !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; background: transparent !important; background-image: none !important; -webkit-appearance: none !important; }
.mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-track { background: rgba(100, 116, 139, .08); border-radius: 999px; }
.mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .42); border-radius: 999px; min-height: 16px; }
.mv-chat-input-wrapper .mv-chat-input-field::-webkit-scrollbar-corner { background: transparent; }
.mv-chat-input-wrapper .mv-chat-input-field::-webkit-resizer { display: none; }
.mv-chat-send-btn { background: var(--primary); color: white; border: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; flex-shrink: 0; }
.mv-chat-send-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.mv-chat-send-btn:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; }

/* Typing Indicator */
.mv-typing-indicator { display: none; align-items: center; gap: 4px; padding: 12px 16px; background: #ffffff; border: 1px solid var(--border); border-radius: 16px; border-bottom-left-radius: 4px; align-self: flex-start; width: fit-content; margin-bottom: 10px; flex-shrink: 0; }
.mv-typing-indicator span { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out both; }
.mv-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.mv-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* =================================================
   TIN NHẮN MẪU (CANNED RESPONSES)
   ================================================= */
.mv-canned-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px; position: relative; display: flex; flex-direction: column; gap: 12px; transition: all 0.3s ease; }
.mv-canned-item:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 4px 20px rgba(13, 62, 154, 0.08); }
.mv-canned-input-row { display: flex; align-items: center; width: 100%; gap: 12px; }
.mv-canned-input-group { display: flex; align-items: center; flex: 1; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; transition: 0.2s; height: 42px; }
.mv-canned-input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13, 62, 154, 0.1); }
.mv-canned-prefix { flex: 0 0 44px !important; width: 44px !important; max-width: 44px !important; height: 100%; display: flex; align-items: center; justify-content: center; background: #f1f5f9; color: #94a3b8; font-weight: 800; font-family: monospace; border-right: 1px solid #e2e8f0; font-size: 1.05rem; user-select: none; box-sizing: border-box; padding: 0; margin: 0; }
.mv-canned-input-short { flex: 1; min-width: 0; border: none; padding: 0 12px; outline: none; font-family: monospace; font-size: 0.95rem; font-weight: 600; color: var(--text-main); background: transparent; height: 100%; box-sizing: border-box; }
.mv-canned-input-short::placeholder { color: #cbd5e1; font-weight: 400; font-family: 'MVChatInter', 'Inter', sans-serif; }
.mv-canned-input-text { width: 100%; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 0.95rem; resize: vertical; min-height: 80px; font-family: 'MVChatInter', 'Inter', sans-serif; transition: 0.2s; outline: none; background: #fff; color: var(--text-body); box-sizing: border-box; }
.mv-canned-input-text:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13, 62, 154, 0.1); }
.mv-canned-input-text::placeholder { color: #94a3b8; }
.del-canned-btn { color: var(--danger); background: var(--danger-bg); border: none; width: 42px; height: 42px; border-radius: 50px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); flex-shrink: 0; }
.del-canned-btn:hover { background: var(--danger); color: #fff; transform: scale(1.05); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25); }
.mv-suggestion-item { padding: 10px 16px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: 0.2s; display: flex; flex-direction: column; gap: 4px; }
.mv-suggestion-item:last-child { border-bottom: none; }
.mv-suggestion-item:hover, .mv-suggestion-item.active { background: #eff6ff; }
.mv-suggestion-short { font-size: 0.8rem; font-weight: 700; color: var(--primary); font-family: monospace; }
.mv-suggestion-text { font-size: 0.85rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =================================================
   DANH SÁCH CHAT
   ================================================= */
.mv-chat-list-del-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--danger-bg); color: var(--danger); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); flex-shrink: 0; }
.mv-chat-list-del-btn:hover { background: var(--danger); color: white; transform: scale(1.1); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25); }
@media (hover: none) { .mv-chat-list-del-btn { opacity: 1; background: transparent; } }

/* Admin List */
#mv-admin-chat-list { flex: 1; overflow-y: auto; background: #fff; flex-direction: column; min-height: 0; }
.mv-admin-chat-item { padding: 14px 18px; border-bottom: 1px solid #f1f5f9; cursor: pointer; display: flex; align-items: flex-start; gap: 12px; transition: background .16s ease; }
.mv-admin-chat-item:hover { background: #f8fafc; }
.mv-admin-chat-item.unread { background: #eff6ff; }
.mv-admin-chat-item:hover .mv-chat-list-del-btn { opacity: 1; }
.mv-admin-avatar { width: 40px; height: 40px; background: #e0e7ff; color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; flex-shrink: 0; }
.mv-admin-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.mv-admin-name { font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 0.95rem !important; font-weight: 700 !important; color: var(--text-main); margin-bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; min-width: 0; }
.mv-admin-time { font-size: 0.75rem; color: #94a3b8; font-weight: 400; white-space: nowrap; line-height: 1.3; }
.mv-admin-msg { font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 0.85rem !important; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 0; min-width: 0; }
.mv-admin-chat-item.unread .mv-admin-name { color: var(--primary); }
.mv-admin-chat-item.unread .mv-admin-msg { font-weight: 600; color: var(--text-body); }

/* User List */
.mv-user-chat-item { margin: 10px 12px 0; padding: 14px; border: 1px solid #edf2f7; border-radius: 16px; cursor: pointer; display: flex; align-items: flex-start; gap: 12px; transition: background .16s ease, border-color .16s ease; background: #fff; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04); }
.mv-user-chat-item:hover { background: #f8fbff; border-color: #cfe0ff; transform: none; }
.mv-user-chat-item.unread { background: #e0e7ff; }
.mv-user-chat-item.unread .mv-user-name { color: var(--primary); }
.mv-user-chat-item.unread .mv-user-msg { font-weight: 600; color: var(--text-body); }
.mv-user-chat-item:hover .mv-chat-list-del-btn { opacity: 1; }
.mv-user-avatar { width: 40px; height: 40px; background: var(--vibe-gradient); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; flex-shrink: 0; }
.mv-user-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.mv-user-name { font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 0.95rem !important; font-weight: 700 !important; color: var(--text-main); margin-bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; min-width: 0; }
.mv-user-time { font-size: 0.75rem; color: #94a3b8; font-weight: 400; white-space: nowrap; line-height: 1.3; }
.mv-user-msg { font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 0.85rem !important; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 0; min-width: 0;}

@media (max-width: 991px) { #mv-chat-widget { bottom: var(--mv-floating-chat-bottom, calc(env(safe-area-inset-bottom, 0px) + 54px)); right: var(--mv-floating-right, 16px); } }
@media (max-width: 768px) { #mv-chat-box { width: calc(100vw - 32px); height: min(480px, calc(100dvh - 106px)); min-height: min(380px, calc(100dvh - 106px)); max-height: calc(100dvh - 106px); right: 0; } .mv-chat-mode-bar { top: 84px; left: auto; right: 12px; width: 300px; max-width: calc(100vw - 40px); } .mv-chat-filter-menu { top: 84px; left: auto; right: 12px; width: 300px; max-width: calc(100vw - 40px); } .mv-chat-tools-menu { top: 84px; right: 12px; max-width: calc(100vw - 40px); } }

/* =================================================
   DYNAMIC CSS EXTRACTED FROM JS
   ================================================= */
.mv-chat-unread-badge { position: absolute; top: -4px; right: -4px; background: #ef4444; color: white; font-size: 12px; font-weight: 800; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 10; pointer-events: none; }
.mv-chat-status-badge, .mv-chat-scope-badge { display: inline-flex; align-items: center; max-width: 118px; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; letter-spacing: 0 !important; }
.mv-chat-status-badge.closed { background: #f1f5f9; color: #64748b; }
.mv-chat-status-badge.deleted { background: var(--danger-bg); color: var(--danger-hover); }
.mv-chat-status-badge.open { background: #dcfce7; color: #15803d; }
.mv-chat-scope-badge.site { background: #e0f2fe; color: #0369a1; }
.mv-chat-scope-badge.support { background: #f1f5f9; color: #475569; }
.mv-chat-name-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mv-chat-name-text { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.mv-chat-badge-row { display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; overflow: hidden; margin: 0; }
.mv-chat-snippet-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0% !important; min-width: 0; line-height: 18px; }
#mv-chat-widget .mv-chat-snippet-val { display: inline; position: relative; top: 1.5px; }
.mv-chat-topic-tag { display: inline-flex; align-items: center; color: var(--primary); font-size: 0.8rem; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: 18px; line-height: 18px; flex: 0 1 auto; margin-right: 0; }
.unread-dot { width: 8px; height: 8px; background-color: var(--primary); border-radius: 50%; flex: 0 0 8px; box-shadow: 0 0 6px rgba(13, 62, 154, 0.4); }
.mv-empty-state { flex: 1 1 auto; min-height: 100%; width: 100%; text-align: center; padding: 0; color: #94a3b8; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; }
.mv-empty-state .btn-spinner { margin: auto; }
.mv-chat-empty-panel { flex: 1 1 auto; min-height: 100%; width: 100%; margin: 0; padding: 64px 34px 32px; border: 0; background: transparent; text-align: center; color: #94a3b8; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mv-chat-empty-icon { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: transparent; color: #cbd5e1; }
.mv-chat-empty-icon svg { width: 48px; height: 48px; stroke-width: 1.8; }
.mv-chat-empty-panel h5 { margin: 0 0 6px !important; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 15px !important; font-weight: 400 !important; color: #64748b !important; line-height: 1.4 !important; }
.mv-chat-empty-panel p { margin: 0 !important; max-width: 280px; font-family: 'MVChatInter', 'Inter', Arial, sans-serif !important; font-size: 14px !important; font-weight: 400 !important; line-height: 1.55 !important; color: #94a3b8 !important; }
.mv-canned-empty { background: #fff; border-radius: 16px; border: 1px dashed #cbd5e1; }
.mv-canned-empty svg { margin-bottom: 12px; }

/* Tin nhắn mở rộng (Reply, Reaction, Actions) */
.mv-msg-reply { font-size: 0.8rem; background: rgba(0,0,0,0.05); padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-msg-user .mv-msg-reply { border-left: 3px solid rgba(255,255,255,0.5); }
.mv-msg-system .mv-msg-reply { border-left: 3px solid var(--primary); }
.mv-msg-reaction { position: absolute; bottom: -12px; background: white; border-radius: 50%; padding: 3px; box-shadow: 0 2px 6px rgba(0,0,0,0.15); display: flex; align-items: center; justify-content: center; z-index: 5; border: 1px solid #f1f5f9; }
.mv-msg-user .mv-msg-reaction { right: 16px; }
.mv-msg-system .mv-msg-reaction { left: 16px; }
.mv-msg-actions { position: absolute; top: 50%; transform: translateY(-50%); display: flex; gap: 4px; opacity: 0; transition: 0.2s; pointer-events: none; z-index: 10; }
.mv-msg-user .mv-msg-actions { right: 100%; padding-right: 8px; }
.mv-msg-system .mv-msg-actions { left: 100%; padding-left: 8px; }
.mv-msg:hover .mv-msg-actions { opacity: 1 !important; pointer-events: auto !important; }
.mv-msg-action-btn { background: white; border: 1px solid #e2e8f0; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #64748b; transition: 0.2s; }
.mv-msg-action-btn:hover { background: #f8fafc !important; color: var(--primary) !important; border-color: var(--primary) !important; transform: scale(1.05); }
.mv-msg-action-btn.btn-recall { color: var(--danger); }
.mv-msg-action-btn.btn-recall:hover { background: var(--danger-bg) !important; color: var(--danger-hover) !important; border-color: var(--danger-border) !important; }
.msg-is-recalled { background: transparent !important; border: 1px solid #e2e8f0 !important; box-shadow: none !important; }
.msg-is-recalled.mv-msg-user { border-color: rgba(13, 62, 154, 0.2) !important; color: var(--text-body); }
.msg-is-recalled.mv-msg-system { border-color: #e2e8f0 !important; }
.msg-is-recalled .mv-chat-time { color: #94a3b8; }

/* Khối xem trước Reply */
.mv-chat-reply-preview { background: #f8fafc; border-top: 1px solid #e2e8f0; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: #64748b; }
.mv-chat-reply-preview strong { color: var(--text-main); margin-left: 4px; }
.mv-chat-reply-preview .close-reply { cursor: pointer; color: var(--danger); font-weight: bold; padding: 4px; font-size: 1rem; line-height: 1; border-radius: 4px; transition: 0.2s; }
.mv-chat-reply-preview .close-reply:hover { background: var(--danger-bg); }

/* Các tin nhắn đặc biệt */
.mv-chat-spinner-msg { position: absolute !important; top: 50% !important; left: 50% !important; right: auto !important; bottom: auto !important; width: auto !important; max-width: none !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; background: transparent !important; border: none !important; text-align: center; box-shadow: none !important; align-self: auto !important; display: flex !important; align-items: center !important; justify-content: center !important; pointer-events: none !important; transform: translate(-50%, -50%) !important; animation: none !important; }
.mv-chat-seen-status { background: transparent !important; border: none !important; box-shadow: none !important; align-self: flex-end; padding: 0 14px 0 0 !important; margin-top: -8px; margin-bottom: 12px !important; font-size: 0.75rem !important; color: #94a3b8 !important; max-width: 100%; display: flex; align-items: center; gap: 2px; }
.mv-msg-error { background: var(--danger-bg) !important; color: var(--danger) !important; border-color: var(--danger-border) !important; }

/* Notice đóng chat */
.mv-chat-closed-text { color: var(--danger); font-size: 0.9rem; margin-bottom: 0; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* Menu chuột phải (Context Menu) */
#mv-chat-context-menu { position: fixed; z-index: 999999; background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); border: 1px solid #e2e8f0; padding: 8px; min-width: 230px; opacity: 0; visibility: hidden; transform: scale(0.95); transform-origin: top left; transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s; }
.mv-ctx-item { padding: 10px 16px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 12px; font-size: 0.95rem; font-family: 'MVChatInter', 'Inter', sans-serif; transition: 0.2s; white-space: nowrap; color: var(--text-body); user-select: none; }
.mv-ctx-item:hover { background: #f8fafc; color: var(--primary); }
.mv-ctx-item svg { width: 16px; height: 16px; transition: 0.2s; }
.mv-ctx-divider { height: 1px; background: #f1f5f9; margin: 6px 0; }
.mv-chat-ctx-delete { color: var(--danger); }
.mv-chat-ctx-delete:hover { background: var(--danger-bg); color: var(--danger-hover); }
.mv-chat-ctx-delete svg { stroke: var(--danger); }

/* Ô check xóa vĩnh viễn */
.mv-chat-delete-everyone-wrap { margin-top: 15px; text-align: left; background: var(--danger-bg); padding: 12px; border-radius: 12px; border: 1px solid var(--danger-border); }
.mv-chat-delete-everyone-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--danger); font-weight: 600; margin: 0; }
.mv-chat-delete-everyone-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--danger); }

/* =================================================
   UI TEMPLATE UTILITIES
   ================================================= */
.mv-chat-back-btn { width: 28px; height: 32px; background: none; border: none; color: white; cursor: pointer; padding: 0; margin-right: -2px; display: flex; align-items: center; justify-content: flex-start; flex-shrink: 0; }
.mv-chat-header-avatar-bg { background: rgba(255, 255, 255, 0.15); }
.mv-chat-header-avatar-img { width: 24px; height: 24px; object-fit: contain; }
.mv-chat-header-topic { font-size: 0.8rem; opacity: 0.9; margin-top: 2px; font-weight: 400; line-height: 1.3; word-break: break-word; }
.mv-chat-header-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.mv-chat-tools-group { display: none !important; gap: 4px; align-items: center; }
.mv-chat-list-user { flex: 1; flex-direction: column; background: #f8fafc; position: relative; }
.mv-chat-list-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.mv-chat-list-search-panel .mv-chat-list-search-count:empty { min-width: 0; display: none; }
.mv-chat-list-footer { padding: 14px 16px 16px; background: #fff; border-top: 1px solid var(--border); text-align: center; flex-shrink: 0; box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.03); }
.btn-rounded-50 { border-radius: 50px; }
.mv-chat-auth-title { font-size: 1.02rem; color: var(--primary); margin: 0 0 4px; }
.mv-chat-auth-desc { max-width: 300px; margin: 0 auto 8px; font-size: 0.84rem; color: #66768d; line-height: 1.4; }
.mv-typing-indicator-dot { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out both; }
.mv-chat-closed-notice { padding: 15px; text-align: center; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.mv-chat-closed-text-sm { color: #64748b; font-size: 0.9rem; margin-bottom: 0; }
.mv-canned-suggestions-box { position: absolute; bottom: 100%; left: 16px; right: 16px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 -4px 15px rgba(0,0,0,0.1); max-height: 200px; overflow-y: auto; z-index: 20; margin-bottom: 8px; }
.mv-chat-input-field { width: 100%; border: none; background: transparent; outline: none; font-size: 0.95rem; color: var(--text-main); }
.mv-canned-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px); z-index: 50; flex-direction: column; border-radius: 20px; overflow: hidden; }
.mv-canned-modal-header { background: #fff; color: var(--text-main); border-bottom: 1px solid var(--border); padding: 20px; }
.btn-canned-close { background: none; border: none; cursor: pointer; padding: 0 10px 0 0; color: var(--text-light); transition: 0.2s; }
.mv-canned-modal-title { margin: 0; font-size: 16px; font-weight: 800; }
.btn-canned-add { margin-left: auto; padding: 8px 16px; font-size: 0.85rem; border-radius: 50px; display: flex; align-items: center; gap: 6px; }
.btn-canned-save { border-radius: 50px; font-size: 1rem; padding: 12px 32px; }
#mv-canned-list { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; background: #f8fafc; }

/* SYSTEM WIDE UTILITIES */
.is-hidden { display: none !important; }

html[data-theme="dark"] .mv-chat-mode-bar,
html[data-theme="dark"] .mv-chat-filter-menu,
html[data-theme="dark"] .mv-chat-tools-menu {
    background: rgba(18, 26, 43, 0.94) !important;
    border-color: var(--border) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38) !important;
}

html[data-theme="dark"] .mv-chat-mode-option:hover,
html[data-theme="dark"] .mv-chat-filter-option:hover,
html[data-theme="dark"] .mv-chat-mode-btn:hover,
html[data-theme="dark"] .mv-chat-tools-menu-item:hover {
    background: rgba(139, 181, 255, 0.1) !important;
    color: var(--primary) !important;
}

html[data-theme="dark"] .mv-chat-mode-option.active,
html[data-theme="dark"] .mv-chat-filter-option.active,
html[data-theme="dark"] .mv-chat-mode-btn.active {
    background: rgba(139, 181, 255, 0.14) !important;
    color: var(--primary) !important;
}

html[data-theme="dark"] .mv-chat-mode-option-label,
html[data-theme="dark"] .mv-chat-filter-option-label,
html[data-theme="dark"] .mv-chat-mode-btn,
html[data-theme="dark"] .mv-chat-tools-menu-item {
    color: var(--text-main) !important;
}

html[data-theme="dark"] #mv-chat-widget .mv-chat-tools-menu-item.mv-ai-clear-thread {
    color: var(--primary) !important;
    box-shadow: none !important;
    filter: none !important;
}

html[data-theme="dark"] #mv-chat-widget .mv-chat-tools-menu-item.mv-ai-clear-thread:hover {
    background: rgba(139, 181, 255, 0.12) !important;
    color: var(--primary) !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
}

html[data-theme="dark"] .mv-chat-mode-option.active .mv-chat-mode-option-label,
html[data-theme="dark"] .mv-chat-filter-option.active .mv-chat-filter-option-label,
html[data-theme="dark"] .mv-chat-mode-btn.active {
    color: var(--primary) !important;
}

html[data-theme="dark"] .mv-chat-mode-option-desc,
html[data-theme="dark"] .mv-chat-filter-option-desc {
    color: var(--text-light) !important;
}

html[data-theme="dark"] .mv-chat-scope-badge.site {
    background: rgba(14, 165, 233, 0.14) !important;
    color: #7dd3fc !important;
}

html[data-theme="dark"] .mv-chat-scope-badge.support {
    background: rgba(139, 181, 255, 0.12) !important;
    color: var(--primary) !important;
}
#mv-chat-widget .mv-ai-entry-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 8px;
    padding: 10px 14px;
    text-align: left;
    border: 1px solid rgba(108, 46, 231, .12);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 255, .98));
    box-shadow: 0 6px 20px rgba(15, 23, 42, .04);
}

#mv-chat-widget .mv-ai-entry-kicker {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(108, 46, 231, .07);
    color: #6c2ee7;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

#mv-chat-widget .mv-ai-entry-title {
    margin: 2px 0 0;
    color: var(--primary);
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.25;
}

#mv-chat-widget .mv-ai-entry-desc {
    margin: 0 0 2px;
    color: #66768d;
    font-size: 11.5px;
    line-height: 1.4;
}

#mv-chat-widget .mv-auth-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px;
    color: #94a3b8;
    font-size: 11px;
}

#mv-chat-widget .mv-auth-divider:before,
#mv-chat-widget .mv-auth-divider:after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

#mv-chat-widget #btn-start-ai-advisor-auth {
    width: 100% !important;
    min-height: 34px;
    margin: 4px 0 0;
    padding: 0 16px !important;
    white-space: nowrap;
    text-align: center;
    border-radius: 50px;
    font-weight: 700;
    font-size: 12.5px;
}

#mv-chat-widget .mv-ai-entry-btn {
    margin-bottom: 8px;
}

#mv-chat-widget #btn-start-chat {
    min-height: 44px;
    margin-top: 2px;
    padding: 0 20px;
}

#mv-chat-widget .mv-chat-scope-badge.ai {
    background: #f3e8ff;
    color: #7e22ce;
}

#mv-chat-widget .mv-ai-payload {
    position: relative;
    z-index: 1;
    width: min(100%, 320px);
    margin: 8px 0 0;
}

#mv-chat-widget .mv-ai-action-payload {
    align-self: flex-start;
    width: min(100%, 340px);
    max-width: 85%;
    margin: -2px 0 4px;
    padding: 0;
}

#mv-chat-widget .mv-ai-card-payload {
    width: 100%;
}

#mv-chat-widget .mv-ai-action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0;
}

#mv-chat-widget .mv-ai-action-chip,
#mv-chat-widget .mv-ai-card-action {
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #0d3e9a;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

#mv-chat-widget .mv-ai-action-chip:hover,
#mv-chat-widget .mv-ai-card-action:hover {
    background: #f8fafc;
    border-color: #c7d2fe;
    transform: translateY(-1px);
}

#mv-chat-widget .mv-ai-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

#mv-chat-widget .mv-ai-template-card {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}

#mv-chat-widget .mv-ai-template-thumb {
    height: 110px;
    background: #f1f5f9;
}

#mv-chat-widget .mv-ai-template-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#mv-chat-widget .mv-ai-template-info {
    padding: 12px;
}

#mv-chat-widget .mv-ai-template-title {
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

#mv-chat-widget .mv-ai-template-meta {
    margin-top: 2px;
    color: #7c3aed;
    font-size: 11px;
    font-weight: 800;
}

#mv-chat-widget .mv-ai-template-desc {
    margin-top: 7px;
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
}

#mv-chat-widget .mv-ai-template-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

#mv-chat-widget .mv-ai-card-action.primary {
    border-color: transparent;
    background: var(--vibe-gradient);
    color: #fff;
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-entry-card {
    border-color: rgba(139, 181, 255, .24);
    background: linear-gradient(135deg, rgba(124, 92, 255, .16), rgba(255, 91, 200, .12));
    box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-entry-kicker,
html[data-theme="dark"] #mv-chat-widget .mv-chat-scope-badge.ai {
    background: rgba(168, 85, 247, .18);
    color: #d8b4fe;
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-entry-title,
html[data-theme="dark"] #mv-chat-widget .mv-ai-template-title {
    color: var(--text-main);
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-entry-desc,
html[data-theme="dark"] #mv-chat-widget .mv-ai-template-desc {
    color: var(--text-body);
}

html[data-theme="dark"] #mv-chat-widget .mv-auth-divider {
    color: var(--text-light);
}

html[data-theme="dark"] #mv-chat-widget .mv-auth-divider:before,
html[data-theme="dark"] #mv-chat-widget .mv-auth-divider:after {
    background: var(--border);
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-action-chip,
html[data-theme="dark"] #mv-chat-widget .mv-ai-card-action,
html[data-theme="dark"] #mv-chat-widget .mv-ai-template-card {
    border-color: var(--border);
    background: #121a2b;
    color: var(--primary);
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-action-chip:hover,
html[data-theme="dark"] #mv-chat-widget .mv-ai-card-action:hover {
    background: rgba(139, 181, 255, .12);
    border-color: rgba(139, 181, 255, .36);
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-template-thumb {
    background: #0f1728;
}

html[data-theme="dark"] #mv-chat-widget .mv-ai-template-meta {
    color: #c084fc;
}

@media (max-width: 480px) {
    #mv-chat-widget .mv-ai-payload {
        width: 100%;
    }

    #mv-chat-widget .mv-ai-template-thumb {
        height: 96px;
    }
}

/* =================================================
   AI CHAT WELCOME STATE & SUGGESTION CHIPS
   ================================================= */
.mv-ai-welcome-state {
    align-self: center !important;
    max-width: 100% !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 10px 0 !important;
    margin-bottom: 20px !important;
    animation: chatFadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mv-ai-welcome-header {
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mv-ai-welcome-icon {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--vibe-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(108, 46, 231, 0.25);
}

.mv-ai-welcome-icon svg.ai-sparkle-icon {
    width: 36px;
    height: 36px;
    animation: aiWelcomeSparkle 3s infinite ease-in-out;
}

.ai-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(108, 46, 231, 0.4);
    animation: aiPulseRing 2s infinite cubic-bezier(0.215, 0.610, 0.355, 1);
}

@keyframes aiWelcomeSparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.15) rotate(45deg); opacity: 0.95; }
}

@keyframes aiPulseRing {
    0% { transform: scale(0.95); opacity: 0.8; }
    80%, 100% { transform: scale(1.4); opacity: 0; }
}

.mv-ai-welcome-header h3 {
    font-family: 'MVChatGilroy', 'SVN-Gilroy Bold', sans-serif;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--text-main);
    margin: 0 0 8px 0 !important;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mv-ai-welcome-header p {
    font-size: 0.88rem !important;
    color: #64748b;
    line-height: 1.5;
    margin: 0 !important;
    max-width: 290px;
}

html[data-theme="dark"] .mv-ai-welcome-header h3 {
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

html[data-theme="dark"] .mv-ai-welcome-header p {
    color: #94a3b8;
}

.mv-ai-suggestions {
    width: 100%;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    padding: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.03);
}

html[data-theme="dark"] .mv-ai-suggestions {
    background: rgba(18, 26, 43, 0.6);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.mv-ai-suggestion-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

html[data-theme="dark"] .mv-ai-suggestion-title {
    color: #94a3b8;
}

.mv-ai-suggestion-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mv-ai-welcome-chip {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mv-ai-welcome-chip:hover {
    border-color: var(--primary);
    background: #f8fbff;
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 62, 154, 0.06);
}

.mv-ai-welcome-chip:active {
    transform: translateY(0);
}

.mv-ai-welcome-chip::after {
    content: "→";
    font-weight: 700;
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform: translateX(-4px);
}

.mv-ai-welcome-chip:hover::after {
    opacity: 1;
    transform: translateX(0);
}

html[data-theme="dark"] .mv-ai-welcome-chip {
    border-color: rgba(255, 255, 255, 0.08);
    background: #1e293b;
    color: #cbd5e1;
}

html[data-theme="dark"] .mv-ai-welcome-chip:hover {
    border-color: var(--primary);
    background: rgba(139, 181, 255, 0.08);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
