@charset "utf-8";
/* CSS Document */
.ai-assistant-btn {
  position: fixed;
  bottom: 30px;
  right: 15px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2e54, #ff6b81);
  box-shadow: 0 4px 16px rgba(255, 46, 84, 0.4);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s ease;
  border: none;
  outline: none;
}
.ai-assistant-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(255, 46, 84, 0.5);
}
.ai-assistant-btn .ai-btn-icon {
  font-size: 28px;
  color: #fff;
  line-height: 1;
}
.ai-assistant-btn .ai-btn-tip {
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: #fff;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.ai-assistant-btn:hover .ai-btn-tip {
  opacity: 1;
}
.ai-assistant-btn .ai-btn-tip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #333;
  border-right: none;
}

/* 呼吸动画 */
@keyframes ai-breath {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 46, 84, 0.4); }
  50% { box-shadow: 0 4px 28px rgba(255, 46, 84, 0.7); }
}
.ai-assistant-btn.breathing {
  animation: ai-breath 2s ease-in-out infinite;
}

/* 未读消息小红点 */
.ai-assistant-btn .ai-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ff2e54;
  display: none;
}
.ai-assistant-btn .ai-dot.show {
  display: block;
}

/* ========== 聊天面板 ========== */
.ai-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 470px;
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e8e8e8;
}
.ai-chat-panel.open {
  display: flex;
}

/* ---------- 面板头部 ---------- */
.ai-chat-header {
  background: linear-gradient(135deg, #ff2e54, #ff6b81);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.ai-chat-title {
  font-size: 15px;
  font-weight: 600;
}
.ai-chat-subtitle {
  font-size: 11px;
  opacity: .8;
  margin-top: 1px;
}
.ai-chat-identity {
  font-size: 11px;
  margin-top: 3px;
  opacity: .92;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ai-chat-identity .ai-id-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffd54f;
  flex-shrink: 0;
}
.ai-chat-identity.login .ai-id-dot {
  background: #69f0ae;
}
.ai-chat-identity.login {
  color: #eafff2;
}
.ai-chat-actions {
  display: flex;
  gap: 8px;
}
.ai-chat-actions button {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-chat-actions button:hover {
  background: rgba(255,255,255,.35);
}

/* ---------- 消息区域 ---------- */
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-chat-body::-webkit-scrollbar {
  width: 5px;
}
.ai-chat-body::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

/* 欢迎卡片 */
.ai-welcome-card {
  text-align: center;
  padding: 20px 10px;
}
.ai-welcome-icon {
  font-size: 48px;
  margin-bottom: 10px;
}
.ai-welcome-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.ai-welcome-desc {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
}
.ai-quick-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.ai-quick-word {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  transition: all .2s;
}
.ai-quick-word:hover {
  border-color: #ff2e54;
  color: #ff2e54;
  background: #fff5f5;
}
.ai-quick-refresh {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  transition: color .2s;
}
.ai-quick-refresh:hover {
  color: #ff2e54;
}
.ai-quick-words.rotating .ai-quick-word {
  animation: ai-fade-in .35s ease;
}
@keyframes ai-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 消息气泡 */
.ai-msg {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: ai-msg-in .3s ease;
}
@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ai-msg.assistant {
  align-self: flex-start;
}
.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.ai-msg.user .ai-msg-avatar {
  background: #e8f5e9;
}
.ai-msg.assistant .ai-msg-avatar {
  background: #fce4ec;
}
.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.ai-msg.user .ai-msg-bubble {
  background: #ff2e54;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg.assistant .ai-msg-bubble {
  background: #fff;
  color: #333;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
}

/* 助手消息内的链接样式 */
.ai-msg.assistant .ai-msg-bubble a {
  color: #ff2e54;
  text-decoration: none;
  font-weight: 500;
}
.ai-msg.assistant .ai-msg-bubble a:hover {
  text-decoration: underline;
}

/* 商品卡片（在聊天中） */
.ai-product-header {
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  padding: 2px 0;
}
.ai-product-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.ai-product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  padding: 10px;
  text-decoration: none !important;
  color: #333 !important;
  transition: all .2s;
}
.ai-product-item:hover {
  border-color: #ff2e54;
  box-shadow: 0 2px 8px rgba(255,46,84,.1);
}
.ai-product-pic {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.ai-product-info {
  flex: 1;
  min-width: 0;
}
.ai-product-title {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}
.ai-product-desc {
  font-size: 11px;
  color: #999;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-product-price {
  font-size: 12px;
  color: #ff2e54;
}
.ai-product-price b {
  font-size: 15px;
}
.ai-product-date {
  font-size: 10px;
  color: #bbb;
}
.ai-product-badge {
  font-size: 11px;
  color: #ff2e54;
  white-space: nowrap;
  flex-shrink: 0;
}
.ai-product-footer {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
  line-height: 1.5;
}

/* ---------- 输入区域 ---------- */
.ai-chat-footer {
  border-top: 1px solid #eee;
  padding: 10px 14px;
  background: #fff;
  flex-shrink: 0;
}
.ai-input-row {
  display: flex;
  /*align-items: flex-end;*/
  gap: 8px;
}
.ai-input-area {
  flex: 1;
  position: relative;
}
.ai-input-area textarea {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 80px;
  transition: border-color .2s;
  background: #f8f9fa;
  font-family: inherit;
}
.ai-input-area textarea:focus {
  border-color: #ff2e54;
  background: #fff;
}
.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ff2e54;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-send-btn:hover {
  background: #e0284a;
  transform: scale(1.05);
}
.ai-send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}
.ai-chat-footer-tip {
  text-align: center;
  font-size: 10px;
  color: #bbb;
  margin-top: 6px;
}

/* 打字指示器 */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bbb;
  animation: ai-typing-bounce 1.4s infinite ease-in-out;
}
.ai-typing span:nth-child(1) { animation-delay: 0s; }
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ========== AI选品筛选面板 ========== */
.ai-pick-btn {
  display: inline-block;
  margin-top: 10px;
  margin-left: 12px;
  font-size: 12px;
  color: #ff2e54;
  cursor: pointer;
  user-select: none;
  transition: all .2s;
  font-weight: 500;
}
.ai-pick-btn:hover {
  color: #e0284a;
  transform: scale(1.05);
}
.ai-pick-btn.active {
  color: #e0284a;
  font-weight: 600;
}

