/* 新智能体创建页面样式 - 基于截图设计 */

.agent-create-page {
  height: 100vh;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 顶部头部 */
.create-header {
  height: 60px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s;
}

.back-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.back-icon {
  width: 16px;
  height: 16px;
}

.header-avatar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-placeholder-small {
  width: 40px;
  height: 40px;
  background: #e5e7eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-image-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.user-icon {
  width: 20px;
  height: 20px;
  color: #9ca3af;
}

.avatar-text-header {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  text-align: center;
}

.header-title {
  font-size: 16px;
  font-weight: 500;
  color: #374151;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clear-draft-btn {
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #6b7280;
}

.clear-draft-btn:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

.clear-draft-btn:active {
  background: #fecaca;
  transform: scale(0.95);
}

.clear-icon {
  width: 16px;
  height: 16px;
}

/* 保存指示器样式 */
.save-indicator {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  margin-right: 8px;
}

.save-indicator.saved {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.save-indicator.loaded {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}

.publish-btn {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.publish-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.publish-btn:disabled,
.publish-btn.disabled {
  background: linear-gradient(135deg, #9ca3af, #d1d5db);
  cursor: not-allowed;
  opacity: 0.6;
}

.publish-btn:disabled:hover,
.publish-btn.disabled:hover {
  transform: none;
  box-shadow: none;
}

.delete-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border-radius: 6px;
  color: #d1d5db;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.delete-btn:hover {
  background: #fef2f2;
  color: #f87171;
}

.delete-icon {
  width: 14px;
  height: 14px;
}

/* 大模型选择样式 */
.model-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.model-select:hover {
  border-color: #10b981;
}

.model-select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* 标签选择样式 */
.tags-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.tag-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag-checkbox:hover {
  border-color: #10b981;
}

.tag-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #10b981;
  appearance: none;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: white;
  position: relative;
  transition: all 0.2s;
}

.tag-checkbox input[type="checkbox"]:checked {
  border-color: #10b981;
  background: white;
}

.tag-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 2px;
  color: #10b981;
  font-size: 12px;
  font-weight: bold;
}

.tag-checkbox input[type="checkbox"]:checked + .tag-label {
  color: #10b981;
  font-weight: 500;
}

.tag-label {
  font-size: 14px;
  color: #6b7280;
  transition: all 0.2s;
}

.field-help {
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
}

/* 生成提示词按钮样式 */
.generate-prompt-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #1db171;
  border-radius: 4px;
  background: #e9f9f2;
  color: #1db171;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  height: 24px;
}

.generate-prompt-btn:hover:not(:disabled) {
  border: 1px solid #1db171;
  background: #1db171;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(29, 177, 113, 0.3);
}

.generate-prompt-btn:hover:not(:disabled) .sparkles-icon {
  color: white;
}

.generate-prompt-btn:hover:not(:disabled) .btn-text {
  color: white;
}

.generate-prompt-btn:disabled,
.generate-prompt-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.generate-prompt-btn .sparkles-icon {
  width: 14px;
  height: 14px;
  color: #1db171;
  transition: color 0.2s;
}

.generate-prompt-btn .btn-text {
  font-size: 11px;
  color: #1db171;
  font-weight: 500;
  line-height: 1;
  transition: color 0.2s;
}

/* 加载动画 */
.loading-spinner {
  animation: spin 1s linear infinite;
}

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

/* 保存指示器 */
.save-indicator {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
}

