/* WBC MIKTECH AI — widget "Trợ lý AI" (launcher pill + panel hội thoại), nạp SAU style
   child theme (wp_enqueue_scripts priority 101), chỉ dùng biến CSS đã có sẵn ở child
   (--c-*, --r-*, --shadow-*, --font-*).

   Bản v2 (28.09.2026): port 1:1 giao diện "Agent AI" của miktech-frontend (Next.js) —
   launcher là VIÊN THUỐC ngang (quả cầu aurora quay + chữ), panel có màn chào (quả cầu
   168px + nút micro ở tâm) và màn hội thoại (bong bóng + quả cầu avatar 28px), chế độ
   Nhắn tin/Giọng nói, và panel mở rộng thành khung dock bên phải.
   Xem miktech-frontend/components/agent/*.tsx + app/globals.css dòng ~935-1030.

   Vị trí launcher: PHÍA TRÊN `.mik-fab-stack` in bởi child theme (Zalo 52px + Gọi 52px).
   QUAN TRỌNG: stack đó đổi kích thước/vị trí ở breakpoint 1023px (style.scss dòng
   200 + 515), KHÔNG PHẢI 768/849px — mọi mốc responsive ảnh hưởng tới vị trí/căn mép
   phải của launcher và của ghi đè `.mik-fab-stack` bên dưới đều dùng ĐÚNG 1023px, để
   mép phải + khoảng cách luôn khớp nhau ở mọi bề rộng màn hình (kể cả 1000px, nơi
   stack của theme đã ở "chế độ mobile" dù chưa chạm breakpoint 768 quen thuộc của
   Next). Riêng khung dock mở rộng (mục "Panel — mở rộng/dock" bên dưới) không đụng gì
   tới stack nên vẫn dùng breakpoint 768px y hệt bản gốc Next. */

.is-hidden {
  display: none !important;
}

/* Honeypot — ẩn hẳn khỏi người dùng thật, bot auto-fill DOM vẫn thấy field. */
.wbc-ai-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Flatsome đặt sẵn kiểu cho button/input/label (viết hoa, margin phải ~14px giữa các nút
   inline, bóng inset, cao 2.5em) — trả về trung tính trong phạm vi widget, cùng kỹ thuật
   với wbc-miktech-rfq/assets/css/rfq.css.
   `.wbc-ai-launcher` PHẢI có mặt ở chính selector này (không chỉ ở dạng hậu duệ `button`):
   bản thân nó LÀ một <button>, nên chỉ reset "button hậu duệ của .wbc-ai-launcher" là chưa
   đủ — Flatsome vẫn đè margin-right/text-transform lên chính nó, kéo lệch mép phải ra khỏi
   `.mik-fab-stack` gần 14px (đã bắt bằng Playwright, xem báo cáo bàn giao). */
