/* ============================================================
   AMACONG HOME — GIAO DIỆN CON CHAT BOT
   Dùng lại đúng bộ màu trong style.css (biến --brand, --ink…),
   nên đổi màu thương hiệu ở style.css là bot đổi theo.
   ============================================================ */

/* ---------- Nút bóng chat nổi ---------- */
.cb-nut {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-lg);
  transition: transform .16s, background .16s;
  padding: 0;
}
.cb-nut:hover { transform: scale(1.07); background: var(--brand-dark); }
.cb-nut:active { transform: scale(.97); }
.cb-nut svg { width: 27px; height: 27px; display: block; }
.cb-nut .cb-x { display: none; }
.cb-nut.mo .cb-bong { display: none; }
.cb-nut.mo .cb-x    { display: block; }

/* Vòng sáng lan ra, nhắc khách là bấm được — chạy 3 nhịp rồi tự dừng */
.cb-nut::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--brand);
  animation: cb-song 2.4s ease-out 3;
}
.cb-nut.mo::after, .cb-nut.da-mo::after { animation: none; opacity: 0; }
@keyframes cb-song {
  0%   { transform: scale(1);    opacity: .6; }
  100% { transform: scale(1.75); opacity: 0;  }
}

/* Chấm đỏ + lời mời, hiện sau vài giây nếu khách chưa mở */
.cb-moi {
  position: fixed; right: 86px; bottom: 30px; z-index: 90;
  max-width: 232px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 34px 11px 14px; font-size: 14.5px; line-height: 1.45;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .28s, transform .28s;
}
.cb-moi.hien { opacity: 1; transform: none; pointer-events: auto; }
.cb-moi b { color: var(--brand); }
.cb-moi-dong {
  position: absolute; top: 5px; right: 7px; width: 22px; height: 22px;
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 17px; line-height: 1; border-radius: 6px;
}
.cb-moi-dong:hover { background: var(--paper-3); color: var(--ink); }

