/**
 * Character Asset Styles
 * 角色资产管理样式
 */

/* ===== 向导模态框 ===== */
.wizard-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.wizard-content {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.wizard-step-wide .wizard-content {
  max-width: 1400px;
}

/* ===== 向导头部 ===== */
.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.wizard-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.step-indicator {
  font-size: 0.875rem;
  color: #6b7280;
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

/* ===== 向导主体 ===== */
.wizard-body {
  padding: 2rem 2.5rem;
}

.wizard-main {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.preview-area {
  flex: 1;
  background: #f9fafb;
  border-radius: 8px;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.loading-spinner {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-spinner p {
  color: #6b7280;
  margin: 0.5rem 0;
}

.loading-note {
  font-size: 0.875rem;
  color: #9ca3af;
}

.error-message {
  color: #ef4444;
  text-align: center;
}

/* ===== 聊天区域 ===== */
.chat-area {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.chat-header span:first-child {
  font-weight: 500;
  color: #111827;
}

.chat-subtitle {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  max-height: 400px;
}

.chat-message {
  margin-bottom: 1rem;
}

.chat-message.user .message-content {
  background: #3b82f6;
  color: white;
  margin-left: auto;
}

.chat-message.ai .message-content {
  background: #f3f4f6;
  color: #111827;
}

.chat-message.system .message-content {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.875rem;
}

.message-role {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  max-width: 90%;
  word-wrap: break-word;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.chat-input-area input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: none;
  background: #3b82f6;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #2563eb;
}

/* ===== 向导信息 ===== */
.wizard-info {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}

.info-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.info-value {
  color: #111827;
}

.reference-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.reference-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #e5e7eb;
}

/* ===== 向导底部 ===== */
.wizard-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem 2.5rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover:not(:disabled) {
  background: #e5e7eb;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.813rem;
}

/* ===== 变体管理 ===== */
.canonical-section {
  margin-bottom: 2rem;
}

.canonical-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #111827;
}

.canonical-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.canonical-preview img {
  width: 200px;
  height: auto;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
}

.variants-section {
  margin-top: 2rem;
}

.variants-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.variants-header h3 {
  margin: 0;
  font-size: 1.125rem;
  color: #111827;
}

.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.variant-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  background: #ffffff;
  transition: all 0.2s;
}

.variant-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.variant-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.variant-label {
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.5rem;
}

.variant-actions {
  display: flex;
  gap: 0.5rem;
}

.variant-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #9ca3af;
}

.placeholder-hint {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* ===== 剧本编辑器 ===== */
.script-characters-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-heading h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
  color: #111827;
}

.page-heading p {
  margin: 0;
  color: #6b7280;
}

.heading-actions {
  display: flex;
  gap: 1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #111827;
}

.section-actions {
  display: flex;
  gap: 0.5rem;
}

.script-editor-section {
  margin-bottom: 2rem;
}

.script-editor {
  width: 100%;
  min-height: 300px;
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.938rem;
  line-height: 1.6;
  resize: vertical;
}

/* ===== 角色卡片 ===== */
.characters-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.character-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  transition: all 0.2s;
}

.character-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.character-avatar {
  font-size: 2.5rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 50%;
}

.character-info {
  flex: 1;
}

.character-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.character-role-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.character-role-badge.protagonist {
  background: #dbeafe;
  color: #1e40af;
}

.character-role-badge.supporting {
  background: #e0e7ff;
  color: #4338ca;
}

.character-role-badge.background {
  background: #f3f4f6;
  color: #6b7280;
}

.character-description {
  color: #6b7280;
  font-size: 0.875rem;
}

.character-status {
  flex: 0 0 120px;
}

.status-badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.813rem;
  font-weight: 500;
}

.status-badge.success {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.character-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #111827;
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .wizard-main {
    flex-direction: column;
  }

  .chat-area {
    flex: 1;
  }

  .character-card {
    flex-direction: column;
    text-align: center;
  }

  .character-actions {
    width: 100%;
    flex-direction: column;
  }
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #9ca3af;
}

/* ===== 图片预览 ===== */
.image-preview-container {
  width: 100%;
  min-height: 200px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
}

.preview-placeholder {
  color: #9ca3af;
  font-size: 0.875rem;
}

.image-preview-container img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 6px;
}

.form-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.813rem;
  color: #6b7280;
}