.ai-pick-panel {
  display: none;
  margin-top: 14px;
  background: #fff;
  border: 1px solid #ffe0e5;
  border-radius: 14px;
  padding: 14px;
  animation: ai-pick-in .3s ease;
}
.ai-pick-panel.open {
  display: block;
}
.ai-pick-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.ai-pick-search input {
  flex: 1;
  border: 1px solid #eee;
  background: #fafafa;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 12px;
  color: #333;
  outline: none;
  transition: all .2s;
}
.ai-pick-search input:focus {
  border-color: #ff2e54;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255,46,84,.12);
}
.ai-pick-search button {
  flex-shrink: 0;
  border: none;
  background: linear-gradient(135deg, #ff2e54, #ff6b81);
  color: #fff;
  border-radius: 18px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.ai-pick-search button:hover {
  box-shadow: 0 3px 10px rgba(255,46,84,.3);
}
.ai-pick-search button:active {
  transform: scale(.96);
}
@keyframes ai-pick-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-pick-section {
  margin-bottom: 12px;
}
.ai-pick-section:last-child {
  margin-bottom: 6px;
}
/* 筛选区默认隐藏，选了品类后才显示 */
.ai-pick-section.filter-hidden {
  display: none;
}
.ai-pick-section.filter-show {
  display: block;
  animation: ai-filter-in .35s ease;
}
@keyframes ai-filter-in {
  from { opacity: 0; max-height: 0; overflow: hidden; }
  to   { opacity: 1; max-height: 300px; overflow: hidden; }
}
/* 品类区始终可见 */
.ai-pick-section.category-section {
  margin-bottom: 10px;
}
/* 已选面包屑 */
.ai-pick-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  align-items: center;
}
.ai-pick-breadcrumb .ai-pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff5f7;
  border: 1px solid #ff2e54;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  color: #ff2e54;
  font-weight: 500;
}
.ai-pick-breadcrumb .ai-pick-chip .ai-chip-close {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: .7;
  margin-left: 2px;
}
.ai-pick-breadcrumb .ai-pick-chip .ai-chip-close:hover {
  opacity: 1;
}
.ai-pick-divider {
  width: 100%;
  height: 1px;
  background: #f0f0f0;
  margin: 8px 0 12px;
}
.ai-pick-section-title {
  font-size: 11px;
  color: #999;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-pick-section-title .ai-pick-icon {
  font-size: 13px;
}
.ai-pick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.ai-pick-tag {
  background: #f8f9fa;
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 11px;
  color: #666;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
  white-space: nowrap;
}
.ai-pick-tag:hover {
  border-color: #ff6b81;
  color: #ff2e54;
  background: #fff5f5;
}
.ai-pick-tag.selected {
  background: #fff5f7;
  color: #ff2e54;
  border-color: #ff2e54;
  box-shadow: 0 0 0 2px rgba(255,46,84,.18);
  font-weight: 600;
}

