/* ==========================================================================
   页面内 AI 小功能（产品解读 / 搜索分析 / 询价单解析）—— 2026-10-21
   与右下角聊天助手共用一个接口域，但视觉上是"页面里的一块"，不是浮层。
   ========================================================================== */

.aib {
  position: relative;
  margin: 16px 0;
  padding: 16px 18px 14px;
  border: 1px solid rgba(24, 154, 237, 0.16);
  border-radius: 14px;
  background: linear-gradient(135deg, #f4fbff 0%, #f3fbf8 100%);
  overflow: hidden;
}
.aib::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(520px 120px at 0% 0%, rgba(24, 154, 237, 0.1), transparent 65%);
  pointer-events: none;
}
.aib > * { position: relative; }

.aib__head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: #0f5f8c;
}
.aib__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(120deg, #189aed, #12b0bf);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.6px;
  font-weight: 600;
}
.aib__head svg { color: #12b0bf; }

.aib__btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0f6ea0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 43, 61, 0.08), 0 4px 14px rgba(24, 154, 237, 0.12);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.aib__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 43, 61, 0.1), 0 8px 20px rgba(24, 154, 237, 0.18);
  background: #fbfeff;
}
.aib__btn:active { transform: translateY(0) scale(0.98); }
.aib__btn[disabled] { cursor: default; opacity: 0.7; transform: none; }

.aib__body {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.9;
  color: #14313f;
  animation: aib-fade-up 0.28s ease both;
}
.aib__body[hidden] { display: none; }
.aib__text { white-space: pre-wrap; }
.aib__caret::after {
  content: "▍";
  margin-left: 1px;
  color: #189aed;
  animation: aib-blink 1s steps(1) infinite;
}

.aib__error {
  margin-top: 10px;
  font-size: 13px;
  color: #c22f2f;
}

.aib__foot {
  margin: 10px 0 0;
  font-size: 11px;
  color: #93a9b8;
}

/* 骨架屏：生成中的占位，比一个转圈更"知道在等什么" */
.aib__skeleton { display: grid; gap: 9px; padding-top: 4px; }
.aib__skeleton i {
  display: block;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e6f3fb 25%, #f9fdff 37%, #e6f3fb 63%);
  background-size: 400% 100%;
  animation: aib-shimmer 1.2s ease-in-out infinite;
}
.aib__skeleton i:nth-child(2) { width: 92%; animation-delay: 0.1s; }
.aib__skeleton i:nth-child(3) { width: 78%; animation-delay: 0.2s; }

/* 询价页的"一句话填单" */
.aib--inquiry { margin-bottom: 18px; }
.aib__row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: flex-start;
}
.aib__row textarea {
  flex: 1 1 auto;
  min-height: 60px;
  max-height: 140px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #d8e8f3;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: #14313f;
  background: #fff;
}
.aib__row textarea:focus {
  outline: none;
  border-color: #189aed;
  box-shadow: 0 0 0 3px rgba(24, 154, 237, 0.12);
}
.aib__row .aib__btn { margin-left: 0; height: 40px; padding: 0 18px; }

/* 搜索页的折叠条：默认只占一行，点开才展开文字 */
.aib--search { margin: 0 0 14px; padding: 12px 16px; }
.aib--search .aib__head { font-size: 13.5px; }

/* 生成成功后文字逐字出现，减少"啪一下全出来"的突兀 */
.aib__text--typing { animation: none; }

@keyframes aib-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
@keyframes aib-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes aib-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .aib__body, .aib__btn, .aib__skeleton i { animation: none !important; transition: none !important; }
  .aib__caret::after { animation: none; content: ""; }
}

@media (max-width: 640px) {
  .aib { padding: 14px; }
  .aib__head { flex-wrap: wrap; }
  .aib__btn { margin-left: 0; }
  .aib__row { flex-direction: column; }
  .aib__row .aib__btn { width: 100%; justify-content: center; }
}

/* AI 填表后闪一下，告诉用户"这几项是刚填的" */
@keyframes ai-filled-pulse {
  0% { box-shadow: 0 0 0 0 rgba(24, 154, 237, 0.35); background: #eef9ff; }
  100% { box-shadow: 0 0 0 6px rgba(24, 154, 237, 0); background: #fff; }
}
.ai-filled { animation: ai-filled-pulse 1.2s ease-out; }

/* [hidden] 属性要压过 display:grid（否则骨架屏会一直留在页面上） */
.aib__skeleton[hidden] { display: none; }
/* 按钮文字不折行：窄容器里"AI 帮我填"曾被折成两行 */
.aib__row .aib__btn { white-space: nowrap; flex: 0 0 auto; }