.wbc-ai-launcher,
:where(.wbc-ai-launcher, .wbc-ai-panel) button {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
:is(.wbc-ai-panel) :is(input, textarea) {
  min-height: 0;
  margin: 0;
  box-shadow: none;
  font-size: 14.5px;
  font-family: var(--font-sans);
  color: var(--c-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUẢ CẦU 3D — thuần CSS (không ảnh/canvas). Bốn lớp xếp chồng, tất cả absolute
   trong `.wbc-ai-orb` (chỉ phần tử này có kích thước thật qua style width/height
   do JS gán, xem ai-widget.js `buildOrb()`):
     1. `__halo`  — quầng sáng mờ phía sau, "thở" chậm.
     2. `__ring`  — 1-3 cung tròn mỏng bán kính khác nhau, quay khác chiều/tốc độ
        (chỉ tô màu 1-2 cạnh của khung tròn để trông như một CUNG chứ không phải
        vòng kín). Cố ý ĐÈ RA NGOÀI khối cầu — nơi gọi orb (welcome 168px, launcher
        44px) phải chừa đủ khoảng trống xung quanh (padding của `.wbc-ai-welcome`/
        `.wbc-ai-launcher`) để không bị kẹp bởi phần tử cha có overflow:hidden.
     3. `__ball`  — khối cầu bóng thật: gradient sáng trên-trái tối dưới-phải, có
        `::before` xoáy vân mây (clip trong chính __ball nhờ overflow:hidden riêng,
        KHÔNG đụng tới __ring bên ngoài) và `::after` là viền cong tối ở đáy.
     4. Nội dung tâm (icon tĩnh `__core` hoặc nút micro thật `.wbc-ai-mic`) — do nơi
        gọi orb append thêm, luôn nổi trên cùng.
   Ba biến `--wbc-ai-orb-*` giữ đúng bảng màu thương hiệu MIKTECH (không phải xanh
   lá của bản tham chiếu MozaSoft). `--active` (busy/listening/speaking) làm cung
   quay nhanh hơn + quầng sáng rõ hơn — cùng TÍN HIỆU cho cả ba trạng thái bận. */
:root {
  --wbc-ai-orb-1: var(--c-accent-1); /* #0F6FEA — chặn giữa đậm */
  --wbc-ai-orb-2: #7cb1fe; /* chặn giữa nhạt */
  --wbc-ai-orb-3: #eaf2ff; /* điểm sáng specular */
  --wbc-ai-orb-deep: var(--c-navy); /* #0B3155 — chặn tối đáy cầu */
  --wbc-ai-orb-teal: #3ce0d6;
  --wbc-ai-orb-warm: rgba(255, 210, 170, 0.55);
}

.wbc-ai-orb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* KHÔNG hidden: cung phải được phép tràn ra ngoài khung vuông của orb. */
  overflow: visible;
}

.wbc-ai-orb__halo {
  position: absolute;
  inset: -38%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 177, 254, 0.38), transparent 68%);
  filter: blur(1px);
  animation: wbc-ai-halo-breathe 4s ease-in-out infinite;
}
@keyframes wbc-ai-halo-breathe {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.wbc-ai-orb__ring {
  position: absolute;
  z-index: 1;
  border-radius: 50%;
  border: 2px solid transparent;
}
.wbc-ai-orb__ring--1 {
  inset: 8%;
  border-top-color: var(--wbc-ai-orb-teal);
  border-right-color: var(--wbc-ai-orb-teal);
  opacity: 0.75;
  animation: wbc-ai-orb-spin 8s linear infinite;
}
.wbc-ai-orb__ring--2 {
  inset: -4%;
  border-bottom-color: var(--wbc-ai-orb-2);
  border-left-color: var(--wbc-ai-orb-2);
  opacity: 0.55;
  animation: wbc-ai-orb-spin-rev 12s linear infinite;
}
.wbc-ai-orb__ring--3 {
  inset: -15%;
  border-width: 1.5px;
  border-top-color: var(--wbc-ai-orb-warm);
  border-left-color: var(--wbc-ai-orb-warm);
  opacity: 0.75;
  animation: wbc-ai-orb-spin 18s linear infinite;
}
/* Launcher (44px, biến thể --mini): 1 cung mảnh, khiêm tốn hơn bản 168px. */
.wbc-ai-orb--mini .wbc-ai-orb__ring--1 { inset: -6%; opacity: 0.5; border-width: 1.5px; }

@keyframes wbc-ai-orb-spin { to { transform: rotate(360deg); } }
@keyframes wbc-ai-orb-spin-rev { to { transform: rotate(-360deg); } }

.wbc-ai-orb__ball {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  overflow: hidden;
  /* Lớp 1: điểm sáng specular lớn, trắng-kem (như mẫu Sếp gửi) · lớp 2: vùng mây sáng phụ ·
     lớp 3: thân cầu xanh thương hiệu chuyển navy ở góc dưới-phải. */
  background:
    radial-gradient(circle at 31% 27%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 249, 240, 0.85) 11%, rgba(234, 242, 255, 0.45) 26%, transparent 44%),
    radial-gradient(ellipse 55% 40% at 62% 70%, rgba(124, 177, 254, 0.55), transparent 70%),
    radial-gradient(circle at 36% 32%, #d6e6ff 0%, var(--wbc-ai-orb-2) 30%, #2f7bf0 56%, var(--wbc-ai-orb-1) 72%, var(--wbc-ai-orb-deep) 100%);
  /* Trong: tối mép dưới-phải + sáng mép trên-trái (khối 3D). Ngoài: viền lưỡi liềm xanh xám
     sát mép dưới (như mẫu) + bóng đổ mềm. box-shadow ngoài vẫn hiện dù overflow:hidden. */
  box-shadow:
    inset -10px -14px 22px rgba(11, 49, 85, 0.55),
    inset 6px 8px 14px rgba(255, 255, 255, 0.45),
    0 3px 0 -1px rgba(74, 112, 160, 0.75),
    0 18px 34px -14px rgba(11, 49, 85, 0.55);
}
/* Ball nhỏ lại khi có cung bao quanh, để chừa chỗ cho __ring. */
.wbc-ai-orb--mini .wbc-ai-orb__ball { inset: 9%; }
.wbc-ai-orb--full .wbc-ai-orb__ball { inset: 16%; }
/* Vân mây/marble xoáy nhẹ bên trong — clip bởi overflow:hidden của chính __ball. */
.wbc-ai-orb__ball::before {
  content: "";
  position: absolute;
  inset: -25%;
  /* Vân mây: vài đốm sáng/tối mờ (blur) xoay chậm — tạo chất "đá cẩm thạch" bên trong cầu. */
  background:
    radial-gradient(circle at 28% 62%, rgba(255, 255, 255, 0.42), transparent 22%),
    radial-gradient(circle at 70% 30%, rgba(214, 230, 255, 0.5), transparent 20%),
    radial-gradient(circle at 62% 78%, rgba(11, 49, 85, 0.35), transparent 24%),
    conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.28) 18%, transparent 38%, rgba(11, 49, 85, 0.22) 58%, transparent 80%);
  filter: blur(6px);
  animation: wbc-ai-orb-spin 14s linear infinite;
  mix-blend-mode: soft-light;
}
/* Viền cong tối ở đáy cầu — lưỡi liềm khuất sáng. */
.wbc-ai-orb__ball::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 31% 27%, rgba(255, 255, 255, 0.55) 0%, transparent 18%),
    radial-gradient(ellipse 90% 60% at 50% 92%, rgba(11, 49, 85, 0.5), transparent 62%);
}
/* Cầu nhỏ (26–44px): bớt blur/bóng đổ để không nhoè. */
.wbc-ai-orb:not(.wbc-ai-orb--full) .wbc-ai-orb__ball { box-shadow: inset -3px -4px 7px rgba(11, 49, 85, 0.5), inset 2px 2px 4px rgba(255, 255, 255, 0.45), 0 1px 0 rgba(74, 112, 160, 0.6); }
.wbc-ai-orb:not(.wbc-ai-orb--full) .wbc-ai-orb__ball::before { filter: blur(2px); }

