/* Đông Nam AI Assistant — khung chat. Màu và chữ theo design system Đông Nam Infotech. */
.dnai {
	--dnai-c: #0062ff;
	--dnai-a: #ff6600;
	--dnai-ink: #0f172a;
	--dnai-heading: #090e17;
	--dnai-text-2: #334155;
	--dnai-muted: #475569;
	--dnai-border: #e2e8f0;
	--dnai-subtle: #f8fafc;
	--dnai-soft: #f0f6ff;
	--dnai-lift: 0px;
	--dnai-gap: 20px;
	font-family: 'Geologica', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	font-size: 15px;
	line-height: 1.55;
	color: var(--dnai-ink);
	-webkit-font-smoothing: antialiased;
}
.dnai *, .dnai *::before, .dnai *::after { box-sizing: border-box; }
.dnai button, .dnai input { font: inherit; }
.dnai .dnai-i { width: 20px; height: 20px; flex: 0 0 auto; }
.dnai :focus-visible { outline: none; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--dnai-c); }
.dnai-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Nút nổi ---------- */
.dnai:not(.is-inline) { position: fixed; z-index: 70; bottom: calc(var(--dnai-gap) + var(--dnai-lift)); left: var(--dnai-gap); }
.dnai[data-pos="right"]:not(.is-inline) { left: auto; right: var(--dnai-gap); }
.dnai-toggle {
	position: relative; display: grid; place-items: center; width: 60px; height: 60px; padding: 0;
	border: 0; border-radius: 50%; background: var(--dnai-c); color: #fff; cursor: pointer; touch-action: none;
	box-shadow: 0 12px 28px rgba(0, 98, 255, .35); transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}
.dnai-toggle:hover { transform: scale(1.06); }
.dnai.is-dragging .dnai-toggle { cursor: grabbing; transform: scale(1.06); }
.dnai-toggle .dnai-i { width: 26px; height: 26px; }
.dnai-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--dnai-c); animation: dnai-ring 2.4s ease-out infinite; pointer-events: none; }
.dnai-ic-close, .dnai.is-open .dnai-ic-chat { display: none; }
.dnai.is-open .dnai-ic-close { display: block; }
.dnai.is-open .dnai-ring { display: none; }
.dnai-dot { position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; background: var(--dnai-a); display: none; }
.dnai.has-unread .dnai-dot { display: block; }
@keyframes dnai-ring { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(1.55); opacity: 0; } }

/* Lời chào chủ động */
.dnai-teaser {
	position: absolute; bottom: 74px; left: 0; display: flex; align-items: flex-start; gap: 4px;
	width: max-content; max-width: min(300px, calc(100vw - 40px)); padding: 12px 8px 12px 16px;
	border-radius: 16px 16px 16px 4px; background: #fff; box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
	animation: dnai-pop .3s cubic-bezier(.2, .9, .3, 1.2);
}
.dnai-teaser[hidden] { display: none; }
.dnai[data-pos="right"] .dnai-teaser { left: auto; right: 0; border-radius: 16px 16px 4px 16px; }
.dnai-teaser-text { padding: 0; border: 0; background: none; color: var(--dnai-ink); font-size: 14px; line-height: 1.5; text-align: left; cursor: pointer; }
.dnai-teaser-x { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--dnai-muted); cursor: pointer; }
.dnai-teaser-x .dnai-i { width: 16px; height: 16px; }
@keyframes dnai-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- Khung chat ---------- */
.dnai-panel {
	display: flex; flex-direction: column; overflow: hidden;
	border: 1px solid var(--dnai-border); border-radius: 20px; background: #fff;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.dnai:not(.is-inline) .dnai-panel {
	position: absolute; bottom: 76px; left: 0; width: 390px; height: min(640px, calc(100vh - 130px - var(--dnai-lift)));
	min-height: 360px; opacity: 0; visibility: hidden; transform: translateY(12px) scale(.98); transform-origin: bottom left;
	transition: opacity .22s, transform .22s, visibility .22s;
}
.dnai[data-pos="right"]:not(.is-inline) .dnai-panel { left: auto; right: 0; transform-origin: bottom right; }
.dnai.is-open:not(.is-inline) .dnai-panel { opacity: 1; visibility: visible; transform: none; }
.dnai.is-inline .dnai-panel { width: 100%; max-width: 480px; height: 640px; }