.save-indicator.saving {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.save-indicator.saved {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.save-indicator.loaded {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fed7aa;
}

/* 主要内容区域 */
.create-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 左侧配置面板 */
.config-panel {
  width: 55%;
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.config-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.config-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.config-mode {
  background: #f0fdf4;
  color: #16a34a;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  width: fit-content;
}

.config-header-right {
  margin-top: 4px;
}

.switch-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}

.switch-mode:hover {
  color: #374151;
}

.switch-icon {
  width: 16px;
  height: 16px;
}

.config-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid #f3f4f6;
}

.config-tab {
  padding: 12px 0;
  margin-right: 32px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.config-tab.active {
  color: #10b981;
  border-bottom-color: #10b981;
  font-weight: 500;
}

.config-tab:hover {
  color: #374151;
}

/* 表单内容 */
.agent-config-form {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px 24px;
}

.config-section {
  margin-bottom: 16px;
  background: #f8f8f8;
  border-radius: 8px;
  padding: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* margin-bottom: 20px; */
}

.section-header-left {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.section-icon {
  width: 16px;
  height: 16px;
  color: #3b82f6;
}

.section-icon.prompt-icon {
  color: #10b981;
}

.section-title {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.required-star {
  color: #ef4444;
  font-weight: 500;
  line-height: 1;
  margin-left: 2px;
}

.help-icon {
  width: 14px;
  height: 14px;
  color: #9ca3af;
  cursor: pointer;
}

.generate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.generate-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.generate-icon {
  width: 14px;
  height: 14px;
}

/* 基础信息布局 - 左右分栏 */
.left-right-layout {
  display: flex;
  gap: 15px;
  align-items: stretch;
}

.left-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0; /* 防止flex项目溢出 */
  background: white;
  border-radius: 8px;
  padding: 24px;
}

.avatar-field {
  width: 200px;
  flex-shrink: 0;
  background: white;
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.name-field {
  position: relative;
}

.description-field {
  position: relative;
}

.edit-icon {
  position: absolute;
  bottom: 12px;
  right: 70px;
  width: 16px;
  height: 16px;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.2s;
}

.edit-icon:hover {
  color: #6b7280;
}

.form-group {
  position: relative;
}

/* 字段标签和输入框 */
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: #374151;
  margin-bottom: 8px;
}

.required-asterisk {
  color: #ef4444;
  font-weight: 500;
  line-height: 1;
  margin-left: 2px;
  vertical-align: top;
}

.info-icon {
  width: 16px;
  height: 16px;
  color: #9ca3af;
  margin-left: 4px;
  cursor: pointer;
}

.name-input {
  width: 100%;
  padding: 12px 16px;
  padding-right: 70px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  background: white;
  transition: all 0.2s;
  box-sizing: border-box;
  height: 48px;
}

.name-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.name-field .char-counter {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  margin-top: 12px; /* 调整到输入框内 */
  font-size: 12px;
  color: #9ca3af;
  background: transparent;
  padding: 0;
  pointer-events: none;
}

.description-field .char-counter {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 12px;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.description-textarea {
  width: 100%;
  padding: 14px 16px;
  padding-right: 90px;
  padding-bottom: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  background: white;
  transition: all 0.2s;
  resize: vertical;
  line-height: 1.5;
  min-height: 120px;
  box-sizing: border-box;
}

.description-textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.prompt-textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  background: #fafbfc;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  line-height: 1.6;
  resize: vertical;
  min-height: 320px;
}

.prompt-textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  background: white;
}

.char-count {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 12px;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

/* 头像上传区域 */
.avatar-upload-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  flex: 1;
  justify-content: center;
}

/* 头像预览 */
.avatar-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 预览图片样式 - 确保完美圆形 */
#preview-image {
  width: 120px !important;
  height: 120px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}


/* 上传控制按钮组 */
.upload-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* 禁用状态样式 */
.upload-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.ai-generate-btn:disabled,
.ai-generate-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* 要求提示 */
.upload-requirement {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #f59e0b;
  background: #fffbeb;
  border: 1px solid #fed7aa;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 8px;
}

.upload-requirement.hidden,
.hidden {
  display: none !important;
}

.requirement-icon {
  width: 14px;
  height: 14px;
  color: #f59e0b;
}

.requirement-text {
  line-height: 1.2;
}

.upload-btn {
  border: 2px dashed #d1d5db;
  border-radius: 50%;
  width: 120px;
  height: 120px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: white;
  box-sizing: border-box;
}

.ai-generate-btn {
  border: 1px solid #1db171;
  border-radius: 4px;
  width: 100px;
  height: 24px;
  background: #e9f9f2;
  color: #1db171;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  box-sizing: border-box;
}

.upload-btn:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.ai-generate-btn:hover {
  border: 1px solid #1db171;
  background: #1db171;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(29, 177, 113, 0.3);
}

.plus-icon {
  width: 24px;
  height: 24px;
  color: #9ca3af;
}

.sparkles-icon {
  width: 12px;
  height: 12px;
  color: #1db171;
  transition: color 0.2s;
}

.ai-generate-btn:hover .sparkles-icon {
  color: white;
}

.upload-btn .btn-text {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
  line-height: 1.2;
}

.ai-generate-btn .btn-text {
  font-size: 11px;
  color: #1db171;
  font-weight: 500;
  line-height: 1;
  transition: color 0.2s;
}

.ai-generate-btn:hover .btn-text {
  color: white;
}

.ai-generate-btn:hover .edit-icon {
  color: white;
}

.file-limit {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  margin-top: 8px;
  line-height: 1.2;
}

/* 上传状态 */
.upload-status {
  font-size: 12px;
  text-align: center;
  padding: 8px;
  border-radius: 4px;
  margin-top: 8px;
}

.upload-status.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.upload-status.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.upload-status.loading {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* 加载动画 */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #0369a1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 知识库列表 */
.knowledge-bases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kb-item {
  display: block;
  cursor: pointer;
}

.kb-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.kb-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  background: white;
  transition: all 0.2s;
}

.kb-item input:checked + .kb-card {
  border-color: #10b981;
  background: #f0fdf4;
}

.kb-card h4 {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin: 0 0 8px 0;
}

.kb-card p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

/* 右侧预览面板 */
.preview-panel {
  width: 45%;
  background: linear-gradient(116.03deg, #f6fbff 1.44%, #f5f6f8 42.83%, #f6fbff 100%);
  display: flex;
  flex-direction: column;
}

.preview-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: white;
}

.preview-tabs {
  display: flex;
  align-items: center;
}

.preview-tab {
  padding: 12px 20px;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.preview-tab:hover {
  color: #10b981;
}

.preview-tab.active {
  color: #10b981;
  border-bottom-color: #10b981;
}

.mode-badge {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 40px 20px;
}

/* 智能体预览样式 */
.agent-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  height: 100%;
  overflow: hidden;
}

.agent-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 20px;
  flex-shrink: 0; /* 防止被压缩 */
}