/* Bận/đang nghe/đang nói: cung quay nhanh hơn + quầng sáng rõ hơn — cùng một tín
   hiệu thị giác cho cả ba trạng thái, khách không phải học ba hình khác nhau. */
.wbc-ai-orb--active .wbc-ai-orb__halo { opacity: 1; animation-duration: 2s; }
.wbc-ai-orb--active .wbc-ai-orb__ring--1 { animation-duration: 3s; }
.wbc-ai-orb--active .wbc-ai-orb__ring--2 { animation-duration: 4.2s; }
.wbc-ai-orb--active .wbc-ai-orb__ring--3 { animation-duration: 6s; }
.wbc-ai-orb--active .wbc-ai-orb__ball::before { animation-duration: 2.4s; }

/* Lõi bên trong quả cầu (icon micro tĩnh của launcher) — luôn nổi trên cùng. */
.wbc-ai-orb__core {
  position: relative;
  z-index: 3;
  display: inline-flex;
  color: #fff;
}
.wbc-ai-orb__core svg { width: 18px; height: 18px; }

/* ── Nút micro (tâm quả cầu 168px ở màn chào, hoặc cạnh ô nhập khi hội thoại) ── */
/* Trong quả cầu: nút kính mờ để thân cầu vẫn lộ ra (không che bằng đĩa trắng đặc). */
.wbc-ai-mic {
  position: relative;
  z-index: 3;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--c-navy);
  box-shadow: var(--shadow-card);
  transition: transform 0.16s ease;
}
.wbc-ai-mic svg { width: 18px; height: 18px; }
.wbc-ai-mic:hover:not(:disabled) { transform: scale(1.07); }
.wbc-ai-mic:disabled { opacity: 0.55; cursor: not-allowed; }
.wbc-ai-mic--compact { width: 34px; height: 34px; box-shadow: none; border: 1px solid var(--c-border-1); }
.wbc-ai-orb .wbc-ai-mic:not(.wbc-ai-mic--compact) { width: 48px; height: 48px; border: 1px solid rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.24); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px -6px rgba(11, 49, 85, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6); color: #fff; }
.wbc-ai-orb .wbc-ai-mic:not(.wbc-ai-mic--compact):hover:not(:disabled) { background: rgba(255, 255, 255, 0.36); }
.wbc-ai-orb .wbc-ai-mic.wbc-ai-mic--listening { color: #fff; background: rgba(229, 72, 77, 0.55); }
.wbc-ai-mic--listening { color: var(--c-error); animation: wbc-ai-mic-pulse 1.1s ease-in-out infinite; }
@keyframes wbc-ai-mic-pulse {
  0%, 100% { transform: none; }
  50% { transform: scale(1.09); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAUNCHER — viên thuốc ngang: quả cầu 44px + chữ, neo góc phải dưới, NGAY
   TRÊN `.mik-fab-stack` của theme (xem ghi đè ở cuối tệp).
   ═══════════════════════════════════════════════════════════════════════════ */
.wbc-ai-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  /* #header của Flatsome tự đặt z-index:1001 (đo thật trên site), và khi cuộn
     `.header-wrapper.stuck` chuyển hẳn sang position:fixed cùng z-index đó —
     widget phải cao hơn HẲN (xem thêm ghi chú ở `.wbc-ai-panel`). */
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 8px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--c-border-1);
  box-shadow: var(--shadow-raised);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.wbc-ai-launcher:hover { transform: translateY(-2px); box-shadow: var(--shadow-menu); }
.wbc-ai-launcher__text { text-align: left; line-height: 1.25; }
.wbc-ai-launcher__title { display: block; font-size: 15px; font-weight: 700; color: var(--c-text); white-space: nowrap; }
.wbc-ai-launcher__sub { display: block; font-size: 13px; color: var(--c-text-1); white-space: nowrap; }

/* Dưới 1023px: theme co `.mik-fab-stack` lại (48px, right:12/bottom:16) — launcher
   cũng co theo mốc NÀY (không phải 768/849) để mép phải luôn thẳng hàng, và ẩn chữ
   kiểu sr-only (còn trong DOM cho trình đọc màn hình, không xoá hẳn). */
@media (max-width: 1023px) {
  .wbc-ai-launcher { right: 12px; bottom: 12px; padding: 8px; gap: 0; }
  .wbc-ai-launcher__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Nâng `.mik-fab-stack` (Zalo + Gọi) của theme lên trên launcher — KHÔNG sửa theme,
   chỉ ghi đè `bottom`. Launcher cao cố định 62px (44px quả cầu + 8px đệm hai bên +
   1px viền hai bên) ở mọi bề rộng màn hình, nên công thức là bottom-launcher + 62 +
   12px khoảng cách. Selector `html body .mik-fab-stack` giữ độ đặc trưng (0,1,2) cao
   hơn quy tắc gốc của theme (0,1,0) — thắng bất kể thứ tự nạp CSS. */
html body .mik-fab-stack { bottom: 94px; } /* 20 + 62 + 12 */
@media (max-width: 1023px) {
  html body .mik-fab-stack { bottom: 86px; } /* 12 + 62 + 12 */
}
/* Đóng panel thì chớp lại; MỞ panel thì ẩn hẳn stack (đỡ chồng lên panel/launcher). */
html.wbc-ai-open .mik-fab-stack { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   PANEL — khung nổi mặc định (420×680, neo cùng góc với launcher).
   ═══════════════════════════════════════════════════════════════════════════ */
.wbc-ai-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  /* Flatsome bật sticky header: khi cuộn, `.header-wrapper` tự đổi sang
     position:fixed; z-index:1001 (đo thật bằng Playwright lúc trang đã cuộn).
     Panel/launcher phải cao hơn HẲN mốc đó, không thì thanh trên của panel
     (nút làm mới/mode-pill/mở rộng) bị header đè mất — đây là lỗi đã báo. */
  z-index: 100001;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 24px));
  height: min(680px, calc(100dvh - 40px));
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-1);
  border-radius: 22px;
  box-shadow: var(--shadow-menu);
  overflow: hidden;
  animation: wbc-ai-panel-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (max-width: 1023px) {
  .wbc-ai-panel { right: 12px; bottom: 12px; }
}
@keyframes wbc-ai-panel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Thanh quản trị WP (`body.admin-bar`) cũng position:fixed;top:0 — panel phải
   trừ thêm chiều cao của nó (32px desktop, 46px dưới 782px — đúng mốc lõi WP)
   để không bị thanh này che mất phần trên, dù panel đã cao hơn z-index. */
body.admin-bar .wbc-ai-panel { height: min(680px, calc(100dvh - 40px - 32px)); }
@media (max-width: 782px) {
  body.admin-bar .wbc-ai-panel { height: min(680px, calc(100dvh - 40px - 46px)); }
}

/* ── Panel — mở rộng/dock (breakpoint 768px như bản Next, không liên quan tới
   .mik-fab-stack nên KHÔNG cần khớp 1023px) ─────────────────────────────── */
.wbc-ai-panel.wbc-ai-panel--expanded {
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
}
body.admin-bar .wbc-ai-panel.wbc-ai-panel--expanded { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .wbc-ai-panel.wbc-ai-panel--expanded { top: 46px; }
}
@media (min-width: 768px) {
  .wbc-ai-panel.wbc-ai-panel--expanded {
    inset: 0 0 0 auto;
    width: 30rem;
    height: auto;
    border-left: 1px solid var(--c-border-1);
  }
  body.admin-bar .wbc-ai-panel.wbc-ai-panel--expanded { top: 32px; }
  /* `!important` bắt buộc: body trang này mang class `full-width` của Flatsome,
     và flatsome.css có `.full-width{padding-right:0!important}` (đo thật bằng
     Playwright, xem báo cáo bàn giao) — không !important thì bị đè về 0 ngay
     cả khi độ đặc trưng selector của ta đã cao hơn. */
  html.wbc-ai-docked body { padding-right: 30rem !important; }
}

/* ── Thanh trên: nút chat/refresh · mode-pill · nút mở rộng ──────────────── */
.wbc-ai-panel__topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 0;
}
.wbc-ai-float-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--c-text-2);
  border: 1px solid var(--c-border-1);
}
.wbc-ai-float-btn:hover { background: var(--c-surface-2); }
.wbc-ai-float-btn svg { width: 18px; height: 18px; }

