/* ============================================
   AI 智能客服宠物
   ============================================ */

.ai-pet-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  pointer-events: none;
  transition: left 0.6s cubic-bezier(0.34, 1.2, 0.64, 1), top 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
  will-change: left, top;
}

.ai-pet {
  position: relative;
  width: 70px;
  height: 70px;
  pointer-events: auto;
  cursor: pointer;
  animation: petFloat 3s ease-in-out infinite;
}

@keyframes petFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 宠物身体 */
.pet-body {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(145deg, #1a2954, #0d1228);
  border: 2px solid var(--accent-cyan);
  box-shadow:
    0 0 25px rgba(0, 255, 0, 0.4),
    inset 0 0 20px rgba(214, 23, 39, 0.1);
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-out);
}

.ai-pet:hover .pet-body {
  box-shadow:
    0 0 40px rgba(0, 224, 255, 0.6),
    inset 0 0 25px rgba(0, 224, 255, 0.2);
  transform: scale(1.08);
}

/* 扫描线 */
.pet-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 224, 255, 0.15), transparent);
  animation: petScan 3s linear infinite;
}

@keyframes petScan {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* 眼睛 */
.pet-eyes {
  position: absolute;
  top: 32%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 2;
}

.pet-eye {
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
  transition: transform 0.15s ease-out;
}

.pet-eye.blink {
  animation: petBlink 0.3s ease;
}

@keyframes petBlink {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.1); }
}

/* 嘴巴 */
.pet-mouth {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 8px;
  border: 2px solid var(--accent-cyan);
  border-top: none;
  border-radius: 0 0 16px 16px;
  z-index: 2;
}

/* 天线 */
.pet-antenna {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: var(--accent-cyan);
  z-index: 1;
}

.pet-antenna::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: petSignal 1.5s ease-in-out infinite;
}

@keyframes petSignal {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.5; transform: translateX(-50%) scale(1.3); }
}

/* 轨道光晕 */
.pet-orbit {
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(0, 224, 255, 0.3);
  border-radius: 50%;
  animation: rotateGlow 10s linear infinite;
  pointer-events: none;
}

/* 提示气泡 */
.pet-hint {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 12px;
  background: rgba(13, 18, 40, 0.95);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
}

.pet-hint::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 20px;
  border: 6px solid transparent;
  border-top-color: rgba(13, 18, 40, 0.95);
}

.ai-pet-container.show-hint .pet-hint {
  opacity: 1;
  transform: translateY(0);
}

/* 状态指示 */
.pet-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--accent-green);
  border: 2px solid var(--bg-base);
  border-radius: 50%;
  z-index: 3;
  animation: petSignal 2s ease-in-out infinite;
}

/* ===== 聊天面板 ===== */
.pet-chat-panel {
  position: fixed;
  bottom: 110px;
  right: 24px;
  width: 360px;
  max-height: 500px;
  background: rgba(10, 14, 35, 0.97);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 224, 255, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: all 0.35s var(--ease-spring);
}

.pet-chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chat-header {
  background: var(--grad-primary);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 2px solid rgba(255,255,255,0.3);
}

.chat-header-info { flex: 1; }
.chat-header-info h4 { color: #060818; font-size: 1rem; font-weight: 700; }
.chat-header-info span { color: rgba(6,8,24,0.7); font-size: 0.78rem; display: flex; align-items: center; gap: 5px; }

.chat-header-info .online-dot {
  width: 7px;
  height: 7px;
  background: #060818;
  border-radius: 50%;
}

.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #060818;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-close:hover { background: rgba(255,255,255,0.3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeInUp 0.3s ease both;
}

.chat-msg.bot {
  align-self: flex-start;
  background: rgba(0, 224, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--grad-primary);
  color: #060818;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(0, 224, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-quick {
  padding: 0 20px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-quick-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  background: rgba(0, 224, 255, 0.06);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: rgba(0, 224, 255, 0.15);
  transform: translateY(-2px);
}

.chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--accent-cyan); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #060818;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-out);
}

.chat-send:hover { transform: scale(1.1); box-shadow: 0 0 15px rgba(0, 224, 255, 0.4); }
.chat-send svg { width: 18px; height: 18px; }

/* 响应式 */
@media (max-width: 600px) {
  .pet-chat-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 100px;
  }
  .ai-pet-container { bottom: 16px; right: 16px; }
  .ai-pet { width: 56px; height: 56px; }
}
