/* 数据空间 AI 助手浮窗 —— 蓝色科技风格 */
#aiFab {
  position: fixed;
  right: 26px;
  bottom: 96px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #4d8cff 0%, #1b6bff 45%, #0b3fc4 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 8px 24px rgba(27, 107, 255, .45), 0 0 0 1px rgba(255, 255, 255, .25) inset;
  transition: transform .16s ease, opacity .16s ease;
  user-select: none;
}
#aiFab span { display: none; }
#aiFab::after {
  content: "AI";
  position: absolute;
  right: -3px;
  bottom: -1px;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #0a2a6b;
  color: #8fc0ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
#aiFab::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(77, 140, 255, .55);
  animation: aiPulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes aiPulse {
  0%   { transform: scale(.9);  opacity: .9; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}
#aiFab:hover { transform: translateY(-2px) scale(1.04); }
#aiFab.hidden { opacity: 0; pointer-events: none; transform: scale(.85); }

.ai-panel {
  position: fixed;
  right: 26px;
  bottom: 96px;
  width: 392px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 70px);
  background: #f4f8ff;
  border: 1px solid rgba(27, 107, 255, .22);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(9, 40, 110, .28), 0 0 0 1px rgba(255, 255, 255, .6) inset;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}
.ai-panel.open { display: flex; }

/* 头部：深蓝渐变 + 网格光效 */
.ai-head {
  position: relative;
  padding: 15px 16px 13px;
  background:
    linear-gradient(135deg, rgba(77, 140, 255, .28), rgba(27, 107, 255, 0) 60%),
    linear-gradient(160deg, #0a2a6b 0%, #10418f 55%, #0b3fc4 100%);
  color: #fff;
  overflow: hidden;
}
.ai-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}
.ai-head::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(102, 170, 255, .55), transparent 65%);
  pointer-events: none;
}
.ai-title {
  position: relative;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
}
.ai-title i { color: #8fc0ff; margin-right: 6px; }
.ai-sub { position: relative; font-size: 12px; opacity: .86; margin-top: 3px; }

.ai-close {
  position: absolute;
  right: 8px;
  top: 6px;
  border: 0;
  background: transparent;
  color: #cfe0ff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: .8;
  z-index: 2;
}
.ai-close:hover { opacity: 1; }

.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  background:
    radial-gradient(circle at 100% 0, rgba(27, 107, 255, .06), transparent 45%),
    #f4f8ff;
}
.ai-msg { display: flex; margin-bottom: 10px; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.62;
  word-break: break-word;
}
.ai-msg.bot .ai-bubble {
  background: #fff;
  color: #14325f;
  border: 1px solid rgba(27, 107, 255, .14);
  border-left: 2px solid #4d8cff;
  border-top-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(20, 50, 95, .05);
}
.ai-msg.user .ai-bubble {
  background: linear-gradient(135deg, #2a7bff, #1156d6);
  color: #fff;
  border-top-right-radius: 3px;
  box-shadow: 0 2px 8px rgba(27, 107, 255, .3);
}

.ai-typing span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 3px;
  border-radius: 50%;
  background: #7aa9ff;
  animation: aiDot 1s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 6px;
  background: rgba(255, 255, 255, .75);
  border-top: 1px solid rgba(27, 107, 255, .12);
  max-height: 102px;
  overflow-y: auto;
}
.ai-chip {
  border: 1px solid rgba(27, 107, 255, .28);
  background: #eaf2ff;
  color: #1755c0;
  font-size: 12px;
  line-height: 22px;
  padding: 0 9px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.ai-chip:hover { background: #dbe9ff; border-color: #4d8cff; }

.ai-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid rgba(27, 107, 255, .12);
}
.ai-input input {
  flex: 1;
  height: 36px;
  border: 1px solid #d6e2f7;
  border-radius: 9px;
  padding: 0 11px;
  font-size: 13px;
  color: #14325f;
  outline: none;
  background: #fbfdff;
}
.ai-input input:focus {
  border-color: #2a7bff;
  box-shadow: 0 0 0 3px rgba(42, 123, 255, .14);
  background: #fff;
}
.ai-input button {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #2a7bff, #1156d6);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(27, 107, 255, .3);
}
.ai-input button:hover { filter: brightness(1.06); }
.ai-foot {
  padding: 0 12px 8px;
  font-size: 11px;
  color: #8fa3c0;
  text-align: center;
  background: #fff;
}

@media (max-width: 520px) {
  .ai-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: 78vh; }
  #aiFab { right: 16px; bottom: 22px; }
}