.dnai-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; background: var(--dnai-c); color: #fff; }
.dnai-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.dnai-head-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dnai-name { font-size: 16px; font-weight: 700; line-height: 1.3; }
.dnai-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dnai-status::before { content: ''; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.dnai-hbtn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
.dnai-hbtn:hover { background: rgba(255, 255, 255, .16); }
.dnai-hbtn .dnai-i { width: 18px; height: 18px; }

.dnai-msgs { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--dnai-subtle); scroll-behavior: smooth; overscroll-behavior: contain; }
.dnai-msg { max-width: 86%; margin: 0 0 10px; padding: 10px 14px; border-radius: 16px; word-wrap: break-word; animation: dnai-pop .25s ease-out; }
.dnai-msg p { margin: 0; }
.dnai-msg p + p, .dnai-msg p + ul, .dnai-msg ul + p { margin-top: 8px; }
.dnai-msg ul { margin: 6px 0 0; padding-left: 18px; }
.dnai-msg a { color: var(--dnai-c); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.dnai-bot { border: 1px solid var(--dnai-border); border-bottom-left-radius: 4px; background: #fff; color: var(--dnai-ink); }
.dnai-user { margin-left: auto; border-bottom-right-radius: 4px; background: var(--dnai-c); color: #fff; }
.dnai-wide { max-width: 100%; padding: 0; border: 0; background: transparent; }

.dnai-typing { display: flex; gap: 4px; width: 64px; padding: 14px 16px; }
.dnai-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: dnai-blink 1.2s infinite ease-in-out; }
.dnai-typing span:nth-child(2) { animation-delay: .15s; }
.dnai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dnai-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Thẻ gợi ý ---------- */
.dnai-cards-title { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px !important; color: var(--dnai-muted); font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.dnai-cards-title .dnai-i { width: 15px; height: 15px; color: var(--dnai-c); }
.dnai-cards { display: flex; gap: 10px; overflow-x: auto; margin: 0 -14px; padding: 4px 14px 10px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.dnai-card { position: relative; flex: 0 0 236px; display: flex; flex-direction: column; scroll-snap-align: start; border: 1px solid var(--dnai-border); border-radius: 16px; background: #fff; }
.dnai-card h4 { margin: 0; color: var(--dnai-heading); font-size: 15px; font-weight: 700; line-height: 1.35; }
.dnai-card h4 a { color: inherit; text-decoration: none; font-weight: 700; }
.dnai-card h4 a:hover { color: var(--dnai-c); }
.dnai-muted { color: var(--dnai-muted); font-size: 13px; line-height: 1.5; }
.dnai-tag { align-self: flex-start; margin-bottom: 6px; padding: 2px 9px; border-radius: 999px; background: var(--dnai-soft); color: #004fe8; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.dnai-link { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 10px; color: #004fe8 !important; font-size: 13.5px; font-weight: 600; text-decoration: none !important; }
.dnai-link .dnai-i { width: 15px; height: 15px; transition: transform .2s; }
.dnai-link:hover .dnai-i { transform: translateX(3px); }
.dnai-more { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 4px; color: #004fe8 !important; font-size: 13.5px; font-weight: 600; text-decoration: none !important; }
.dnai-more .dnai-i { width: 15px; height: 15px; }

/* Gói giá */
.dnai-price { padding: 18px 16px 16px; }
.dnai-price.is-featured { border: 1.5px solid var(--dnai-c); box-shadow: 0 12px 28px rgba(0, 98, 255, .12); }
.dnai-badge { position: absolute; top: -1px; right: 14px; padding: 3px 10px; border-radius: 0 0 8px 8px; background: var(--dnai-c); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.dnai-price h4 { text-transform: uppercase; letter-spacing: .02em; font-size: 14px; }
.dnai-price-num { margin: 8px 0 2px !important; color: #004fe8; font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.dnai-price-num small { font-size: 15px; }
.dnai-check { margin: 12px 0 14px !important; padding: 0 !important; list-style: none; display: grid; gap: 6px; }
.dnai-check li { display: flex; align-items: flex-start; gap: 7px; color: var(--dnai-text-2); font-size: 13px; font-weight: 500; line-height: 1.45; }
.dnai-check .dnai-i { width: 15px; height: 15px; margin-top: 2px; color: #16a34a; }

/* Dự án */
.dnai-project { overflow: hidden; }
.dnai-thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--dnai-soft); }
.dnai-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s; }
.dnai-project:hover .dnai-thumb img { transform: scale(1.04); }
.dnai-thumb-empty { display: grid; place-items: center; height: 100%; color: var(--dnai-c); }
.dnai-card-body { display: flex; flex-direction: column; flex: 1; padding: 12px 14px 14px; }

/* Dịch vụ */
.dnai-service { padding: 16px; border: 0; }
.dnai-service.tone-blue { background: #f0f6ff; }
.dnai-service.tone-orange { background: #fff7ed; }
.dnai-service.tone-green { background: #ecfdf5; }
.dnai-service.tone-sky { background: #f0f9ff; }
.dnai-service.tone-rose { background: #fff1f2; }
.dnai-service.tone-violet { background: #f5f3ff; }
.dnai-service .dnai-tag { background: rgba(255, 255, 255, .9); }
.dnai-service .dnai-muted { margin-top: 6px; }

/* Danh sách link */
.dnai-links { margin: 0 !important; padding: 0 !important; list-style: none; border: 1px solid var(--dnai-border); border-radius: 14px; background: #fff; overflow: hidden; }
.dnai-links li + li { border-top: 1px solid var(--dnai-border); }
.dnai-links a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; color: var(--dnai-ink) !important; font-size: 14px; font-weight: 500; text-decoration: none !important; }
.dnai-links a:hover { background: var(--dnai-soft); color: var(--dnai-c) !important; }
.dnai-links .dnai-i { width: 15px; height: 15px; color: var(--dnai-c); }

/* Nút */
.dnai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dnai-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
	border: 0; border-radius: 12px; font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none !important; cursor: pointer;
	transition: transform .2s, box-shadow .2s, background .2s;
}
.dnai-btn .dnai-i { width: 16px; height: 16px; }
.dnai-btn:hover { transform: translateY(-1px); }
.dnai-btn.is-orange { background: linear-gradient(85deg, var(--dnai-a) 0%, #ffa300 100%); color: #fff !important; font-size: 15px; }
.dnai-btn.is-orange:hover { box-shadow: 0 8px 20px rgba(255, 102, 0, .28); }
.dnai-btn.is-blue { background: var(--dnai-c); color: #fff !important; }
.dnai-btn.is-green { background: #15803d; color: #fff !important; }
.dnai-btn.is-outline { background: #fff; color: #004fe8 !important; box-shadow: inset 0 0 0 1.5px var(--dnai-c); }
.dnai-btn.is-outline:hover { background: var(--dnai-soft); }
.dnai-price .dnai-btn { width: 100%; margin-top: auto; }

/* Form để lại số */
.dnai-lead { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--dnai-border); border-radius: 16px; background: #fff; }
.dnai-lead-title { display: flex; align-items: center; gap: 8px; color: var(--dnai-heading); font-size: 14.5px; font-weight: 700; }
.dnai-lead-title .dnai-i { width: 18px; height: 18px; color: var(--dnai-a); }
.dnai-lead label { display: grid; gap: 4px; color: var(--dnai-text-2); font-size: 12.5px; font-weight: 600; }
.dnai-lead input:not([type=hidden]) { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid transparent; border-radius: 10px; background: #f1f5f9; color: var(--dnai-ink); font-size: 15px; }
.dnai-lead input:focus { outline: none; border-color: var(--dnai-c); background: #fff; }
.dnai-hp { position: absolute !important; left: -9999px !important; }
.dnai-lead-msg { margin: 0 !important; font-size: 13px; color: var(--dnai-muted); }
.dnai-lead-msg:empty { display: none; }
.dnai-lead-msg.is-error { color: #b91c1c; }
.dnai-lead-ok { margin: 0; padding: 2px 0; color: #047857; font-weight: 600; }

/* Câu hỏi gợi ý */
.dnai-chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 14px; background: var(--dnai-subtle); scrollbar-width: none; }
.dnai-chips::-webkit-scrollbar { display: none; }
.dnai-chips[hidden] { display: none; }
.dnai-chip { flex: 0 0 auto; padding: 7px 13px; border: 1px solid #bfd5ff; border-radius: 999px; background: #fff; color: #004fe8; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background .2s; }
.dnai-chip:hover { background: var(--dnai-soft); border-color: var(--dnai-c); }

/* Ô nhập */
.dnai-form { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--dnai-border); background: #fff; }
.dnai-input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid transparent; border-radius: 12px; background: #f1f5f9; color: var(--dnai-ink); font-size: 15px; }
.dnai-input:focus { outline: none; border-color: var(--dnai-c); background: #fff; }
.dnai-send { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: var(--dnai-c); color: #fff; cursor: pointer; }
.dnai-send .dnai-i { width: 19px; height: 19px; }
.dnai.is-busy .dnai-send { opacity: .55; cursor: wait; }
.dnai-credit { margin: 0; padding: 0 12px 8px; background: #fff; color: #64748b; font-size: 11.5px; text-align: center; }
.dnai-credit a { color: inherit; text-decoration: none; }
.dnai-credit a:hover { color: var(--dnai-c); text-decoration: underline; }

/* ---------- Điện thoại ---------- */
@media (max-width: 680px) {
	/* Chừa chỗ cho thanh gọi/Zalo/Báo giá của theme ở đáy màn hình. */
	.dnai:not(.is-inline) { --dnai-gap: 12px; bottom: calc(70px + env(safe-area-inset-bottom) + var(--dnai-lift)); }
	.dnai-toggle { width: 54px; height: 54px; }
	.dnai:not(.is-inline) .dnai-panel {
		position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; min-height: 0;
		border: 0; border-radius: 0; transform: translateY(24px);
	}
	.dnai.is-open:not(.is-inline) .dnai-toggle { display: none; }
	.dnai-head { padding-top: max(14px, env(safe-area-inset-top)); }
	.dnai-form { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
	.dnai-input { font-size: 16px; }
	.dnai-card { flex-basis: 76%; }
}

@media (prefers-reduced-motion: reduce) {
	.dnai *, .dnai *::before, .dnai *::after { animation: none !important; transition: none !important; }
}