.agent-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 12px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-avatar-placeholder {
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.agent-avatar-placeholder i {
  width: 32px;
  height: 32px;
}

.avatar-text-preview {
  font-size: 24px;
  font-weight: 600;
  color: #374151;
  text-align: center;
}

.avatar-text-chat {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.agent-name {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  text-align: center;
}

.agent-intro {
  margin-bottom: 20px;
  flex-shrink: 0; /* 防止被压缩 */
}

.agent-intro p {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* 聊天界面样式 */
.chat-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px; /* 设置最小高度确保良好的用户体验 */
  height: 100%;
}

.chat-header {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  background: white;
}

.clear-chat-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-chat-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.clear-chat-btn i {
  width: 12px;
  height: 12px;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  min-height: 300px; /* 设置合适的最小高度 */
  max-height: calc(100% - 120px); /* 预留输入区域高度 */
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-avatar-placeholder,
.user-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.ai-avatar-placeholder {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
}

.ai-avatar-placeholder i,
.user-avatar-placeholder i {
  width: 16px;
  height: 16px;
}

.message-content {
  background: white;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 70%;
  font-size: 14px;
  line-height: 1.4;
  color: #374151;
  word-wrap: break-word;
}

.user-message .message-content {
  background: #10b981;
  color: white;
}

.message-content.typing {
  background: #f3f4f6;
  color: #6b7280;
  font-style: italic;
  opacity: 0.8;
}

.message-content.error {
  background: #fef2f2;
  color: #dc2626;
  border-left: 3px solid #dc2626;
}

/* Markdown内容样式 */
.message-content.markdown-content {
  line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin: 12px 0 8px 0;
  font-weight: 600;
  line-height: 1.3;
}

.markdown-content h1 {
  font-size: 18px;
  color: #1f2937;
}

.markdown-content h2 {
  font-size: 16px;
  color: #374151;
}

.markdown-content h3 {
  font-size: 14px;
  color: #4b5563;
}

.markdown-content p {
  margin: 8px 0;
}

.markdown-content ul,
.markdown-content ol {
  margin: 8px 0;
  padding-left: 20px;
  list-style: inherit;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}

.markdown-content li {
  margin: 4px 0;
  line-height: 1.5;
  display: list-item;
}

.markdown-content code.inline-code {
  background: #f3f4f6;
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.markdown-content pre.code-block {
  background: #1f2937;
  color: #e5e7eb;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.4;
}

.markdown-content pre.code-block code {
  font-family: 'Courier New', monospace;
  white-space: pre;
}

.markdown-content strong {
  font-weight: 600;
  color: #1f2937;
}

.markdown-content em {
  font-style: italic;
  color: #4b5563;
}

.markdown-content a {
  color: #10b981;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.markdown-content a:hover {
  border-bottom-color: #10b981;
}

.markdown-content blockquote {
  border-left: 3px solid #10b981;
  margin: 12px 0;
  padding-left: 12px;
  color: #6b7280;
  font-style: italic;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}

.markdown-content table th,
.markdown-content table td {
  border: 1px solid #e5e7eb;
  padding: 8px;
  text-align: left;
}

.markdown-content table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.markdown-content table tr:nth-child(even) {
  background: #f9fafb;
}

.chat-input-area {
  border-top: 1px solid #e5e7eb;
  background: white;
}

.chat-input-container {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 8px;
}

.chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  height: 58px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.chat-input:focus {
  border-color: #10b981;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  background: #10b981;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.chat-send-btn:hover:not(:disabled):not(.disabled) {
  background: #059669;
}

.chat-send-btn:disabled,
.chat-send-btn.disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.chat-send-btn:disabled:hover,
.chat-send-btn.disabled:hover {
  background: #e5e7eb;
}

.chat-send-btn i {
  width: 16px;
  height: 16px;
}

.chat-footer {
  padding: 8px 12px;
  text-align: center;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.chat-footer small {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
}

.footer-link {
  color: #10b981;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* 批量测试界面样式 */
.test-interface {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.test-controls {
  text-align: center;
}

.test-controls h4 {
  color: #1f2937;
  margin-bottom: 8px;
}

.test-controls p {
  color: #6b7280;
  margin-bottom: 20px;
  font-size: 14px;
}

.test-btn {
  background: #e5e7eb;
  border: none;
  color: #9ca3af;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: not-allowed;
  font-size: 14px;
}

.preview-placeholder {
  text-align: center;
  max-width: 300px;
  width: 100%;
}

.placeholder-avatar {
  width: 80px;
  height: 80px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.smile-icon {
  width: 32px;
  height: 32px;
  color: #d1d5db;
}

.placeholder-text {
  margin-top: 15px;
}

.placeholder-text p {
  font-size: 14px;
  color: #9ca3af;
  margin: 0 0 8px 0;
  line-height: 1.5;
}

/* 预览卡片样式 */
.agent-preview-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 320px;
  width: 100%;
  margin: 0 auto;
}

.agent-preview-avatar {
  text-align: center;
  margin-bottom: 16px;
}

.preview-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #f3f4f6;
}

.placeholder-avatar {
  width: 80px;
  height: 80px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
}

.preview-avatar-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

/* 头像操作按钮样式 */
.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

/* 头像操作按钮中的图标样式 */
.avatar-actions .edit-icon {
  width: 12px;
  height: 12px;
  color: #1db171;
  opacity: 1;
  visibility: visible;
  display: inline-block;
  transition: color 0.2s;
}

.avatar-actions .sparkles-icon {
  opacity: 1;
  visibility: visible;
  display: inline-block;
}

.edit-icon {
  width: 16px;
  height: 16px;
}

.avatar-icon {
  width: 32px;
  height: 32px;
  color: #9ca3af;
}

.agent-preview-info {
  text-align: center;
}

.agent-preview-name {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.agent-preview-description {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 16px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-preview-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #6b7280;
}

.stat-icon {
  width: 16px;
  height: 16px;
}

/* 错误消息 */
.error-messages {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.error-item {
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 4px;
}

.error-item:last-child {
  margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .create-main {
    flex-direction: column;
  }
  
  .config-panel {
    width: 100%;
    max-height: 60vh;
  }
  
  .preview-panel {
    max-height: 40vh;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .create-header {
    padding: 0 16px;
  }
  
  .agent-config-form {
    padding: 16px;
  }
}

/* 打字机效果相关样式 */
.typing-indicator {
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.5s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

.typewriter-cursor {
  display: inline-block;
  color: #007aff;
  font-weight: normal;
  animation: blink 1s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.loading .message-content {
  display: flex;
  align-items: center;
  gap: 8px;
}