/**
 * File: client/css/components/character-cards.css
 * 角色卡片样式
 * 作用: 定义角色图片生成和展示的卡片样式（9:16比例）
 */

/* 角色生成网格容器 */
.character-generation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* 单个角色卡片 */
.character-card {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 角色图片容器 (9:16比例) */
.character-card-image {
  position: relative;
  width: 100%;
  padding-top: 177.78%; /* 16/9 = 1.7778 */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow: hidden;
}

.character-card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/**
 * @description 角色名称标签已移除
 * @date 2025-11-02
 * 修改内容: 去掉右上角的角色名称标签
 */

/* 加载状态 */
.character-card-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  z-index: 20;
}

.character-card-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f0f0f0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.character-card-loading p {
  margin-top: 16px;
  color: #666;
  font-size: 14px;
}

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

/**
 * @description 提示词编辑区域
 * @date 2025-11-02
 * 修改内容: 替换角色信息区域为提示词编辑区域
 */
.character-card-prompt {
  padding: 16px;
  background: #fafafa;
  border-top: 1px solid #e5e5e5;
}

.character-card-prompt label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

.character-card-prompt .prompt-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #ffffff;
  resize: vertical;
  min-height: 80px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: border-color 0.2s ease;
}

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

/**
 * @description 配音选择区域
 * @date 2025-11-03
 * 新增内容: 添加配音选择下拉菜单样式
 * @date 2025-11-03 修改: 添加试听按钮和情感选择样式
 * @date 2025-11-03 修改: 调整上边距为0,因为上方的重新生成按钮已有下边距
 */
.voice-select-wrapper {
  margin-top: 0;
}

.voice-select-wrapper label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

/* 音色选择行 - 包含下拉菜单和试听按钮 */
.voice-select-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.voice-select {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  font-size: 13px;
  color: #1a1a1a;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.voice-select:hover {
  border-color: #667eea;
}

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

.voice-select option {
  padding: 8px;
  font-size: 13px;
}

/* 试听按钮 */
.preview-voice-btn {
  min-width: 44px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-voice-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.4);
  background: linear-gradient(135deg, #30d158 0%, #34c759 100%);
}

.preview-voice-btn:active:not(:disabled) {
  transform: translateY(0);
}

.preview-voice-btn:disabled {
  background: linear-gradient(135deg, #d1d1d6 0%, #c0c0c0 100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

/* 情感选择容器 */
.emotion-select-container {
  margin-top: 0;
}

.emotion-select-wrapper {
  margin-top: 12px;
}

.emotion-select-wrapper label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

.emotion-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  font-size: 13px;
  color: #1a1a1a;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.emotion-select:hover {
  border-color: #667eea;
}

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

.emotion-select option {
  padding: 8px;
  font-size: 13px;
}

/**
 * @description 重新生成按钮样式
 * @date 2025-11-03 修改: 调整margin,适配新的按钮位置(在提示词下方,配音选择上方)
 */
.character-card-prompt .regenerate-btn {
  width: 100%;
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

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

.character-card-prompt .regenerate-btn:active {
  transform: translateY(0);
}

.character-card-prompt .regenerate-btn:disabled {
  background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 错误状态 */
.character-card-error {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 59, 48, 0.05);
  z-index: 15;
}

.character-card-error i {
  font-size: 48px;
  color: #ff3b30;
  margin-bottom: 12px;
}

.character-card-error p {
  color: #ff3b30;
  font-size: 14px;
  text-align: center;
  padding: 0 20px;
}

/* 占位符文本 */
.placeholder-text {
  text-align: center;
  color: #999;
  font-size: 16px;
  padding: 60px 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .character-generation-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
  }

  .character-card-prompt .prompt-input {
    font-size: 12px;
    min-height: 70px;
  }

  /**
   * @description 配音选择在移动端的样式调整
   * @date 2025-11-03
   * @date 2025-11-03 修改: 添加试听按钮和情感选择的响应式样式
   */
  .voice-select {
    font-size: 12px;
    padding: 8px 10px;
  }

  .voice-select option {
    font-size: 12px;
  }

  .preview-voice-btn {
    min-width: 40px;
    font-size: 16px;
    padding: 8px 10px;
  }

  .emotion-select {
    font-size: 12px;
    padding: 8px 10px;
  }

  .emotion-select option {
    font-size: 12px;
  }

  .character-card-prompt .regenerate-btn {
    font-size: 13px;
    padding: 8px 14px;
  }
}

/* ========== DubbingX情绪选择样式 ========== */
/**
 * @description Premium全情绪音色的三级选择器样式
 * @date 2025-11-03
 * @date 2025-11-03 修改: 添加.emotion-row样式,改为3行布局,移除图标
 */
.emotion-premium-wrapper {
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.emotion-premium-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
}

/**
 * @description 情绪选择行样式 - 每行包含标签和下拉框
 * @date 2025-11-03
 */
.emotion-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.emotion-row:last-of-type {
  margin-bottom: 0;
}

.emotion-row-label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  min-width: 50px;
  flex-shrink: 0;
}

.emotion-row select {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.emotion-row select:hover:not(:disabled) {
  border-color: #667eea;
}

.emotion-row select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.emotion-row select:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.emotion-cascade {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.emotion-cascade-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emotion-cascade-item label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

.emotion-cascade-item select {
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
}

.cascade-arrow {
  font-size: 16px;
  color: #667eea;
  margin-bottom: 8px;
  font-weight: bold;
}

.emotion-preview {
  margin-top: 8px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border: 1px solid #667eea;
  border-radius: 4px;
  font-size: 12px;
  color: #667eea;
  font-weight: 500;
  text-align: center;
}

/**
 * @description 试听按钮样式
 * @date 2025-11-03
 */
/**
 * @description 试听按钮样式 - 改为蓝色背景,去掉图标
 * @date 2025-11-03
 */
.voice-preview-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.voice-preview-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

.voice-preview-btn:active:not(:disabled) {
  transform: translateY(0);
}

.voice-preview-btn:disabled {
  background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

.emotion-loading, .emotion-error, .emotion-info {
  padding: 8px;
  text-align: center;
  font-size: 12px;
  border-radius: 4px;
  margin-top: 8px;
}

.emotion-loading {
  background: #f3f4f6;
  color: #6b7280;
}

.emotion-error {
  background: #fee2e2;
  color: #dc2626;
}

.emotion-info {
  background: #f3f4f6;
  color: #9ca3af;
}

.voice-loading-hint {
  padding: 12px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  color: #92400e;
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
}

/**
 * @description 旁白配音选择区域样式
 * @date 2025-11-03
 */
.narrator-voice-section {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin: 20px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.narrator-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
}

.narrator-voice-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 480px) {
  .character-generation-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .emotion-cascade {
    flex-direction: column;
    align-items: stretch;
  }

  .cascade-arrow {
    transform: rotate(90deg);
    align-self: center;
  }

  .narrator-voice-section {
    margin: 15px;
    padding: 15px;
  }
}
