/* ===================== AI 漂浮数字人 ai_pet.css ===================== */
:root { --ap-blue: #2b6cff; --ap-blue-d: #1b56e0; }

/* ---------------- 数字人按钮 ---------------- */
#aiPet {
  position: fixed; right: 26px; bottom: 26px; width: 78px; height: 78px;
  z-index: 45; padding: 0; border: none; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .25s, transform .25s;
}
#aiPet.ap-off { opacity: 0; pointer-events: none; transform: scale(.72); }
#aiPet:hover { transform: translateY(-3px) scale(1.05); }
.ap-wrap { position: relative; width: 78px; height: 78px; }
.ap-ring {
  position: absolute; inset: 8px; border-radius: 50%;
  background: rgba(43, 108, 255, .16); animation: apRing 2.8s ease-out infinite;
}
.ap-ring.r2 { animation-delay: 1.4s; }
@keyframes apRing {
  0% { transform: scale(.72); opacity: .55; }
  70% { opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}
.ap-svg {
  position: relative; display: block; width: 78px; height: 78px;
  filter: drop-shadow(0 7px 16px rgba(43, 108, 255, .3));
  animation: apFloat 3.4s ease-in-out infinite;
}
@keyframes apFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ap-eye { transform-box: fill-box; transform-origin: center; animation: apBlink 4.8s infinite; }
@keyframes apBlink { 0%, 92%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }
.ap-lamp { animation: apLamp 1.9s ease-in-out infinite; }
@keyframes apLamp { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.ap-badge {
  position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #f04438; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(240, 68, 56, .5);
}

/* ---------------- 气泡提示 ---------------- */
.ap-tip {
  position: fixed; right: 116px; bottom: 46px; z-index: 44; max-width: 246px;
  background: #fff; border: 1px solid #dbe6fb; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 26px rgba(24, 52, 105, .15);
  padding: 11px 26px 11px 14px; font-size: 13px; color: #26374f; line-height: 1.6;
  opacity: 0; transform: translateX(10px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.ap-tip.on { opacity: 1; transform: translateX(0); pointer-events: auto; }
.ap-tip b { color: var(--ap-blue); }
.ap-tip .ap-tx {
  position: absolute; top: 2px; right: 7px; font-size: 14px; line-height: 1;
  color: #a9b6ca; cursor: pointer;
}
.ap-tip .ap-tx:hover { color: #6b7a93; }

/* ---------------- 对话面板 ---------------- */
.ai-pet-panel {
  position: fixed; right: 26px; bottom: 26px; z-index: 46;
  width: min(432px, calc(100vw - 32px)); height: min(650px, calc(100vh - 52px));
  background: #fff; border: 1px solid #e2e8f5; border-radius: 18px;
  box-shadow: 0 18px 52px rgba(20, 42, 90, .22);
  display: none; flex-direction: column; overflow: hidden;
}
.ai-pet-panel.on { display: flex; animation: apIn .22s ease-out; }
@keyframes apIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.ap-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 14px;
  border-bottom: 1px solid #eef2f9;
  background: linear-gradient(120deg, #eef3ff 0%, #f7f2ff 58%, #eafaf3 100%);
}
.ap-hav {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(43, 108, 255, .18);
}
.ap-hav svg { width: 30px; height: 30px; display: block; }
.ap-ht { flex: 1; min-width: 0; }
.ap-ht b { display: block; font-size: 14.5px; color: #16233d; }
.ap-ht span { display: block; font-size: 12px; color: #6b7a93; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-hbtn {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; color: #6b7a93; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.ap-hbtn:hover { background: #e6eefc; color: var(--ap-blue); }

.ap-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 13px 13px 12px;
  background: #f8fafd; display: flex; flex-direction: column;
}
/* 浮层内自适应：对话区撑满剩余高度 */
.ai-pet-panel .ai-chat { height: auto; flex: 1 1 auto; min-height: 220px; background: #fff; }
.ai-pet-panel .ai-tabs,
.ai-pet-panel .ai-sug,
.ai-pet-panel .ai-input,
.ai-pet-panel .ai-tip,
.ai-pet-panel .ai-warn,
.ai-pet-panel .ai-ok,
.ai-pet-panel .ai-loading,
.ai-pet-panel .ai-build { flex: 0 0 auto; }
.ai-pet-panel .ai-bubble { max-width: 86%; }
.ai-pet-panel .ai-build { padding: 15px; }
.ai-pet-panel .ai-apps { flex: 0 0 auto; }
.ai-pet-panel .tbl-wrap { overflow-x: auto; }

@media (max-width: 820px) {
  #aiPet { right: 16px; bottom: 16px; width: 68px; height: 68px; }
  .ap-wrap, .ap-svg { width: 68px; height: 68px; }
  .ap-tip { right: 96px; bottom: 34px; max-width: 200px; }
  .ai-pet-panel {
    right: 0; left: 0; bottom: 0; width: auto; height: 86vh;
    border-radius: 18px 18px 0 0;
  }
  .ai-pet-panel .ai-chat { min-height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  #aiPet, .ap-svg, .ap-ring, .ap-eye, .ap-lamp { animation: none !important; }
}
@media print {
  #aiPet, .ap-tip, .ai-pet-panel { display: none !important; }
}
