/* Trợ lý DCI (chatbot AI). Máy tính: nút nằm trên khung chat Zalo ở góc phải. Điện thoại: nằm trên thanh liên hệ. */
.dci-cb { --cb-xanh: var(--dci-blue, #0112BC); --cb-troi: var(--dci-sky, #00B6FC); --cb-navy: var(--dci-navy, #000066); --cb-vang: var(--dci-gold, #FFCC00); --cb-kem: #F7F6F5;
  position: fixed; right: 24px; bottom: 100px; z-index: 9985; font-family: var(--dci-font, 'Montserrat', sans-serif); }

/* Nút mở */
.dci-cb-mo { position: relative; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 22px 0 16px; border: 0; border-radius: 99px; cursor: pointer;
  background: linear-gradient(135deg, var(--cb-xanh), #1a4fd6 60%, var(--cb-troi)); color: #fff; font: 700 15px/1 var(--dci-font, 'Montserrat', sans-serif);
  box-shadow: 0 10px 28px rgba(1, 18, 188, .32); transition: transform .2s, box-shadow .2s; }
.dci-cb-mo:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(1, 18, 188, .38); }
.dci-cb-mo:focus-visible, .dci-cb button:focus-visible, .dci-cb textarea:focus-visible { outline: 3px solid var(--cb-vang); outline-offset: 2px; }
.dci-cb-cham { position: absolute; top: 6px; left: 38px; width: 10px; height: 10px; border-radius: 50%; background: var(--cb-vang); border: 2px solid #fff; }
.dci-cb.dang-mo .dci-cb-mo { padding: 0; width: 56px; justify-content: center; }
.dci-cb.dang-mo .dci-cb-mo-chu, .dci-cb.dang-mo .dci-cb-cham { display: none; }

/* Khung chat */
.dci-cb-khung { position: absolute; right: 0; bottom: 70px; width: 380px; height: min(580px, calc(100vh - 200px)); display: flex; flex-direction: column;
  background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 60, .22), 0 2px 8px rgba(0, 0, 60, .08); animation: dciCbHien .22s ease-out; }
.dci-cb-khung[hidden] { display: none; }
@keyframes dciCbHien { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.dci-cb-dau { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; color: #fff; background: linear-gradient(120deg, var(--cb-xanh), #1a4fd6 55%, var(--cb-troi)); }
.dci-cb-anh { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .14); }
.dci-cb-anh img { width: 36px; height: auto; display: block; }
.dci-cb-dau div { flex: 1; min-width: 0; }
.dci-cb-dau strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.dci-cb-dau small { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.5px; opacity: .92; }
.dci-cb-dau small i { width: 8px; height: 8px; border-radius: 50%; background: #5FD5AB; box-shadow: 0 0 0 3px rgba(95, 213, 171, .3); }
.dci-cb-dong { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.dci-cb-dong:hover { background: rgba(255, 255, 255, .26); }

.dci-cb-tin { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--cb-kem); display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.dci-cb-bong { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.55; word-wrap: break-word; }
.dci-cb-bong.tro-ly { align-self: flex-start; background: #fff; color: var(--cb-navy); border-bottom-left-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 60, .06); }
.dci-cb-bong.khach { align-self: flex-end; background: var(--cb-xanh); color: #fff; border-bottom-right-radius: 6px; }
.dci-cb-bong a { color: var(--cb-xanh); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.dci-cb-bong.khach a { color: #fff; }
.dci-cb-bong strong { font-weight: 700; }
.dci-cb-bong.dang-go { display: flex; gap: 5px; padding: 14px 16px; }
.dci-cb-bong.dang-go span { width: 7px; height: 7px; border-radius: 50%; background: var(--cb-troi); animation: dciCbGo 1.2s infinite ease-in-out; }
.dci-cb-bong.dang-go span:nth-child(2) { animation-delay: .15s; }
.dci-cb-bong.dang-go span:nth-child(3) { animation-delay: .3s; }
@keyframes dciCbGo { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

.dci-cb-goi-y { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 10px; background: var(--cb-kem); }
.dci-cb-goi-y:empty { display: none; }
.dci-cb-goi-y button { padding: 8px 12px; border: 1.5px solid var(--dci-periwinkle, #B0E1FF); border-radius: 99px; background: #fff; color: var(--cb-xanh); font: 600 13px/1.2 var(--dci-font, 'Montserrat', sans-serif); cursor: pointer; transition: background .2s, border-color .2s; }
.dci-cb-goi-y button:hover { background: var(--dci-periwinkle-nhat, #E3F3FF); border-color: var(--cb-troi); }

.dci-cb-nhap { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid #ececf3; background: #fff; }
.dci-cb-nhap textarea { flex: 1; resize: none; min-height: 44px; max-height: 110px; padding: 11px 14px; border: 1.5px solid #e3e6f0; border-radius: 14px; font: 400 14.5px/1.45 var(--dci-font, 'Montserrat', sans-serif); color: var(--cb-navy); background: #fff; box-sizing: border-box; }
.dci-cb-nhap textarea:focus { border-color: var(--cb-troi); outline: none; }
.dci-cb-nhap button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 14px; background: var(--cb-vang); color: var(--cb-navy); cursor: pointer; transition: transform .15s, opacity .2s; }
.dci-cb-nhap button:hover { transform: translateY(-1px); }
.dci-cb-nhap button:disabled { opacity: .5; cursor: default; transform: none; }
.dci-cb-chan { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 12px; line-height: 1.4; color: #6b7090; text-align: center; }
.dci-cb-chan a { color: var(--cb-xanh); font-weight: 600; text-decoration: none; }

/* Điện thoại: nút tròn trên thanh liên hệ, khung chat gần toàn màn hình */
@media (max-width: 780px) {
  .dci-cb { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .dci-cb-mo { width: 54px; height: 54px; padding: 0; justify-content: center; }
  .dci-cb-mo-chu { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* điện thoại: nút tròn gọn, không che nội dung */
  .dci-cb-cham { top: 7px; left: auto; right: 9px; }
  .dci-cb.dang-mo { left: 0; right: 0; top: 0; bottom: 0; z-index: 2147483000; background: rgba(0, 0, 40, .35); } /* nổi trên menu và thanh liên hệ */
  .dci-cb.dang-mo .dci-cb-mo { display: none; }
  .dci-cb.co-thanh .dci-cb-mo { display: none; } /* đã có nút "Hỏi AI" trên thanh liên hệ dưới đáy */
  .dci-cb-khung { position: fixed; left: 8px; right: 8px; top: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; height: auto; border-radius: 18px; }
  .dci-cb-nhap textarea { font-size: 16px; } /* tránh iPhone tự phóng to khi nhập */
}
@media (prefers-reduced-motion: reduce) { .dci-cb-khung, .dci-cb-bong.dang-go span { animation: none; } .dci-cb-mo { transition: none; } }
