/* ============================================================
   WuKong AI Chat Widget — widget.css
   Floating bubble (bottom-right) + expandable panel
   ============================================================ */

.wk-launcher {
  position: fixed; right: 24px; bottom: 24px;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--grad-cta); color: var(--white);
  box-shadow: var(--shadow-cta-hover);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; cursor: pointer;
  transition: transform var(--t-med);
}
.wk-launcher:hover { transform: scale(1.08); }
.wk-launcher::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  background: var(--brand-500); opacity: 0.4;
  z-index: -1;
  animation: pin-pulse 2.4s ease-out infinite;
}
.wk-launcher svg { width: 28px; height: 28px; stroke: white; fill: none; stroke-width: 1.8; }
.wk-launcher.is-open .wk-icon-chat { display: none; }
.wk-launcher .wk-icon-close { display: none; }
.wk-launcher.is-open .wk-icon-close { display: block; }

.wk-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--error); color: white;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.wk-panel {
  position: fixed; right: 24px; bottom: 100px;
  width: calc(100vw - 48px); max-width: 380px;
  height: min(560px, calc(100vh - 140px));
  background: var(--white); border-radius: var(--r-xl);
  border: 1px solid var(--ink-200);
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  z-index: 299; overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.6) translateY(20px); opacity: 0;
  pointer-events: none;
  transition: transform var(--t-med), opacity var(--t-med);
}
.wk-panel.is-open { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }

.wk-header {
  background: var(--grad-cta); color: var(--white);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 12px;
}
.wk-header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgb(255 255 255 / 0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
  position: relative;
}
.wk-header-avatar::after {
  content: ""; position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--brand-600);
}
.wk-header-text { flex: 1; min-width: 0; }
.wk-header-name { font-size: 14px; font-weight: 800; }
.wk-header-status { font-size: 11px; opacity: 0.85; }
.wk-header-close {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; transition: background var(--t-fast);
}
.wk-header-close:hover { background: rgb(255 255 255 / 0.15); }
.wk-header-close svg { width: 18px; height: 18px; stroke: white; fill: none; stroke-width: 2; }

.wk-thread {
  flex: 1; overflow-y: auto; padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  background: var(--cream);
  scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent;
}
.wk-thread::-webkit-scrollbar { width: 6px; }
.wk-thread::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 3px; }

.wk-msg {
  max-width: 80%; padding: 10px 14px;
  font-size: 13.5px; line-height: 1.55;
  border-radius: var(--r-lg);
  animation: fade-in-up 0.3s ease;
}
.wk-msg.bot {
  background: var(--white); color: var(--ink-900);
  border: 1px solid var(--ink-200);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.wk-msg.user {
  background: var(--grad-cta); color: var(--white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.wk-msg-time {
  display: block; font-size: 10px; opacity: 0.55;
  margin-top: 4px; font-weight: 600;
}

.wk-typing {
  align-self: flex-start;
  background: var(--white); border: 1px solid var(--ink-200);
  border-radius: var(--r-lg); border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex; gap: 4px;
}
.wk-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-300);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.wk-typing span:nth-child(2) { animation-delay: 0.2s; }
.wk-typing span:nth-child(3) { animation-delay: 0.4s; }

.wk-quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0.5rem 1.25rem 0.75rem; background: var(--cream);
}
.wk-quick button {
  font-size: 11.5px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--white); color: var(--brand-600);
  border: 1px solid var(--brand-border);
  transition: all var(--t-fast);
}
.wk-quick button:hover { background: var(--brand-600); color: var(--white); }

.wk-input {
  display: flex; gap: 8px; padding: 0.75rem 1rem;
  border-top: 1px solid var(--ink-200); background: var(--white);
}
.wk-input input {
  flex: 1; background: var(--cream);
  border: 1.5px solid var(--ink-200); border-radius: var(--r-md);
  padding: 10px 14px; font-size: 13.5px; outline: none;
  transition: border-color var(--t-fast);
}
.wk-input input:focus { border-color: var(--brand-600); background: var(--white); }
.wk-input button {
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: var(--grad-cta); color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform var(--t-fast);
}
.wk-input button:hover { transform: translateY(-1px); }
.wk-input button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.wk-input svg { width: 18px; height: 18px; fill: white; }

.wk-footer {
  padding: 8px 14px; font-size: 10.5px; color: var(--ink-500);
  text-align: center; background: var(--white);
  border-top: 1px solid var(--ink-200);
}
.wk-footer strong { color: var(--brand-600); font-weight: 700; }

@media (max-width: 480px) {
  .wk-launcher { right: 16px; bottom: 16px; }
  .wk-panel { right: 16px; left: 16px; bottom: 84px; width: auto; max-width: none; height: 70vh; }
}
