/* UKO AI 智能体浮窗 · 右下角 */
.ai-fab {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 998;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E87722 0%, #C45F12 100%);
  border: none;
  box-shadow: 0 10px 30px rgba(232,119,34,.4), 0 2px 8px rgba(0,0,0,.2);
  cursor: pointer;
  display: grid; place-items: center;
  color: #fff;
  transition: transform .2s, box-shadow .2s;
  animation: ai-fab-pulse 2.4s ease-in-out infinite;
}
.ai-fab:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 14px 36px rgba(232,119,34,.55); }
.ai-fab svg { width: 28px; height: 28px; }
.ai-fab[hidden] { display: none; }
@keyframes ai-fab-pulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(232,119,34,.4), 0 2px 8px rgba(0,0,0,.2); }
  50%      { box-shadow: 0 10px 30px rgba(232,119,34,.4), 0 0 0 14px rgba(232,119,34,0); }
}

.ai-fab-badge {
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px;
  background: #2EE07A;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* 聊天面板 */
.ai-panel {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 999;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 48px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15,30,46,.25), 0 2px 8px rgba(0,0,0,.1);
  display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--c-line, #DDE2E7);
  transform-origin: bottom right;
  animation: ai-panel-in .25s ease-out;
}
.ai-panel[hidden] { display: none; }
@keyframes ai-panel-in {
  from { transform: scale(.85) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.ai-head {
  padding: 16px 20px;
  background: linear-gradient(135deg, #0F1E2E 0%, #1B2C3F 100%);
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.ai-head::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #E87722, #C8881B, #2E8B57);
}
.ai-head-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E87722, #C45F12);
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--f-mono, monospace);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.ai-head-title { flex: 1; min-width: 0; }
.ai-head-title b {
  display: block; font-size: 14px; font-weight: 700;
}
.ai-head-title span {
  display: block; font-size: 11px; color: #8FA0B2;
  margin-top: 1px;
}
.ai-head-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--f-mono, monospace);
  font-size: 10px; color: #6FD89C;
  margin-top: 2px;
}
.ai-head-status::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: #2EE07A;
  box-shadow: 0 0 0 2px rgba(46,224,122,.25);
  animation: ai-dot 1.6s ease-in-out infinite;
}
@keyframes ai-dot { 0%,100%{opacity:1;} 50%{opacity:.5;} }
.ai-close {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .15s;
}
.ai-close:hover { background: rgba(255,255,255,.18); }

/* 消息区 */
.ai-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  background: #FAFBFC;
  scroll-behavior: smooth;
}
.ai-msg {
  display: flex; gap: 10px;
  margin-bottom: 14px;
  max-width: 100%;
}
.ai-msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-mono, monospace); font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.ai-msg-bubble {
  background: #fff;
  border: 1px solid var(--c-line, #DDE2E7);
  padding: 10px 14px;
  border-radius: 4px 14px 14px 14px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--c-text, #1B2C3F);
  max-width: calc(100% - 40px);
  word-wrap: break-word;
}
.ai-msg-bubble p { margin: 0 0 6px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble ul, .ai-msg-bubble ol { margin: 4px 0 8px; padding-left: 18px; }
.ai-msg-bubble li { margin-bottom: 2px; }
.ai-msg-bubble code {
  background: #F4F6F8; padding: 1px 5px;
  border-radius: 2px; font-size: 12px;
}
.ai-msg-bubble a { color: var(--c-accent, #E87722); }
.ai-msg-bubble strong { color: var(--c-ink, #0F1E2E); }

.ai-msg.user { flex-direction: row-reverse; }
.ai-msg.user .ai-msg-avatar {
  background: var(--c-ink, #0F1E2E); color: #fff;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--c-ink, #0F1E2E);
  color: #fff;
  border-color: var(--c-ink, #0F1E2E);
  border-radius: 14px 4px 14px 14px;
}
.ai-msg.user .ai-msg-bubble strong { color: #fff; }
.ai-msg.user .ai-msg-bubble code { background: rgba(255,255,255,.12); color: #fff; }

.ai-msg.bot .ai-msg-avatar {
  background: linear-gradient(135deg, #E87722, #C45F12);
  color: #fff;
}

/* 输入"思考中"动画 */
.ai-typing {
  display: inline-flex; gap: 4px; padding: 4px 0;
}
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-text-dim, #8693A1);
  animation: ai-bounce 1.4s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* 推荐问题 chip */
.ai-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 10px 0 4px;
  padding-left: 40px;
}
.ai-suggestions button {
  background: #fff;
  border: 1px solid var(--c-line, #DDE2E7);
  color: var(--c-text, #1B2C3F);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.ai-suggestions button:hover {
  border-color: var(--c-accent, #E87722);
  color: var(--c-accent, #E87722);
}

/* 输入区 */
.ai-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--c-line, #DDE2E7);
  background: #fff;
}
.ai-input-row {
  display: flex; gap: 8px; align-items: flex-end;
}
.ai-input {
  flex: 1;
  border: 1px solid var(--c-line, #DDE2E7);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ai-input:focus {
  border-color: var(--c-accent, #E87722);
  box-shadow: 0 0 0 3px rgba(232,119,34,.12);
}
.ai-send {
  background: var(--c-accent, #E87722);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.ai-send:hover { background: var(--c-accent-2, #C45F12); }
.ai-send:disabled { background: var(--c-gray, #9AA4AE); cursor: not-allowed; }
.ai-send svg { width: 18px; height: 18px; }

.ai-disclaim {
  font-size: 10px;
  color: var(--c-text-dim, #8693A1);
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

/* 移动端 · 全屏覆盖 */
@media (max-width: 600px) {
  .ai-panel {
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%; height: 100%;
    border-radius: 0;
    max-height: 100vh;
  }
  .ai-fab { right: 16px; bottom: 16px; }
}
