/* ==========================================================================
 * 京东联盟商城 · AI 导购侧栏（PC 内嵌脚本自建，不影响原页面布局）
 * 配色与商城卡片一致：京东红 + 橙色点缀。
 * ======================================================================== */
.ai-fab {
  position: fixed;
  right: 24px;
  bottom: 32px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #e1251b, #ff6a00);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(225, 37, 27, .35);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(225, 37, 27, .45); }
.ai-fab svg { width: 20px; height: 20px; fill: currentColor; }

.ai-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  z-index: 90;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.ai-panel[hidden] { display: none; }

.ai-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #e1251b, #ff6a00);
  color: #fff;
}
.ai-head-title { font-size: 15px; font-weight: 700; flex: 1; }
.ai-head-sub { font-size: 11px; opacity: .85; }
.ai-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.ai-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: #f5f5f5;
}

/* 消息气泡 */
.ai-msg { display: flex; margin-bottom: 12px; }
.ai-msg.ai-me { justify-content: flex-end; }
.ai-msg.ai-bot { flex-direction: column; align-items: flex-start; }
.ai-msg .ai-bubble {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}
.ai-msg.ai-bot .ai-bubble { background: #fff; color: #22252a; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.ai-msg.ai-me .ai-bubble { background: #e1251b; color: #fff; }

/* AI 给出的商品卡（气泡外的卡片，宽度与对话气泡一致，不超过 82%） */
.ai-goods { margin-top: 10px; width: 82%; }
.ai-goods-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: #22252a;
}
.ai-goods-card:hover { border-color: #ffb3ad; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ai-goods-card img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; background: #f2f3f5; }
.ai-goods-info { flex: 1; min-width: 0; }
.ai-goods-title {
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ai-goods-row { margin-top: 4px; display: flex; align-items: baseline; gap: 6px; }
.ai-goods-price { color: #e1251b; font-size: 15px; font-weight: 700; }
.ai-goods-price i { font-style: normal; font-size: 11px; }
.ai-goods-rebate { color: #ff6a00; font-size: 11px; }
.ai-go {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff1f0;
  color: #e1251b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* 输入区 */
.ai-foot {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #ececec;
  background: #fff;
}
.ai-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  resize: none;
  max-height: 90px;
}
.ai-input:focus { border-color: #e1251b; }
.ai-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: linear-gradient(135deg, #e1251b, #ff6a00);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ai-send[disabled] { opacity: .6; cursor: not-allowed; }

/* 问候语与加载 */
.ai-hello {
  color: #9aa0a6;
  font-size: 12px;
  text-align: center;
  padding: 14px 0;
  line-height: 1.8;
}
.ai-loading { text-align: center; padding: 6px; color: #9aa0a6; font-size: 12px; }
.ai-loading::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  vertical-align: -1px;
  border: 2px solid #ddd;
  border-top-color: #e1251b;
  border-radius: 50%;
  animation: ai-spin .8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }