/* ============================================================
   BLOCK-CHAIN ACADEMY — Assistant (scripted FAQ chatbot)
   Self-contained widget. Reuses the global theme tokens
   declared in styles.css (:root).
   ============================================================ */

.bca-bot { position: fixed; right: 24px; bottom: 24px; z-index: 80; font-family: var(--font-body); }

/* ---------- Launcher button ---------- */
.bca-bot-launcher {
  position: relative; width: 62px; height: 62px; border-radius: 50%;
  background: var(--gold-grad); color: #221704; border: none; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-gold);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.bca-bot-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 26px 70px -20px rgba(242,169,28,0.6); }
.bca-bot-launcher svg { width: 27px; height: 27px; transition: transform .35s var(--ease), opacity .2s; }
.bca-bot-launcher .ic-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(.6); }
.bca-bot.open .bca-bot-launcher .ic-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.bca-bot.open .bca-bot-launcher .ic-close { opacity: 1; transform: rotate(0) scale(1); }

/* notification ping */
.bca-bot-ping {
  position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--up); border: 2px solid var(--bg-2); box-shadow: 0 0 0 0 rgba(67,196,134,0.5);
  animation: pulse 2s infinite;
}
.bca-bot.open .bca-bot-ping, .bca-bot.seen .bca-bot-ping { display: none; }

/* ---------- Panel ---------- */
.bca-bot-panel {
  position: absolute; right: 0; bottom: 78px; width: 374px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transform-origin: bottom right;
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.96);
  transition: opacity .28s var(--ease), transform .28s var(--ease), visibility .28s;
}
.bca-bot.open .bca-bot-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* header */
.bca-bot-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  background: linear-gradient(120deg, var(--surface-2), var(--surface));
  border-bottom: 1px solid var(--line-soft);
}
.bca-bot-head .avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(120% 120% at 30% 20%, var(--surface-3), var(--bg-2));
  border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden;
}
.bca-bot-head .avatar img { width: 30px; height: 30px; object-fit: contain; }
.bca-bot-head .htext { flex: 1; min-width: 0; }
.bca-bot-head .htitle { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.1; }
.bca-bot-head .hsub { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; }
.bca-bot-head .hsub .live-dot { width: 7px; height: 7px; margin: 0; }
.bca-bot-close {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--line-soft); color: var(--muted);
  cursor: pointer; display: grid; place-items: center; transition: color .2s, border-color .2s, background .2s;
}
.bca-bot-close:hover { color: var(--text); border-color: var(--line); background: var(--surface-3); }
.bca-bot-close svg { width: 16px; height: 16px; }

/* messages */
.bca-bot-msgs {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.bca-bot-msgs::-webkit-scrollbar { width: 8px; }
.bca-bot-msgs::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }

.bca-msg { max-width: 84%; font-size: 14.5px; line-height: 1.5; padding: 11px 14px; border-radius: 16px; animation: bcaMsgIn .32s var(--ease); }
@keyframes bcaMsgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.bca-msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-soft); border-bottom-left-radius: 5px; color: var(--text); }
.bca-msg.user { align-self: flex-end; background: var(--gold-grad); color: #221704; font-weight: 500; border-bottom-right-radius: 5px; }
.bca-msg a { color: var(--gold-bright); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.bca-msg.user a { color: #221704; }
.bca-msg b { font-weight: 700; }
.bca-msg .price-line { display: block; margin-top: 4px; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--gold-bright); }

/* typing indicator */
.bca-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 16px; border-bottom-left-radius: 5px; }
.bca-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); animation: bcaBlink 1.2s infinite ease-in-out; }
.bca-typing span:nth-child(2) { animation-delay: .2s; }
.bca-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes bcaBlink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* quick-reply chips */
.bca-bot-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; }
.bca-chip {
  font-family: var(--font-display); font-size: 12.5px; font-weight: 500; color: var(--gold-bright);
  background: rgba(242,169,28,0.10); border: 1px solid var(--line); border-radius: 100px;
  padding: 7px 13px; cursor: pointer; transition: background .2s, color .2s, transform .15s; white-space: nowrap;
}
.bca-chip:hover { background: var(--gold-grad); color: #221704; transform: translateY(-1px); }

/* footer / input */
.bca-bot-foot { border-top: 1px solid var(--line-soft); background: var(--bg-2); padding: 12px 12px 14px; }
.bca-bot-handoff {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font-family: var(--font-display); font-weight: 600; font-size: 13.5px; color: #221704;
  background: #43c486; border: none; border-radius: var(--r-sm); padding: 11px; cursor: pointer; margin-bottom: 10px;
  transition: transform .2s var(--ease), box-shadow .2s; text-decoration: none;
}
.bca-bot-handoff:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(67,196,134,0.6); }
.bca-bot-handoff svg { width: 17px; height: 17px; }
.bca-bot-inputrow { display: flex; gap: 8px; align-items: center; }
.bca-bot-input {
  flex: 1; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 12px 14px; color: var(--text); font-family: var(--font-body); font-size: 14.5px; transition: border-color .2s, box-shadow .2s;
}
.bca-bot-input::placeholder { color: var(--muted-2); }
.bca-bot-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,169,28,0.14); }
.bca-bot-send {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: var(--r-sm);
  background: var(--gold-grad); color: #221704; cursor: pointer; display: grid; place-items: center;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.bca-bot-send:hover { transform: translateY(-2px); box-shadow: var(--shadow-gold); }
.bca-bot-send:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.bca-bot-send svg { width: 18px; height: 18px; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .bca-bot { right: 16px; bottom: 16px; }
  .bca-bot-panel {
    position: fixed; right: 0; left: 0; bottom: 0; top: 0;
    width: 100vw; max-width: 100vw; height: 100%; max-height: 100%;
    border-radius: 0; border: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bca-bot-launcher, .bca-bot-panel, .bca-msg, .bca-bot-handoff, .bca-bot-send, .bca-chip { transition: none; animation: none; }
}
