/* RKT Chatbot v1.0.0 — toàn bộ style nằm trong #rktcb-root để không đụng theme */
#rktcb-root {
  --rk-navy: #0E1B33;
  --rk-navy-2: #16294A;
  --rk-gold: #C9A24A;
  --rk-gold-hi: #EAD08C;
  --rk-surface: #F2F4F8;
  --rk-line: #D9DEE7;
  --rk-ink: #1B2433;
  --rk-muted: #5B6577;
  --rk-font: "Be Vietnam Pro", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rk-bottom: 20px;
  position: fixed;
  bottom: var(--rk-bottom);
  right: 20px;
  z-index: 2147483000;
  font-family: var(--rk-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--rk-ink);
  -webkit-font-smoothing: antialiased;
}
#rktcb-root.rktcb-pos-left { right: auto; left: 20px; }
#rktcb-root *, #rktcb-root *::before, #rktcb-root *::after { box-sizing: border-box; }
#rktcb-root button, #rktcb-root input, #rktcb-root textarea {
  font: inherit; color: inherit; margin: 0; letter-spacing: normal; text-transform: none;
}
#rktcb-root button { cursor: pointer; background: none; border: 0; padding: 0; }
#rktcb-root [hidden] { display: none !important; }
#rktcb-root a { color: var(--rk-navy-2); text-decoration: underline; text-underline-offset: 2px; }
#rktcb-root :focus-visible { outline: 2px solid var(--rk-gold); outline-offset: 2px; }
/* Chống CSS của theme/landing page ghi đè (header, nav, p, form…) */
#rktcb-root .rktcb-head, #rktcb-root .rktcb-msgs, #rktcb-root .rktcb-quick,
#rktcb-root .rktcb-input, #rktcb-root .rktcb-disc, #rktcb-root .rktcb-row, #rktcb-root .rktcb-bubble {
  position: relative; top: auto; right: auto; bottom: auto; left: auto;
  transform: none; float: none; z-index: auto; min-width: 0; max-height: none;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
#rktcb-root p, #rktcb-root span, #rktcb-root strong, #rktcb-root label, #rktcb-root a {
  font-family: inherit; letter-spacing: normal; text-transform: none; text-shadow: none;
}
#rktcb-root p { color: inherit; font-size: inherit; line-height: 1.5; }
#rktcb-root form { margin: 0; padding: 0; background: none; border: 0; }
#rktcb-root .rktcb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Nút mở: đồng xu vàng ---------- */
#rktcb-root .rktcb-launcher {
  position: relative; display: block; width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--rk-gold-hi) 0%, var(--rk-gold) 48%, #9C7A2E 100%);
  box-shadow: 0 6px 18px rgba(14, 27, 51, .35), inset 0 -3px 6px rgba(80, 55, 10, .35), inset 0 2px 3px rgba(255, 255, 255, .45);
  transition: transform .18s ease;
}
#rktcb-root .rktcb-launcher:hover { transform: translateY(-2px); }
#rktcb-root .rktcb-coin {
  position: absolute; inset: 6px; border-radius: 50%; overflow: hidden;
  border: 1.5px solid rgba(90, 64, 14, .45);
  box-shadow: inset 0 0 0 2px rgba(255, 236, 180, .35);
  display: flex; align-items: center; justify-content: center;
}
#rktcb-root .rktcb-coin::after {
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .55) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: rktcb-shine 1.4s ease-out 1.2s 1 both;
  pointer-events: none;
}
@keyframes rktcb-shine { to { transform: translateX(120%); } }
#rktcb-root .rktcb-coin-face { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
#rktcb-root .rktcb-coin .rktcb-ini { color: var(--rk-navy); font-weight: 800; font-size: 18px; letter-spacing: .5px; background: none; }
#rktcb-root .rktcb-dot {
  position: absolute; top: 3px; right: 3px; width: 13px; height: 13px; border-radius: 50%;
  background: #E5484D; border: 2px solid #fff;
}
#rktcb-root.rktcb-seen .rktcb-dot { display: none; }
#rktcb-root.rktcb-open .rktcb-launcher { transform: scale(.92); }