.wbc-ai-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--c-border-1);
  min-width: 0;
}
.wbc-ai-mode-pill__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  white-space: nowrap;
}
.wbc-ai-mode-pill__item svg { width: 15px; height: 15px; }
.wbc-ai-mode-pill__item--on { background: var(--c-navy); color: #fff; }
.wbc-ai-mode-pill__item:disabled { color: var(--c-border-2); cursor: not-allowed; }

/* ── Vùng nội dung: màn chào HOẶC màn hội thoại (chỉ một cái hiện) ───────── */
.wbc-ai-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.wbc-ai-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 24px;
  text-align: center;
}
.wbc-ai-welcome__status {
  margin: 20px 0 0;
  max-width: 320px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text-2);
}
.wbc-ai-suggestions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 340px;
}
.wbc-ai-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: #fff;
  color: var(--c-text-2);
  border: 1px solid var(--c-border-1);
}
.wbc-ai-chip:hover { border-color: var(--c-accent-1); color: var(--c-text); }

.wbc-ai-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Bong bóng hội thoại ──────────────────────────────────────────────────── */
.wbc-ai-msg-row { display: flex; align-items: flex-start; gap: 8px; }
.wbc-ai-msg-row--end { justify-content: flex-end; }
.wbc-ai-msg-col { min-width: 0; max-width: 88%; display: flex; flex-direction: column; gap: 8px; }

