/* AI功能公共组件样式 - 通用抽象设计 */

/* ==================== 动画定义 ==================== */
@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 渐变背景类 */
.ai-gradient-bg {
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(96, 165, 250, 0.8) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(168, 85, 247, 0.8) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #60a5fa 0%,
      #3b82f6 25%,
      #6366f1 50%,
      #8b5cf6 75%,
      #a855f7 100%
    );
  background-size:
    200% 200%,
    200% 200%,
    200% 200%;
  background-position:
    0% 50%,
    100% 50%,
    0% 50%;
  animation: gradientFlow 8s ease infinite;
}

/* ==================== 主要按钮组件 ==================== */
.ai-primary-btn {
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(96, 165, 250, 0.8) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(168, 85, 247, 0.8) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #60a5fa 0%,
      #3b82f6 25%,
      #6366f1 50%,
      #8b5cf6 75%,
      #a855f7 100%
    );
  background-size:
    200% 200%,
    200% 200%,
    200% 200%;
  background-position:
    0% 50%,
    100% 50%,
    0% 50%;
  animation: gradientFlow 8s ease infinite;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.ai-primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-primary-btn:active {
  transform: translateY(0);
}

.ai-primary-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ai-primary-btn img {
  display: inline-block;
}

/* ==================== 结果展示组件 ==================== */
.ai-result-section {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
  border: 1px solid #e0e4ff;
  border-radius: 12px;
  padding: 10px;
  margin: 10px 0;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.08);
}

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ai-result-title {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  color: #667eea;
}

.ai-result-title::before {
  content: '✨';
  margin-right: 8px;
  font-size: 18px;
}

.ai-action-btn {
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(96, 165, 250, 0.8) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(168, 85, 247, 0.8) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #60a5fa 0%,
      #3b82f6 25%,
      #6366f1 50%,
      #8b5cf6 75%,
      #a855f7 100%
    );
  background-size:
    200% 200%,
    200% 200%,
    200% 200%;
  background-position:
    0% 50%,
    100% 50%,
    0% 50%;
  animation: gradientFlow 8s ease infinite;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  display: inline-flex;
  align-items: center;
}

.ai-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-action-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.ai-action-btn .loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
}

.ai-result-content {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  min-height: 120px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.ai-result-content:empty::before {
  content: 'AI将为您生成专业的回复...';
  color: #999;
}

/* ==================== 页面容器 ==================== */
.ai-page-container {
  padding: 20px 0;
}

/* ==================== 卡片组件 ==================== */
.ai-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
  gap: 25px;
}

.ai-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

/* .ai-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15);
} */

/* ai-card-header 和 ai-card-title 样式已合并到上方 */

.ai-card-meta {
  font-size: 14px;
  opacity: 0.9;
  display: flex;
  gap: 15px;
  align-items: center;
}

.ai-card-body {
  padding: 25px;
}

/* 卡片内按钮 */
.ai-card-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ai-card-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==================== Loading 组件 ==================== */
.ai-loading-container {
  text-align: center;
  padding: 60px 20px;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.ai-loading-container.show {
  opacity: 1;
  transform: scale(1);
}

.ai-lottie-box {
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.ai-progress-value {
  font-family: 'DIN Bold', sans-serif;
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 3px;
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(96, 165, 250, 0.9) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(168, 85, 247, 0.9) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #60a5fa 0%,
      #3b82f6 25%,
      #6366f1 50%,
      #8b5cf6 75%,
      #a855f7 100%
    );
  background-size:
    200% 200%,
    200% 200%,
    200% 200%;
  background-position:
    0% 50%,
    100% 50%,
    0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradientFlow 8s ease infinite;
  display: inline-block;
}

.ai-loading-tip {
  margin-top: 15px;
  color: #666;
  font-size: 16px;
}

/* ==================== 空状态组件 ==================== */
.ai-empty-state {
  text-align: center;
  padding: 0 60px 20px;
  color: #999;
}

.ai-empty-icon {
  width: 350px;
  height: 250px;
  margin: 0 auto 20px;
  opacity: 0.8;
}

.ai-empty-text {
  font-size: 16px;
}

.ai-recharge-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 8px 24px;
  background-color: #07c160;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.ai-recharge-btn:hover {
  background-color: #06ad56;
  color: #fff;
  text-decoration: none;
}

