/* VietTest Chatbot Widget — self-contained, namespaced .vtchat- */
.vtchat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "DM Sans", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1f2430;
}

.vtchat-toggle {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(91, 33, 182, 0.35);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vtchat-toggle:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(91, 33, 182, 0.45); }
.vtchat-toggle:focus-visible { outline: 3px solid #c4b5fd; outline-offset: 2px; }

.vtchat-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: vtchat-in 0.16s ease-out;
}
.vtchat-panel[hidden] { display: none; }
@keyframes vtchat-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.vtchat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
}
.vtchat-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: grid; place-items: center; font-size: 17px;
}
.vtchat-header-copy { flex: 1; min-width: 0; }
.vtchat-header-copy strong { display: block; font-size: 13px; line-height: 1.2; }
.vtchat-header-copy small { display: block; font-size: 10px; opacity: 0.8; }
.vtchat-close {
  border: 0; background: transparent; color: #fff; font-size: 20px;
  cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.vtchat-close:hover { background: rgba(255,255,255,0.15); }

.vtchat-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  background: #f8f7fc; display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.vtchat-msg {
  max-width: 85%; padding: 9px 12px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.vtchat-msg--bot { align-self: flex-start; background: #fff; border: 1px solid #e9e7f3; border-bottom-left-radius: 4px; }
.vtchat-msg--user { align-self: flex-end; background: #6d28d9; color: #fff; border-bottom-right-radius: 4px; }
.vtchat-msg a { color: inherit; text-decoration: underline; }

.vtchat-quick {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #f8f7fc;
}
.vtchat-chip {
  border: 1px solid #d8d2f0; background: #fff; color: #4c1d95;
  border-radius: 999px; padding: 6px 10px; font-size: 11px; cursor: pointer;
}
.vtchat-chip:hover { background: #f3efff; }

.vtchat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #ece9f6; background: #fff; }
.vtchat-input {
  flex: 1; border: 1px solid #d9d5e8; border-radius: 10px;
  padding: 9px 11px; font-size: 12.5px; font-family: inherit; outline: none;
  resize: none; max-height: 90px;
}
.vtchat-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.vtchat-send {
  border: 0; border-radius: 10px; background: #6d28d9; color: #fff;
  padding: 0 14px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.vtchat-send:disabled { opacity: 0.55; cursor: not-allowed; }

.vtchat-typing { display: inline-flex; gap: 4px; align-items: center; }
.vtchat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #a78bfa;
  animation: vtchat-bounce 1s infinite ease-in-out;
}
.vtchat-typing span:nth-child(2) { animation-delay: 0.15s; }
.vtchat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes vtchat-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }

.vtchat-lead { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px 12px; background: #f8f7fc; }
.vtchat-lead input, .vtchat-lead textarea {
  border: 1px solid #d9d5e8; border-radius: 8px; padding: 7px 9px; font-size: 12px; font-family: inherit;
}
.vtchat-lead button {
  border: 0; border-radius: 8px; background: #6d28d9; color: #fff; padding: 8px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}

.vtchat-footnote { font-size: 9.5px; color: #8b93a3; text-align: center; padding: 0 12px 8px; background: #fff; }

@media (max-width: 480px) {
  .vtchat-root { right: 12px; bottom: 12px; }
  .vtchat-panel { width: calc(100vw - 24px); height: 70vh; max-height: 70vh; bottom: 66px; }
}