.ai-pick-submit-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ai-pick-submit {
  flex: 1;
  padding: 9px 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #ff2e54, #ff6b81);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 1px;
}
.ai-pick-submit:hover {
  box-shadow: 0 4px 12px rgba(255,46,84,.3);
  transform: translateY(-1px);
}
.ai-pick-submit:disabled {
  background: #ddd;
  color: #aaa;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.ai-pick-reset {
  padding: 9px 16px;
  border-radius: 20px;
  background: #fff;
  color: #999;
  border: 1px solid #eee;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.ai-pick-reset:hover {
  border-color: #ccc;
  color: #666;
}

.ai-pick-preview {
  font-size: 11px;
  color: #aaa;
  margin-top: 8px;
  text-align: center;
  min-height: 16px;
  line-height: 1.5;
}
.ai-pick-preview strong {
  color: #ff2e54;
}

/* 加载中状态 */
.ai-pick-panel.loading .ai-pick-tags {
  position: relative;
  min-height: 30px;
}
.ai-pick-panel.loading .ai-pick-tags::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #eee;
  border-top-color: #ff2e54;
  border-radius: 50%;
  animation: ai-pick-spin .6s linear infinite;
}
@keyframes ai-pick-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.ai-pick-panel.loading .ai-pick-tag {
  opacity: .5;
  pointer-events: none;
}

/* 空状态 */
.ai-pick-empty {
  font-size: 11px;
  color: #ccc;
  font-style: italic;
}

/* 响应式 */
@media (max-width: 480px) {
  .ai-chat-panel {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 150px;      /* 移动端聊天面板上移，避免遮住右下角的 AI 机器人按钮 */
    height: 480px;
    max-height: calc(100vh - 180px);
    border-radius: 12px;
  }
  .ai-assistant-btn {
    bottom: 76px;      /* 移动端：上移到手机底部导航之上，避免与侧边工具按钮重叠 */
    right: 15px;
    width: 50px;
    height: 50px;
  }
  .ai-assistant-btn .ai-btn-icon {
    font-size: 24px;
  }
}
/* ========== AI 导购意图澄清引导 ========== */
.ai-guide {
  background: #fff7f8;
  border: 1px solid #ffd9e0;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 6px 0 10px;
}
.ai-guide-tip {
  font-size: 13px;
  color: #c0392b;
  margin-bottom: 8px;
  line-height: 1.5;
}
.ai-guide-tip b {
  color: #ff2e54;
}
.ai-guide-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-guide-btn {
  flex: 1 1 auto;
  min-width: 120px;
  border: 1px solid #ff8fa3;
  background: #fff;
  color: #ff2e54;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s ease;
}
.ai-guide-btn:hover {
  background: linear-gradient(135deg, #ff2e54, #ff6b81);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(255, 46, 84, 0.35);
}
/* dark 模式适配 */
[data-theme="dark"] .ai-guide {
  background: #2a1f22;
  border-color: #5a2a33;
}
[data-theme="dark"] .ai-guide-tip {
  color: #ff9bb0;
}
[data-theme="dark"] .ai-guide-btn {
  background: #2a1f22;
  border-color: #7a3a45;
  color: #ff9bb0;
}
[data-theme="dark"] .ai-guide-btn:hover {
  background: linear-gradient(135deg, #ff2e54, #ff6b81);
  color: #fff;
}