/* ==================== 内容区块组件 ==================== */
.ai-section {
  margin-bottom: 30px;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.ai-section.show {
  opacity: 1;
  transform: translateY(0);
}

.ai-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.ai-section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

.ai-section-title svg {
  margin-left: 12px;
}

.ai-text-block {
  background: #f8f9ff;
  border-left: 4px solid #667eea;
  padding: 15px 20px;
  border-radius: 8px;
  line-height: 1.8;
  color: #555;
  font-size: 14px;
}

/* ==================== 卡片项组件 ==================== */
.ai-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.ai-card-item {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(15px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

.ai-card-item.show {
  opacity: 1;
  transform: translateY(0);
}

.ai-card-item:hover {
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
}

/* 卡片项类型变体 */
.ai-card-item.success {
  border-left: 4px solid #10b981;
}

.ai-card-item.warning {
  border-left: 4px solid #ef4444;
}

.ai-card-item.info {
  border-left: 4px solid #3b82f6;
}

.ai-card-item.highlight {
  border-left: 4px solid #f59e0b;
}

.ai-card-item.special {
  border-left: 4px solid #8b5cf6;
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

/* 卡片项标题 */
.ai-card-item-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.ai-card-item.special .ai-card-item-title {
  border-bottom: 1px solid #c4b5fd;
  color: #6d28d9;
}

.ai-card-item-title .icon {
  font-size: 20px;
}

.ai-card-item-title svg {
  margin-right: 6px;
}

/* 卡片项内容 */
.ai-card-item-content {
  color: #666;
  line-height: 1.8;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ai-card-item-content strong {
  color: #333;
  font-weight: 600;
}

.ai-card-item.special .ai-card-item-content {
  color: #555;
  font-style: italic;
  background: rgba(139, 92, 246, 0.05);
  padding: 12px;
  border-radius: 6px;
  margin-top: 8px;
}

/* 高亮内容块 */
.ai-highlight-block {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border: 2px solid #8b5cf6;
  border-left: 6px solid #8b5cf6;
  border-radius: 12px;
  padding: 20px 25px;
  line-height: 1.8;
  font-size: 15px;
  color: #555;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}

.ai-highlight-block strong {
  color: #6d28d9;
  font-weight: 600;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .ai-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== 弹窗组件 ==================== */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-modal-wrapper {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-modal-header .button-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-modal-btn,
.ai-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    transform 0.2s;
  font-size: 20px;
  line-height: 1;
}

.ai-modal-btn:hover,
.ai-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-modal-close:hover {
  transform: rotate(90deg);
}

.ai-modal-btn.collapse {
  font-size: 20px;
}

.ai-modal-btn.close {
  font-size: 24px;
}

.ai-modal-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  transition:
    opacity 0.3s ease,
    height 0.3s ease;
}

/* 合并 header 样式，card-header 和 modal-header 共用 */
.ai-modal-header,
.ai-card-header {
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(96, 165, 250, 0.8) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(168, 85, 247, 0.8) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #60a5fa 0%,
      #3b82f6 25%,
      #6366f1 50%,
      #8b5cf6 75%,
      #a855f7 100%
    );
  background-size:
    200% 200%,
    200% 200%,
    200% 200%;
  background-position:
    0% 50%,
    100% 50%,
    0% 50%;
  animation: gradientFlow 8s ease infinite;
  padding: 16px 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.ai-modal-title,
.ai-card-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-modal-title::before,
.ai-card-title::before {
  content: '✨';
  font-size: 20px;
}

.ai-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

/* modal 中使用 card 时，隐藏 card-header，减少内边距 */
.ai-modal-body .ai-card {
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.ai-modal-body .ai-card-header {
  display: none;
}

.ai-modal-body .ai-card-body {
  padding: 20px;
}

/* ========== AI助手聊天窗口相关样式，对应ai-assistant-sdk.js ========== */
.ai-assistant-container {
  position: fixed;
  right: 20px;
  width: 500px;
  height: 850px;
  z-index: 9999;
  bottom: 20px;
  transition:
    height 0.3s ease,
    width 0.3s ease;
  /* top: 50%; */
  /* transform: translateY(-50%); */
}

/* 折叠条模式：贴底抬高，取消垂直居中 transform，避免与 top/bottom 冲突 */
.ai-assistant-container.ai-assistant-container--collapsed {
  height: 52px;
  bottom: 70px;
  top: unset;
  transform: none;
}

.ai-assistant-wrapper {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-assistant-header {
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(96, 165, 250, 0.8) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(168, 85, 247, 0.8) 0%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      #60a5fa 0%,
      #3b82f6 25%,
      #6366f1 50%,
      #8b5cf6 75%,
      #a855f7 100%
    );
  background-size:
    200% 200%,
    200% 200%,
    200% 200%;
  background-position:
    0% 50%,
    100% 50%,
    0% 50%;
  animation: gradientFlow 8s ease infinite;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
}

.ai-assistant-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.ai-assistant-header .button-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-grow: 0;
  position: absolute;
  right: 10px;
}

.ai-assistant-history,
.ai-assistant-collapse,
.ai-assistant-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    transform 0.2s;
}

.ai-assistant-history:hover,
.ai-assistant-collapse:hover,
.ai-assistant-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-assistant-collapse {
  font-size: 20px;
  line-height: 1;
}

.ai-assistant-close {
  font-size: 24px;
  line-height: 1;
}

.ai-assistant-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  transition:
    opacity 0.3s ease,
    height 0.3s ease;
}

/* ==================== 反馈按钮样式 ==================== */
.ai-feedback-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.ai-feedback-btn:hover {
  opacity: 1;
}

.ai-feedback-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==================== 反馈弹窗样式 ==================== */
.ai-feedback-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-feedback-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
}

.ai-feedback-modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-feedback-modal-title {
  font-size: 16px;
  font-weight: 600;
}

.ai-feedback-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s;
}

.ai-feedback-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-feedback-modal-body {
  padding: 20px;
}

.ai-feedback-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.ai-feedback-option-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-feedback-option-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.ai-feedback-option-btn.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: #fff;
}

.ai-feedback-other-input-wrapper {
  margin-top: 10px;
  pointer-events: auto;
}

.ai-feedback-other-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.ai-feedback-other-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-feedback-char-count {
  text-align: right;
  font-size: 12px;
  color: #999;
  margin-top: 5px;
}

.ai-feedback-modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ai-feedback-modal-footer .btn {
  padding: 8px 20px;
  font-size: 14px;
}

.MessageList {
  padding-bottom: 100px !important;
}
