/* ================= 龙神网盘 · AI 助手「小龙」 ================= */

.ai-fab {
  position: fixed;
  right: 22px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  padding: 0;
  border: none;
  border-radius: 20px;
  background: linear-gradient(145deg, #4ade80 0%, #22c3e6 46%, #6366f1 100%);
  box-shadow: 0 10px 26px rgba(34, 195, 230, 0.38), 0 3px 8px rgba(23, 27, 46, 0.16);
  cursor: pointer;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: ai-fab-in 0.42s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.ai-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 32px rgba(34, 195, 230, 0.46), 0 4px 10px rgba(23, 27, 46, 0.2);
}
.ai-fab:active { transform: scale(0.96); }
.ai-fab svg { width: 40px; height: 40px; display: block; }
.ai-fab::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 24px;
  border: 2px solid rgba(34, 195, 230, 0.5);
  animation: ai-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
.ai-fab.is-open::after { display: none; }

@keyframes ai-fab-in {
  from { opacity: 0; transform: translateY(18px) scale(0.7); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ai-pulse {
  0%   { opacity: 0.75; transform: scale(0.92); }
  70%  { opacity: 0; transform: scale(1.28); }
  100% { opacity: 0; transform: scale(1.28); }
}

/* ---------- 上线提示气泡 ---------- */
.ai-tip {
  position: fixed;
  right: 22px;
  bottom: 94px;
  width: 262px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(23, 27, 46, 0.16), 0 2px 6px rgba(23, 27, 46, 0.06);
  padding: 15px 16px 14px;
  z-index: 8999;
  border: 1px solid rgba(34, 195, 230, 0.22);
  animation: ai-tip-in 0.4s cubic-bezier(0.22, 1.1, 0.36, 1) both;
}
.ai-tip::after {
  content: "";
  position: absolute;
  right: 32px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 1px solid rgba(34, 195, 230, 0.22);
  border-bottom: 1px solid rgba(34, 195, 230, 0.22);
  transform: rotate(45deg);
}
.ai-tip h5 {
  margin: 0 0 5px;
  font-size: 13.5px;
  color: var(--text, #171b2e);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-tip h5 .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22b573; box-shadow: 0 0 0 3px rgba(34, 181, 115, 0.16);
}
.ai-tip p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--text-2, #545c75);
}
.ai-tip p b { color: #0891b2; font-weight: 600; }
.ai-tip .ai-tip-x {
  position: absolute;
  top: 8px; right: 9px;
  width: 20px; height: 20px;
  border: none; background: transparent;
  color: #b6bdd0; font-size: 15px; line-height: 1;
  cursor: pointer; border-radius: 6px;
}
.ai-tip .ai-tip-x:hover { background: #f1f3f9; color: #6b7488; }

@keyframes ai-tip-in {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 面板 ---------- */
.ai-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: 384px;
  height: min(600px, calc(100vh - 130px));
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(23, 27, 46, 0.2), 0 4px 14px rgba(23, 27, 46, 0.08);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(228, 232, 242, 0.9);
  animation: ai-panel-in 0.26s cubic-bezier(0.22, 1.1, 0.36, 1) both;
}
.ai-panel[hidden] { display: none; }
@keyframes ai-panel-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: linear-gradient(120deg, #eef7ff 0%, #f2f4ff 55%, #f7f0ff 100%);
  border-bottom: 1px solid var(--border, #e4e8f2);
  flex-shrink: 0;
}
.ai-head .ava {
  width: 38px; height: 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, #4ade80, #22c3e6 50%, #6366f1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(34, 195, 230, 0.34);
}
.ai-head .ava svg { width: 30px; height: 30px; }
.ai-head .who { flex: 1; min-width: 0; }
.ai-head .who b {
  display: block;
  font-size: 14.5px;
  color: var(--text, #171b2e);
  line-height: 1.3;
}
.ai-head .who span {
  display: block;
  font-size: 11.5px;
  color: var(--text-3, #939bb2);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-head .who span.busy { color: #0891b2; }
.ai-head .ops { display: flex; gap: 2px; flex-shrink: 0; }
.ai-head .ops button {
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  border-radius: 9px;
  color: #6b7488;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background 0.15s ease, color 0.15s ease;
}
.ai-head .ops button:hover { background: rgba(255, 255, 255, 0.9); color: var(--text, #171b2e); }
.ai-head .ops button.off { color: #c2c8d8; }

/* ---------- 消息区 ---------- */
.ai-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 10px;
  background: linear-gradient(180deg, #fbfcff 0%, #f7f9fe 100%);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.ai-body::-webkit-scrollbar { width: 5px; }
.ai-body::-webkit-scrollbar-thumb { background: #d8def0; border-radius: 3px; }

.ai-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: flex-start;
  animation: ai-msg-in 0.24s ease both;
}
@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-msg .mini {
  width: 26px; height: 26px;
  border-radius: 9px;
  flex-shrink: 0;
  margin-top: 2px;
  background: linear-gradient(145deg, #4ade80, #22c3e6 50%, #6366f1);
  display: flex; align-items: center; justify-content: center;
}
.ai-msg .mini svg { width: 21px; height: 21px; }

.ai-bubble {
  max-width: calc(100% - 40px);
  padding: 9px 13px;
  border-radius: 4px 14px 14px 14px;
  background: #fff;
  color: var(--text, #171b2e);
  font-size: 13.5px;
  line-height: 1.72;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(23, 27, 46, 0.05), 0 0 0 1px rgba(228, 232, 242, 0.9);
}
.ai-bubble b { font-weight: 600; color: #1b2340; }
.ai-bubble code {
  font-family: var(--mono, monospace);
  font-size: 12px;
  background: #f1f3fa;
  padding: 1px 5px;
  border-radius: 5px;
}

.ai-msg.from-user { flex-direction: row-reverse; }
.ai-msg.from-user .ai-bubble {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.26);
}
.ai-msg.from-user .mini { display: none; }

/* 工具动作卡片 */
.ai-act {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 12px 34px;
  padding: 7px 11px;
  background: #fff;
  border: 1px dashed #cfe0f5;
  border-radius: 10px;
  font-size: 12px;
  color: #4a5670;
  max-width: calc(100% - 34px);
  animation: ai-msg-in 0.24s ease both;
}
.ai-act .ic {
  width: 15px; height: 15px;
  flex-shrink: 0;
  color: #22c3e6;
}
.ai-act.ok { border-style: solid; border-color: #c9ecdb; background: #f7fdfa; color: #167a51; }
.ai-act.ok .ic { color: #22b573; }
.ai-act.bad { border-style: solid; border-color: #f7d3da; background: #fff8f9; color: #c02a45; }
.ai-act.bad .ic { color: #f2506b; }
.ai-act .spin {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid #d8e6f7;
  border-top-color: #22c3e6;
  animation: ai-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* 正在思考 */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3, #939bb2);
  font-size: 12.5px;
  letter-spacing: 0.2px;
}
.ai-typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #22c3e6;
  animation: ai-bounce 1.15s ease-in-out infinite;
}
.ai-typing i:nth-child(2) { animation-delay: 0.16s; background: #6366f1; }
.ai-typing i:nth-child(3) { animation-delay: 0.32s; background: #8b5cf6; }
.ai-typing i:nth-child(4) { animation-delay: 0.48s; background: #c4b5fd; }
@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30%           { transform: translateY(-4px); opacity: 1; }
}
.ai-typing .txt { margin-right: 2px; }

/* 欢迎卡 */
.ai-welcome {
  text-align: center;
  padding: 18px 12px 8px;
  animation: ai-msg-in 0.3s ease both;
}
.ai-welcome .big {
  width: 62px; height: 62px;
  margin: 0 auto 12px;
  border-radius: 21px;
  background: linear-gradient(145deg, #4ade80, #22c3e6 50%, #6366f1);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(34, 195, 230, 0.32);
  animation: ai-float 3.4s ease-in-out infinite;
}
.ai-welcome .big svg { width: 48px; height: 48px; }
@keyframes ai-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.ai-welcome b {
  display: block;
  font-size: 14.5px;
  color: var(--text, #171b2e);
  margin-bottom: 5px;
}
.ai-welcome p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3, #939bb2);
  line-height: 1.7;
}
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 14px;
}
.ai-chip {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid #e2e8f5;
  background: #fff;
  color: #4a5670;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ai-chip:hover {
  border-color: #b9d9f2;
  background: #f4fbff;
  color: #0891b2;
  transform: translateY(-1px);
}

/* ---------- 输入区 ---------- */
.ai-foot {
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid var(--border, #e4e8f2);
  flex-shrink: 0;
}
.ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f6f8fd;
  border: 1.5px solid #e7ebf5;
  border-radius: 14px;
  padding: 6px 6px 6px 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.ai-input-wrap:focus-within {
  border-color: #a9c8f0;
  box-shadow: 0 0 0 3px rgba(34, 195, 230, 0.14);
  background: #fff;
}
.ai-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text, #171b2e);
  max-height: 96px;
  min-height: 24px;
  padding: 4px 0;
}
.ai-input::placeholder { color: #aab2c6; }
.ai-send {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.ai-send:disabled { opacity: 0.4; cursor: default; }
.ai-send:not(:disabled):hover { transform: scale(1.06); }
.ai-send svg { width: 17px; height: 17px; }

.ai-mic {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 11px;
  background: #eef1f9;
  color: #6b7488;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.16s ease;
}
.ai-mic:hover { background: #e6ebf6; color: #4a5670; }
.ai-mic svg { width: 16px; height: 16px; }
.ai-mic.on {
  background: linear-gradient(135deg, #22c3e6, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 12px rgba(34, 195, 230, 0.4);
  animation: ai-mic-pulse 1.8s ease-in-out infinite;
}
@keyframes ai-mic-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(34, 195, 230, 0.4); }
  50%      { box-shadow: 0 4px 18px rgba(34, 195, 230, 0.72); }
}

.ai-note {
  font-size: 11px;
  color: #b0b7c9;
  text-align: center;
  margin: 7px 0 0;
  line-height: 1.5;
}

/* ---------- 移动端 ---------- */
/* 控制台在 ≤860px 时侧边栏变成底部导航（高约 66px），悬浮按钮要避开它 */
@media (max-width: 860px) {
  .ai-fab { bottom: 84px; }
  .ai-tip { bottom: 148px; }
  .ai-panel {
    bottom: 84px;
    height: min(560px, calc(100vh - 200px));
  }
}

/* 面板打开时锁住背景滚动 */
body.ai-open { overflow: hidden; }

@media (max-width: 640px) {
  .ai-fab {
    right: 16px;
    bottom: 84px;
    width: 52px;
    height: 52px;
    border-radius: 18px;
  }
  .ai-fab svg { width: 36px; height: 36px; }
  .ai-tip {
    right: 14px;
    left: 14px;
    width: auto;
    bottom: 148px;
  }
  .ai-tip::after { right: 24px; }
  .ai-panel {
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    border: none;
    animation: ai-panel-m-in 0.24s ease both;
  }
  @keyframes ai-panel-m-in {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .ai-body { padding: 14px 12px 8px; }
  .ai-bubble { font-size: 14px; max-width: calc(100% - 36px); }
  .ai-head { padding: 12px 12px; }
  .ai-foot {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* 深色页面（首页）里也保持白面板，仅调整阴影 */
.ai-panel.on-dark {
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ---------- 首页落地页：AI 上线提示条 ---------- */
.hero-ai {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding: 8px 15px 8px 9px;
  border-radius: 999px;
  background: rgba(34, 195, 230, 0.11);
  border: 1px solid rgba(34, 195, 230, 0.32);
  color: #c6e9fb;
  font-size: 12.5px;
  line-height: 1.55;
  max-width: 100%;
  animation: ai-tip-in 0.5s 0.3s ease both;
}
.hero-ai b { color: #6ee7f9; font-weight: 600; }
.hero-ai .ava {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, #4ade80, #22c3e6 50%, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(34, 195, 230, 0.4);
}
.hero-ai .ava svg { width: 20px; height: 20px; }

@media (max-width: 640px) {
  .hero-ai {
    font-size: 12px;
    padding: 7px 12px 7px 8px;
    align-items: flex-start;
  }
  .hero-ai .ava { margin-top: 1px; }
}

.ai-by {
  margin: 16px 0 0 !important;
  font-size: 10.5px !important;
  color: #b8bed0 !important;
  letter-spacing: 0.2px;
}