.wbc-ai-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  margin: 0;
}
.wbc-ai-bubble--user {
  max-width: 88%;
  background: var(--c-navy);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.wbc-ai-bubble--agent {
  background: #fff;
  color: var(--c-text);
  border: 1px solid var(--c-border-1);
  border-bottom-left-radius: 4px;
}
.wbc-ai-bubble--error { background: var(--c-error-surface); color: var(--c-error); border-color: transparent; }
.wbc-ai-msg-row { animation: wbc-ai-msg-in 0.24s ease-out; }
@keyframes wbc-ai-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── Thẻ xác nhận đã ghi Liên hệ (actions.lead_created) ─────────────────── */
.wbc-ai-action-card {
  padding: 10px 12px;
  border: 1px solid var(--c-teal-strong);
  border-radius: var(--r-lg);
  background: var(--c-teal-surface);
}
.wbc-ai-action-card strong { display: block; font-size: 13px; color: var(--c-navy); }
.wbc-ai-action-card p { margin: 4px 0 8px; font-size: 12.5px; color: var(--c-text-2); }
.wbc-ai-action-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--c-teal-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--c-teal-strong);
  background: #fff;
}
.wbc-ai-action-link:hover { background: var(--c-teal-strong); color: #fff; }

/* ── Nút pill dẫn link (RFQ/Zalo/liên hệ…) — pill đầu tô đậm khi cần chuyển kỹ sư ── */
.wbc-ai-links { display: flex; flex-wrap: wrap; gap: 6px; }
.wbc-ai-link-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: var(--c-text);
  border: 1px solid var(--c-border-1);
}
.wbc-ai-link-pill:hover { background: var(--c-surface-2); }
.wbc-ai-link-pill--primary { background: var(--c-accent-1); color: #fff; border-color: transparent; }

.wbc-ai-retry {
  align-self: flex-start;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-error);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Thẻ sản phẩm (mã, hãng, tình trạng) + nút thêm vào báo giá ──────────── */
.wbc-ai-products { display: grid; gap: 8px; }
.wbc-ai-product {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--c-border-1);
  border-radius: var(--r-lg);
  background: #fff;
}
.wbc-ai-product:hover { border-color: var(--c-accent-1); }
.wbc-ai-product__img { width: 44px; height: 44px; flex: none; border-radius: 6px; overflow: hidden; background: var(--c-surface-2); }
.wbc-ai-product__img img { width: 100%; height: 100%; object-fit: cover; }
.wbc-ai-product__main { flex: 1; min-width: 0; display: grid; }
.wbc-ai-product__mpn { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--c-navy); }
.wbc-ai-product__name { font-size: 12px; color: var(--c-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wbc-ai-product__add {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--c-teal-surface);
  color: var(--c-teal-strong);
}
.wbc-ai-product__add:hover { background: var(--c-teal-strong); color: #fff; }
.wbc-ai-product__add svg { width: 16px; height: 16px; }

/* ── Chấm nhập khi Trợ lý đang tra cứu (quả cầu 26px + 3 chấm nảy) ───────── */
.wbc-ai-typing { display: inline-flex; align-items: center; gap: 8px; }
.wbc-ai-typing__dots { display: inline-flex; gap: 4px; }
.wbc-ai-typing__dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--c-text-1); animation: wbc-ai-dot 1.1s ease-in-out infinite; }
.wbc-ai-typing__dots i:nth-child(2) { animation-delay: 0.15s; }
.wbc-ai-typing__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes wbc-ai-dot {
  0%, 60%, 100% { opacity: 0.25; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ── Chân panel: ô nhập luôn hiện (cả màn chào lẫn hội thoại) ────────────── */
.wbc-ai-form { flex: none; padding: 8px 12px 12px; }
.wbc-ai-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--c-border-1);
}
.wbc-ai-input-wrap:focus-within { border-color: var(--c-accent-1); }
/* Tiền tố .wbc-ai-input-wrap: Flatsome input[type=text] (0,1,1) có viền + bóng, phải thắng cả trạng thái focus. */
.wbc-ai-input-wrap .wbc-ai-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: none;
  font-size: 14px;
  background: transparent;
  color: var(--c-text);
}
.wbc-ai-input-wrap .wbc-ai-input::placeholder { color: var(--c-text-1); }
.wbc-ai-input-wrap .wbc-ai-input:focus { box-shadow: none; background: transparent; }

.wbc-ai-send {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--c-accent-1);
  color: #fff;
}
.wbc-ai-send svg { width: 17px; height: 17px; }
.wbc-ai-send:disabled { background: var(--c-border-2); color: var(--c-text-1); }

.wbc-ai-status-line { margin: 6px 2px 0; font-size: 12px; color: var(--c-text-1); }

.wbc-ai-footrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 2px 0;
}
.wbc-ai-caption { font-size: 12px; color: var(--c-text-1); }
.wbc-ai-footrow__actions { display: flex; flex: none; gap: 12px; }
.wbc-ai-textbtn { font-size: 12px; color: var(--c-text-1); text-underline-offset: 2px; }
.wbc-ai-textbtn:hover { text-decoration: underline; }

/* Người xin giảm chuyển động: TẮT HẲN spin/pulse/entrance, không làm chậm lại. */
@media (prefers-reduced-motion: reduce) {
  .wbc-ai-orb__halo,
  .wbc-ai-orb__ring,
  .wbc-ai-orb__ball::before,
  .wbc-ai-typing__dots i,
  .wbc-ai-panel,
  .wbc-ai-msg-row,
  .wbc-ai-mic--listening {
    animation: none !important;
  }
  .wbc-ai-launcher { transition: none; }
}