/* ---------- Khung chat ---------- */
.cb-khung {
  position: fixed; right: 18px; bottom: 88px; z-index: 91;
  width: 384px; max-width: calc(100vw - 36px);
  height: 566px; max-height: calc(100vh - 128px);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
}
.cb-khung.mo { display: flex; animation: cb-len .2s ease-out; }
@keyframes cb-len {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Đầu khung */
.cb-dau {
  background: var(--ink); color: #fff;
  padding: 14px 15px; display: flex; align-items: center; gap: 11px; flex-shrink: 0;
}
.cb-dau-o {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  letter-spacing: -.02em; flex-shrink: 0;
}
.cb-dau-ten { font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.cb-dau-phu { font-size: 12.5px; color: #a8afb8; display: flex; align-items: center; gap: 5px; }
.cb-den { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
.cb-dau-dong {
  margin-left: auto; border: 0; background: rgba(255,255,255,.1); color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 17px; line-height: 1;
  flex-shrink: 0;
}
.cb-dau-dong:hover { background: rgba(255,255,255,.2); }

/* Vùng tin nhắn */
.cb-than {
  flex: 1; overflow-y: auto; padding: 16px 15px 8px;
  background: var(--paper-2); font-size: 15px; line-height: 1.6;
  overscroll-behavior: contain;
}
.cb-tin { margin-bottom: 12px; display: flex; }
.cb-tin.bot { justify-content: flex-start; }
.cb-tin.toi { justify-content: flex-end; }
.cb-bong-tin {
  max-width: 84%; padding: 10px 13px; border-radius: 14px;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.cb-tin.bot .cb-bong-tin {
  background: var(--paper); border: 1px solid var(--line);
  border-bottom-left-radius: 5px; color: var(--ink-2);
}
.cb-tin.toi .cb-bong-tin {
  background: var(--brand); color: #fff; border-bottom-right-radius: 5px;
}
.cb-bong-tin b { color: inherit; font-weight: 700; }
.cb-tin.bot .cb-bong-tin b { color: var(--ink); }
.cb-bong-tin i { color: var(--muted); font-style: normal; font-size: 13.5px; }
.cb-tin.toi .cb-bong-tin i { color: rgba(255,255,255,.8); }

/* Đường dẫn bot đưa ra */
.cb-lienket { margin-top: 9px; display: grid; gap: 6px; }
.cb-lienket a {
  display: block; font-size: 14px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border-radius: 9px; padding: 8px 11px;
  text-decoration: none; line-height: 1.35;
}
.cb-lienket a:hover { background: var(--brand); color: #fff; }

/* Nút gọi bot chèn khi cần */
.cb-nut-nhanh { margin-top: 9px; display: flex; gap: 7px; flex-wrap: wrap; }
.cb-nut-nhanh a {
  font-size: 14px; font-weight: 650; padding: 8px 13px; border-radius: 9px;
  text-decoration: none; color: #fff;
}
.cb-nut-nhanh .cb-goi  { background: var(--brand); }

/* Ba chấm "đang gõ" */
.cb-dang-go { display: flex; gap: 4px; padding: 4px 2px; }
.cb-dang-go span {
  width: 7px; height: 7px; border-radius: 50%; background: #b9bec6;
  animation: cb-nhay 1.2s infinite;
}
.cb-dang-go span:nth-child(2) { animation-delay: .18s; }
.cb-dang-go span:nth-child(3) { animation-delay: .36s; }
@keyframes cb-nhay {
  0%, 60%, 100% { transform: translateY(0);    opacity: .45; }
  30%           { transform: translateY(-4px); opacity: 1;   }
}

/* Hàng chip gợi ý */
.cb-chips {
  display: flex; gap: 7px; flex-wrap: wrap;
  padding: 0 15px 11px; background: var(--paper-2); flex-shrink: 0;
}
.cb-chips:empty { display: none; }
.cb-chip {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 999px; padding: 7px 13px; font-size: 13.8px; font-weight: 550;
  cursor: pointer; font-family: inherit; line-height: 1.35;
  transition: .14s;
}
.cb-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* Ô nhập */
.cb-chan {
  border-top: 1px solid var(--line); background: var(--paper);
  padding: 10px 11px; display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.cb-o {
  flex: 1; border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; font-family: inherit; font-size: 15px; line-height: 1.45;
  resize: none; max-height: 96px; color: var(--ink-2); background: var(--paper);
}
.cb-o:focus { outline: none; border-color: var(--brand); }
.cb-gui {
  width: 41px; height: 41px; border-radius: 11px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; display: grid; place-items: center; flex-shrink: 0;
  transition: background .14s;
}
.cb-gui:hover { background: var(--brand-dark); }
.cb-gui:disabled { background: #cfd3d8; cursor: default; }
.cb-gui svg { width: 19px; height: 19px; }
.cb-ghichu {
  padding: 0 13px 9px; font-size: 11.8px; color: var(--muted);
  background: var(--paper); text-align: center; line-height: 1.4; flex-shrink: 0;
}

/* ---------- Điện thoại ---------- */
@media (max-width: 640px) {
  .cb-nut { width: 52px; height: 52px; right: 14px; bottom: 14px; }
  .cb-nut svg { width: 24px; height: 24px; }
  .cb-moi { display: none; }
  .cb-khung {
    right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
    height: 100%; max-height: 100%; border-radius: 0; border: 0;
  }
  .cb-nut.mo { display: none; }   /* trong khung toàn màn hình thì đóng bằng dấu X trên đầu */
}

/* Khung nút nổi cũ nhường chỗ cho bóng chat */
/* 12/09/2026: bỏ hết nút nổi ở cả 10 trang, nên khung .floats không còn nút nào và
   div rỗng đã dọn khỏi HTML. Giữ lại 2 dòng dưới phòng khi sau này thêm nút nổi mới —
   lúc đó chỉ cần chèn lại <div class="floats">…</div> là nó tự nằm trên bóng chat. */
.floats { bottom: 88px !important; }
@media (max-width: 640px) { .floats { bottom: 78px !important; } }

/* ============================================================
   LỚP KIẾN TRÚC CHO BOT — thêm 12/09/2026
   Đưa con bot về cùng ngôn ngữ với trang: góc vuông, màu trầm,
   bỏ hiệu ứng gây chú ý kiểu quảng cáo.
   Khối này đặt CUỐI FILE nên đè lên phần trên. Muốn trả về như cũ:
   xoá nguyên khối này.
   ============================================================ */

/* Bóng chat: vuông, màu mực thay vì tròn cam */
.cb-nut {
  width: 54px; height: 54px; border-radius: 2px;
  background: var(--ink); box-shadow: 0 2px 4px rgba(21,24,29,.10), 0 18px 40px -22px rgba(21,24,29,.5);
}
.cb-nut:hover { transform: none; background: var(--ink-2); }
.cb-nut:active { transform: none; }
.cb-nut svg { width: 24px; height: 24px; }

/* Bỏ vòng sáng lan ra — kiểu mời gọi của quảng cáo, không hợp hồ sơ nghề */
.cb-nut::after { display: none; }

/* Lời mời: vuông, chữ trầm */
.cb-moi { border-radius: 0; right: 82px; bottom: 26px; font-size: 14px; }
.cb-moi b { color: var(--ink); font-weight: 600; }
.cb-moi-dong { border-radius: 0; }

/* Khung chat: vuông, viền mảnh */
.cb-khung { border-radius: 0; bottom: 84px; }
.cb-khung.mo { animation: none; }

/* Đầu khung: ô tên vuông, chữ nhẹ lại */
.cb-dau { padding: 15px 16px; }
.cb-dau-o { border-radius: 0; background: var(--brand); font-weight: 600; font-size: 14px; }
.cb-dau-ten { font-weight: 500; letter-spacing: -.01em; }
.cb-dau-dong { border-radius: 0; }

/* Bong bóng tin nhắn: bo rất nhẹ, vẫn đọc ra là đoạn chat */
.cb-bong-tin { border-radius: 3px; }
.cb-tin.bot .cb-bong-tin { border-bottom-left-radius: 3px; }
.cb-tin.toi .cb-bong-tin { border-bottom-right-radius: 3px; background: var(--ink); }
.cb-tin.toi .cb-bong-tin i { color: rgba(255,255,255,.72); }

/* Đường dẫn bot đưa ra: nền trắng viền mảnh thay vì mảng cam */
.cb-lienket a {
  border-radius: 0; background: var(--paper); border: 1px solid var(--line);
  color: var(--ink); font-weight: 500;
}
.cb-lienket a:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Nút gọi nhanh trong bot */
.cb-nut-nhanh a { border-radius: 0; font-weight: 550; }
.cb-nut-nhanh .cb-goi { background: var(--ink); }

/* Chip gợi ý: bỏ dạng viên thuốc */
.cb-chip { border-radius: 0; font-weight: 500; }
.cb-chip:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-3); }

/* Ô nhập và nút gửi */
.cb-o { border-radius: 0; }
.cb-o:focus { border-color: var(--ink-3); }
.cb-gui { border-radius: 0; background: var(--ink); width: 42px; height: 42px; }
.cb-gui:hover { background: var(--ink-2); }

@media (max-width: 640px) {
  .cb-nut { width: 50px; height: 50px; right: 14px; bottom: 14px; }
}

/* ============================================================
   NHÂN VẬT 3D LÀM NÚT CHAT — thêm 12/09/2026
   Nút không còn là ô vuông nữa: chính con nhân vật đứng ở góc.
   Khi mở khung chat, nút co lại thành ô vuông nhỏ mang dấu X.
   Muốn trả về như cũ: xoá nguyên khối này + đổi ICON_BONG trong chatbot.js.
   ============================================================ */

.cb-nut {
  width: 92px; height: auto; background: none; border-radius: 0;
  box-shadow: none; padding: 0; right: 14px; bottom: 10px;
  transition: transform .18s ease;
}
.cb-nut:hover { background: none; transform: translateY(-4px); }
.cb-nut:active { transform: translateY(-1px); }
.cb-nut .cb-nv {
  width: 92px; height: auto; display: block;
  filter: drop-shadow(0 12px 14px rgba(21,24,29,.22));
}

/* Mở khung rồi thì thu về ô vuông nhỏ có dấu X */
.cb-nut.mo {
  width: 54px; height: 54px; right: 18px; bottom: 18px;
  background: var(--ink); border-radius: 2px;
  box-shadow: 0 2px 4px rgba(21,24,29,.10), 0 18px 40px -22px rgba(21,24,29,.5);
}
.cb-nut.mo:hover { background: var(--ink-2); transform: none; }

/* Lời mời lùi sang trái để không đè lên nhân vật */
.cb-moi { right: 116px; bottom: 44px; }

/* Avatar tròn trên đầu khung chat */
img.cb-dau-o {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  background: var(--brand-soft); display: block;
}

@media (max-width: 640px) {
  .cb-nut { width: 72px; right: 10px; bottom: 8px; }
  .cb-nut .cb-nv { width: 72px; }
  .cb-nut.mo { width: 52px; height: 52px; right: 14px; bottom: 14px; }
}

/* Nút "câu này chưa đúng" dưới câu trả lời của bot AI */
.cb-che {
  display: block; margin: 8px 0 0; padding: 0; border: 0; background: none;
  color: #9aa0a6; font: inherit; font-size: 11.5px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.cb-che:hover:not(:disabled) { color: #d93025; }
.cb-che:disabled { cursor: default; text-decoration: none; color: #9aa0a6; }