/* ---------- Lời nhắc ---------- */
#rktcb-root .rktcb-teaser {
  position: absolute; bottom: 74px; right: 0; width: 250px;
  background: #fff; border: 1px solid var(--rk-line); border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 28px rgba(14, 27, 51, .18); padding: 12px 30px 12px 14px;
  animation: rktcb-pop .25s ease-out both;
}
#rktcb-root.rktcb-pos-left .rktcb-teaser { right: auto; left: 0; border-radius: 14px 14px 14px 4px; }
#rktcb-root .rktcb-teaser-body { text-align: left; font-size: 14px; color: var(--rk-ink); }
#rktcb-root .rktcb-teaser-x { position: absolute; top: 4px; right: 8px; font-size: 18px; color: var(--rk-muted); width: 22px; height: 22px; }
@keyframes rktcb-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Khung chat ---------- */
#rktcb-root .rktcb-panel {
  position: absolute; bottom: 76px; right: 0;
  width: 384px; height: min(640px, calc(100vh - var(--rk-bottom) - 96px));
  display: flex; flex-direction: column;
  background: var(--rk-surface); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(14, 27, 51, .32), 0 0 0 1px rgba(14, 27, 51, .08);
  animation: rktcb-pop .22s ease-out both;
}
#rktcb-root.rktcb-pos-left .rktcb-panel { right: auto; left: 0; }

#rktcb-root .rktcb-head {
  display: flex; width: auto; height: auto; margin: 0; align-items: center; gap: 10px; padding: 14px 10px 14px 16px;
  background: var(--rk-navy); color: #fff;
  border-bottom: 1px solid var(--rk-gold);
}
#rktcb-root .rktcb-head-av, #rktcb-root .rktcb-av {
  flex: none; width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
}
#rktcb-root .rktcb-head-av { border: 1.5px solid var(--rk-gold); }
#rktcb-root .rktcb-ini { background: var(--rk-gold); color: var(--rk-navy); font-weight: 800; font-size: 14px; }
#rktcb-root .rktcb-head-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#rktcb-root .rktcb-head-txt strong { font-size: 16px; font-weight: 700; line-height: 1.25; }
#rktcb-root .rktcb-head-txt span { font-size: 12.5px; color: rgba(255, 255, 255, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rktcb-root .rktcb-icon {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .8);
}
#rktcb-root .rktcb-icon:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- Tin nhắn ---------- */
#rktcb-root .rktcb-msgs { flex: 1; overflow-y: auto; padding: 16px 14px 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
#rktcb-root .rktcb-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
#rktcb-root .rktcb-row .rktcb-av { width: 28px; height: 28px; font-size: 11px; }
#rktcb-root .rktcb-bubble { max-width: 84%; padding: 10px 13px; border-radius: 14px; overflow-wrap: anywhere; }
#rktcb-root .rktcb-bubble p { margin: 0 0 8px; }
#rktcb-root .rktcb-bubble p:last-child { margin-bottom: 0; }
#rktcb-root .rktcb-bot .rktcb-bubble { background: #fff; border: 1px solid #E3E7EE; border-bottom-left-radius: 4px; }
#rktcb-root .rktcb-user { justify-content: flex-end; }
#rktcb-root .rktcb-user .rktcb-bubble { background: var(--rk-navy); color: #fff; border-bottom-right-radius: 4px; }
#rktcb-root .rktcb-label { font-size: 12.5px; font-weight: 600; color: var(--rk-muted); margin: 10px 0 6px !important; }
#rktcb-root .rktcb-small { font-size: 13px; color: var(--rk-muted); }

#rktcb-root .rktcb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
#rktcb-root .rktcb-chip {
  text-align: left; font-size: 13.5px; line-height: 1.35; padding: 7px 11px;
  background: #fff; color: var(--rk-navy); border: 1px solid var(--rk-line); border-radius: 16px;
  transition: border-color .15s, background .15s;
}
#rktcb-root .rktcb-chip:hover { border-color: var(--rk-gold); background: #FFFBF0; }
#rktcb-root .rktcb-link { color: var(--rk-navy-2); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }

#rktcb-root .rktcb-fb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--rk-line); font-size: 12.5px; color: var(--rk-muted);
}
#rktcb-root .rktcb-fb button[data-act="fb"] {
  padding: 2px 10px; border: 1px solid var(--rk-line); border-radius: 12px; font-size: 12.5px; color: var(--rk-ink);
}
#rktcb-root .rktcb-fb button[data-act="fb"]:hover { border-color: var(--rk-gold); }

