/* =====================================================================
   VTskill: the library's agent. Floating avatar bottom-left, mini chat.
   ===================================================================== */

.vt { position: fixed; left: 22px; bottom: 22px; z-index: 80; display: grid; gap: 12px; justify-items: start; }

/* avatar button */
.vt-fab {
  position: relative; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(236, 243, 255, 0.9));
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(13, 27, 46, 0.08), 0 22px 50px -18px var(--accent-glow);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
  animation: vtBob 7s var(--ease-soft) -2s infinite alternate;
}
.vt-fab:hover { transform: translateY(-3px) scale(1.03); box-shadow: inset 0 1px 0 #fff, 0 4px 10px rgba(13, 27, 46, 0.1), 0 30px 60px -18px var(--accent-glow); }
.vt-fab .vt-avatar { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; }
.vt-fab::after {
  /* online dot */
  content: ""; position: absolute; right: 2px; bottom: 4px; width: 13px; height: 13px; border-radius: 50%;
  background: #22c07a; border: 2.5px solid #fff; box-shadow: 0 0 0 0 rgba(34, 192, 122, 0.45);
  animation: vtPulse 3.2s var(--ease-soft) infinite;
}
.vt.is-open .vt-fab { animation: none; }
@keyframes vtBob { from { translate: 0 0; } to { translate: 0 -5px; } }
@keyframes vtPulse { 0% { box-shadow: 0 0 0 0 rgba(34, 192, 122, 0.45); } 70% { box-shadow: 0 0 0 9px rgba(34, 192, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 192, 122, 0); } }

.vt-avatar { display: block; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #eaf2ff, #c9dbff); }
.vt-avatar svg { width: 100%; height: 100%; display: block; }

/* teaser bubble */
.vt-teaser {
  position: absolute; left: 74px; bottom: 6px; width: max-content; max-width: min(300px, calc(100vw - 120px));
  padding: 12px 40px 12px 16px; border-radius: 18px 18px 18px 6px; font-size: 14px; line-height: 1.4; color: var(--text-primary);
  animation: vtIn 420ms var(--ease) both; cursor: pointer;
}
.vt-teaser b { font-weight: 620; }
.vt-teaser small { display: block; color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.vt-teaser-x { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--text-secondary); }
.vt-teaser-x:hover { background: var(--accent-muted); color: var(--text-primary); }
.vt-teaser-x .ic { font-size: 14px; }

/* panel */
.vt-panel {
  position: absolute; left: 0; bottom: 76px; width: 380px; max-width: calc(100vw - 44px); height: 560px; max-height: calc(100vh - 120px);
  display: grid; grid-template-rows: auto 1fr auto; border-radius: 26px; overflow: hidden;
  transform-origin: bottom left; animation: vtIn 360ms var(--ease) both;
}
@keyframes vtIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.vt-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid rgba(13, 27, 46, 0.06); }
.vt-head .vt-avatar { width: 40px; height: 40px; flex: none; border: 1px solid var(--border); }
.vt-head-t { flex: 1; min-width: 0; }
.vt-name { font-weight: 640; font-size: 15px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.vt-name .on { width: 7px; height: 7px; border-radius: 50%; background: #22c07a; }
.vt-role { font-size: 12px; color: var(--text-secondary); }
.vt-close { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--text-secondary); transition: background-color var(--t-fast) var(--ease); }
.vt-close:hover { background: var(--accent-muted); color: var(--text-primary); }

.vt-log { overflow-y: auto; padding: 16px 14px 8px; display: grid; gap: 10px; align-content: start; scroll-behavior: smooth; }
.vt-msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.45; animation: vtIn 300ms var(--ease) both; overflow-wrap: anywhere; }
.vt-msg.bot { justify-self: start; background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(13, 27, 46, 0.06); border-bottom-left-radius: 6px; color: var(--text-primary); }
.vt-msg.user { justify-self: end; background: linear-gradient(180deg, #4b90ff, var(--accent)); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 8px 20px -10px var(--accent-glow); }
.vt-msg p { margin: 0; }
.vt-msg p + p { margin-top: 6px; }
.vt-msg code { font-size: 0.9em; }
.vt-msg.user code { background: rgba(255, 255, 255, 0.2); color: #fff; }

.vt-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.vt-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); animation: vtDots 1.1s var(--ease-soft) infinite; }
.vt-typing i:nth-child(2) { animation-delay: 0.15s; }
.vt-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes vtDots { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* suggestion cards inside a bot message */
.vt-cards { display: grid; gap: 8px; justify-self: start; width: 100%; max-width: 100%; animation: vtIn 300ms var(--ease) both; }
.vt-card {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--border); text-align: left;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.vt-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.vt-card .ic-box { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-muted); color: var(--accent-deep); font-size: 16px; }
.vt-card .n { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; word-break: break-word; }
.vt-card .w { font-size: 12px; color: var(--text-secondary); margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vt-card .go { color: var(--accent); font-size: 16px; }

.vt-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-self: start; animation: vtIn 300ms var(--ease) both; }
.vt-chip { padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 560; color: var(--accent-deep); background: var(--accent-muted); border: 1px solid transparent; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.vt-chip:hover { background: rgba(47, 124, 246, 0.2); border-color: var(--border-strong); }

.vt-form { display: flex; align-items: center; gap: 8px; padding: 10px 10px 12px 12px; border-top: 1px solid rgba(13, 27, 46, 0.06); }
.vt-form input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.8); font-size: 14px; outline: none; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.vt-form input:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-muted); }
.vt-form input::placeholder { color: var(--text-tertiary); }
.vt-send { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, #4b90ff, var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 18px -8px var(--accent-glow); transition: transform var(--t-fast) var(--ease); }
.vt-send:hover { transform: translateY(-1px); }
.vt-send:disabled { opacity: 0.5; transform: none; cursor: default; }
.vt-send .ic { font-size: 18px; }
.vt-note { grid-column: 1 / -1; font-size: 11px; color: var(--text-tertiary); text-align: center; padding: 0 12px 10px; }

@media (max-width: 720px) {
  .vt { left: 14px; bottom: 14px; }
  .vt-panel { width: calc(100vw - 28px); max-width: none; height: min(560px, calc(100vh - 100px)); }
  .vt-teaser { max-width: calc(100vw - 110px); }
}
@media (pointer: coarse) { .vt-chip, .vt-close, .vt-send { min-height: 44px; } .vt-chip { display: inline-flex; align-items: center; } }

@media (prefers-reduced-motion: reduce) {
  .vt-fab, .vt-fab::after, .vt-panel, .vt-msg, .vt-cards, .vt-chips, .vt-teaser, .vt-typing i { animation: none !important; }
  .vt-log { scroll-behavior: auto; }
}
