/* ==========================================================================
   通用 AI 样式（供算卦、解梦等多业务复用）
   ========================================================================== */

/* AI 加载动画 */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
}
.ai-loading .spin-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* AI 结果容器 */
.ai-result-container {
  padding: 16px;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* Markdown 渲染样式 */
.ai-result-container h1, .ai-result-container h2, .ai-result-container h3 {
  font-family: var(--mono);
  color: var(--text);
  margin: 16px 0 8px;
  letter-spacing: 0.5px;
}
.ai-result-container h1 { font-size: 18px; }
.ai-result-container h2 { font-size: 16px; }
.ai-result-container h3 { font-size: 14px; }
.ai-result-container p {
  font-family: var(--kai);
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.9;
  margin-bottom: 10px;
}
.ai-result-container ul, .ai-result-container ol {
  padding-left: 20px;
  margin-bottom: 10px;
  font-family: var(--kai);
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.8;
}
.ai-result-container blockquote {
  border-left: 3px solid var(--border);
  padding: 8px 12px;
  margin: 10px 0;
  background: var(--bg-card);
  font-style: italic;
  color: var(--text-soft);
}
.ai-result-container code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  padding: 2px 6px;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
}
.ai-result-container pre {
  background: var(--bg);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 10px 0;
}

/* AI 流式输出区 */
.ai-streaming {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* AI 错误提示 */
.ai-error {
  font-family: var(--kai);
  font-size: 15px;
  color: var(--red);
  line-height: 1.8;
}

/* 模型下拉选项 */
.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 13px;
}
.model-option:last-child { border-bottom: none; }
.model-option:hover { background: var(--bg-card-hover); }
.model-option.active { background: rgba(74,159,212,0.08); }
.model-option-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.model-option-name { font-weight: 600; color: var(--text); }
.model-option-desc { color: var(--text-mute); font-size: 11px; }
.model-option-price { font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.model-option-price.free { color: var(--green); }
.model-option-price.paid { color: var(--primary); }
.model-tag-free {
  display: inline-block; padding: 1px 6px;
  background: rgba(74,159,212,0.1); color: var(--green);
  font-size: 10px; font-weight: 600; border-radius: var(--radius-sm); margin-left: 6px;
}

/* 追问区域 */
.ai-followup {
  margin-top: 12px;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 12px;
}
.ai-followup textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--kai);
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 10px;
}
.ai-followup textarea:focus { border-color: var(--primary); }
.ai-followup textarea:disabled { background: var(--bg); cursor: not-allowed; opacity: 0.6; }

/* 对话轮次 */
.conv-round { border-top: 1px solid var(--border-soft); padding: 12px 0; }
.conv-round:first-child { border-top: none; }
.conv-round-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.conv-round-badge {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--bg-card); background: var(--text); padding: 1px 8px; border-radius: 10px;
}
.conv-model-name { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
.conv-question {
  font-family: var(--kai); font-size: 13px; color: var(--text-soft);
  margin-bottom: 8px; padding: 6px 10px; background: var(--bg);
  border-radius: var(--radius-sm); border: 1px solid var(--border-soft);
}
.conv-answer { font-family: var(--kai); font-size: 15px; line-height: 1.8; color: var(--text); }

/* 历史记录列表 */
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid var(--border-soft);
}
.history-item:hover { background: var(--bg-card-hover); }
.history-item:last-child { border-bottom: none; }
.history-item-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.history-item-gua {
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; flex-shrink: 0;
}
.history-item-question {
  font-family: var(--kai); font-size: 14px; color: var(--text-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-item-time { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