/* Đang gõ */
#rktcb-root .rktcb-typing .rktcb-bubble { display: flex; gap: 4px; padding: 13px 14px; }
#rktcb-root .rktcb-typing i { width: 7px; height: 7px; border-radius: 50%; background: #A8B0BE; animation: rktcb-blink 1.1s infinite ease-in-out; }
#rktcb-root .rktcb-typing i:nth-child(2) { animation-delay: .15s; }
#rktcb-root .rktcb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rktcb-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Form để lại thông tin */
#rktcb-root .rktcb-lead { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
#rktcb-root .rktcb-lead label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--rk-muted); }
#rktcb-root .rktcb-lead input, #rktcb-root .rktcb-lead textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--rk-line); border-radius: 8px; background: #fff;
  font-size: 14px; font-weight: 400; color: var(--rk-ink); resize: vertical;
}
#rktcb-root .rktcb-lead input:focus, #rktcb-root .rktcb-lead textarea:focus { border-color: var(--rk-gold); outline: none; box-shadow: 0 0 0 3px rgba(201, 162, 74, .2); }
#rktcb-root .rktcb-lead button[type="submit"] {
  padding: 9px 14px; border-radius: 8px; background: var(--rk-navy); color: #fff; font-weight: 600;
}
#rktcb-root .rktcb-lead button[disabled] { opacity: .6; cursor: default; }
#rktcb-root .rktcb-hp { position: absolute !important; left: -9999px !important; }
#rktcb-root a.rktcb-cta {
  display: inline-block; margin-top: 10px; padding: 9px 16px; border-radius: 20px;
  background: var(--rk-gold); color: var(--rk-navy); font-weight: 700; font-size: 14px; text-decoration: none;
}
#rktcb-root a.rktcb-cta:hover { background: var(--rk-gold-hi); }
#rktcb-root .rktcb-quick a.rktcb-quick-cta { color: #9C7A2E; }
#rktcb-root .rktcb-consent { font-size: 11.5px !important; line-height: 1.4 !important; color: var(--rk-muted) !important; margin: 0 !important; }
#rktcb-root .rktcb-err { color: #C0362C; font-size: 13px; margin: 0 !important; }
#rktcb-root .rktcb-ok { color: #1E7A46; font-weight: 600; }

/* ---------- Liên hệ nhanh + ô nhập ---------- */
#rktcb-root .rktcb-quick {
  display: flex; justify-content: flex-start; align-items: center; width: auto; height: auto; margin: 0; gap: 4px 12px; flex-wrap: wrap; padding: 8px 16px 6px; font-size: 12.5px;
  border-top: 1px solid var(--rk-line); background: #fff;
}
#rktcb-root .rktcb-quick a, #rktcb-root .rktcb-quick button { color: var(--rk-navy-2); font-weight: 600; text-decoration: none; font-size: 12.5px; }
#rktcb-root .rktcb-quick a:hover, #rktcb-root .rktcb-quick button:hover { color: #9C7A2E; }
#rktcb-root .rktcb-input { display: flex; gap: 8px; padding: 6px 10px 10px 14px; background: #fff; }
#rktcb-root .rktcb-input input {
  flex: 1; min-width: 0; border: 1px solid var(--rk-line); border-radius: 22px; padding: 10px 14px; background: var(--rk-surface);
  font-size: 15px;
}
#rktcb-root .rktcb-input input:focus { outline: none; border-color: var(--rk-gold); background: #fff; }
#rktcb-root .rktcb-input button {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: var(--rk-gold); color: var(--rk-navy); display: flex; align-items: center; justify-content: center;
}
#rktcb-root .rktcb-input button:hover { background: var(--rk-gold-hi); }
#rktcb-root .rktcb-disc { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 11px; line-height: 1.4; color: #7A8394; }

/* ---------- Điện thoại: toàn màn hình ---------- */
@media (max-width: 480px) {
  #rktcb-root { right: 14px; }
  #rktcb-root.rktcb-pos-left { left: 14px; }
  #rktcb-root .rktcb-panel {
    position: fixed; inset: 0; width: auto; height: auto; border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #rktcb-root.rktcb-open .rktcb-launcher { display: none; }
  #rktcb-root .rktcb-input input { font-size: 16px; } /* tránh iOS tự zoom */
  html.rktcb-lock, html.rktcb-lock body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  #rktcb-root *, #rktcb-root *::after { animation: none !important; transition: none !important; }
  #rktcb-root .rktcb-msgs { scroll-behavior: auto; }
}

#rktcb-root .rktcb-free-wrap { margin: 10px 0 2px !important; padding-top: 10px !important; border-top: 1px dashed #E3D6B5 !important; }
#rktcb-root a.rktcb-free {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 18px;
  background: #FFF6DD; border: 1.5px solid var(--rk-gold); color: var(--rk-navy); font-weight: 700; font-size: 13.5px;
  line-height: 1.35; text-decoration: none;
}
#rktcb-root a.rktcb-free::before { content: "\1F381"; font-size: 15px; }
#rktcb-root a.rktcb-free:hover { background: var(--rk-gold); }
