/* 威软助手 - 小精灵智能体 样式 */

/* ── 悬浮按钮（动态小狐狸） ───────────────────── */
#elf-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8 0%, #a855f7 55%, #ec4899 100%);
  box-shadow: 0 10px 26px rgba(99, 102, 241, .42), 0 2px 6px rgba(0, 0, 0, .18);
  cursor: pointer;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  animation: elf-bob 2.6s ease-in-out infinite;
  transition: transform .15s ease;
  user-select: none;
}
#elf-fab:hover { transform: scale(1.08); }
#elf-fab:active { transform: scale(.94); }

.elf-svg { display: block; overflow: visible; }
.elf-bear { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* 呼吸光环 */
.elf-fab-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(168, 85, 247, .55);
  animation: elf-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
/* 未读/新手指引徽标 */
.elf-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

/* 狐狸动画 */
.elf-eye { transform-origin: center; animation: elf-blink 4.2s infinite; }
.elf-ear-l { transform-origin: 22px 12px; animation: elf-ear-l 3.4s ease-in-out infinite; }
.elf-ear-r { transform-origin: 42px 12px; animation: elf-ear-r 3.4s ease-in-out infinite; }
.elf-tail { transform-origin: 52px 38px; animation: elf-tail 2.2s ease-in-out infinite; }

@keyframes elf-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes elf-pulse {
  0% { transform: scale(1); opacity: .7; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes elf-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(.1); }
}
@keyframes elf-ear-l {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-9deg); }
}
@keyframes elf-ear-r {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(9deg); }
}
@keyframes elf-tail {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-14deg); }
}

/* ── 呼叫气泡 ─────────────────────────────────── */
.elf-callout {
  position: fixed;
  right: 96px;
  bottom: 36px;
  max-width: 190px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
  cursor: pointer;
  z-index: 2147482999;
  border: 1px solid #ede9fe;
  transition: opacity .25s ease, transform .25s ease;
  animation: elf-callout-in .4s ease;
}
.elf-callout::after {
  content: "";
  position: absolute;
  right: -8px;
  bottom: 12px;
  border: 8px solid transparent;
  border-left-color: #fff;
  border-right: 0;
}
.elf-callout.hide {
  opacity: 0;
  transform: translateY(8px) scale(.9);
  pointer-events: none;
}
@keyframes elf-callout-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 对话框 ───────────────────────────────────── */
.elf-panel {
  position: fixed;
  right: 22px;
  bottom: 98px;
  width: 520px;
  max-width: calc(100vw - 32px);
  height: 720px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(79, 70, 229, .28), 0 2px 8px rgba(0, 0, 0, .12);
  z-index: 2147483001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #ece9ff;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.elf-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 头部 */
.elf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: #fff;
}
.elf-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.elf-header-avatar .elf-svg { width: 30px; height: 30px; }
.elf-header-text { flex: 1 1 auto; min-width: 0; }
.elf-header-name { font-size: 15px; font-weight: 800; }
.elf-header-sub { font-size: 11.5px; opacity: .85; margin-top: 1px; }
.elf-btn-clear, .elf-btn-close {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .16);
  border: none;
  color: #fff;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  padding: 6px 9px;
  transition: background .15s ease;
}
.elf-btn-close { font-size: 14px; padding: 5px 9px; }
.elf-btn-clear:hover, .elf-btn-close:hover { background: rgba(255, 255, 255, .32); }

/* 消息区 */
.elf-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px;
  background: #f7f7fb;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.elf-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 100%;
}
.elf-msg-ai { justify-content: flex-start; }
.elf-msg-user { justify-content: flex-end; flex-direction: row-reverse; }
.elf-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 2px 6px rgba(245, 158, 11, .35);
}
.elf-avatar .elf-svg { width: 28px; height: 28px; }
.elf-bubble {
  background: #fff;
  color: #1f2937;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.62;
  max-width: 82%;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  border: 1px solid #eee;
}
.elf-msg-user .elf-bubble {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
}
.elf-bubble b { font-weight: 700; }
.elf-ts {
  font-size: 10px;
  opacity: .55;
  margin-top: 5px;
  text-align: right;
}
.elf-msg-user .elf-ts { color: rgba(255, 255, 255, .85); opacity: .8; }

/* 打字指示 */
.elf-dots { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.elf-dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #a855f7; display: inline-block;
  animation: elf-dot 1.2s infinite ease-in-out;
}
.elf-dots i:nth-child(2) { animation-delay: .2s; }
.elf-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes elf-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* 预设问题 */
.elf-presets {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #f0eef8;
}
.elf-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid #dcd6fb;
  background: #f5f3ff;
  color: #6d28d9;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.elf-chip:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
  transform: translateY(-1px);
}

/* 输入栏 */
.elf-input-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #f0eef8;
}
.elf-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid #e3e0f0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  font-family: inherit;
  color: #1f2937;
  max-height: 110px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.elf-input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .15);
}
.elf-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform .12s ease, opacity .15s ease;
}
.elf-send:hover { transform: scale(1.05); }
.elf-send:disabled { opacity: .5; cursor: not-allowed; }

/* 响应式 */
@media (max-width: 480px) {
  .elf-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 90px;
    height: calc(100vh - 120px);
  }
  .elf-callout { right: 84px; bottom: 30px; }
}
