/**
 * File: client/css/components/script-editor.css
 * g,�h7
 * \(: �Ig,��ub��~u��h7
 * @date 2025-12-02
 */

/* ========== �~u�h ========== */
.episode-tabs-container {
  margin-bottom: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.episode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========== �~	� ========== */
.episode-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 20px;
  background: var(--bg-secondary, #f5f5f5);
  color: var(--text-secondary, #666);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.episode-tab:hover {
  background: var(--bg-tertiary, #eee);
  border-color: var(--primary-color, #667eea);
  color: var(--primary-color, #667eea);
}

.episode-tab.active {
  background: var(--primary-color, #667eea);
  border-color: var(--primary-color, #667eea);
  color: white;
  font-weight: 600;
}

/* ========== g,�h�:7 ========== */
#scriptDisplay .story-editor-container {
  margin-top: 0;
}

#scriptDisplay .story-editor-header h3 {
  font-size: 1.2rem;
  color: var(--text-primary, #333);
}

/* ========== 剧本撰写双栏布局 ========== */
/**
 * @description 剧本撰写主容器 - 左右双栏布局
 * @date 2025-01-18
 */
.script-writing-container {
  display: flex;
  gap: var(--spacing-lg, 24px);
  min-height: 500px;
}

/* 左侧：目录生成容器 */
.script-catalog-section {
  width: 280px;
  min-width: 280px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: var(--radius-lg, 14px);
  padding: var(--spacing-lg, 24px);
  display: flex;
  flex-direction: column;
}

.script-catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md, 16px);
  padding-bottom: var(--spacing-md, 16px);
  border-bottom: 1px solid var(--border-light, #e5e5e5);
}

.script-catalog-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #000);
  margin: 0;
}

.script-catalog-loading {
  text-align: center;
  padding: var(--spacing-xl, 32px) var(--spacing-md, 16px);
}

.script-catalog-loading .spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
}

.script-catalog-loading p {
  color: var(--text-tertiary, #888);
  font-size: 0.875rem;
}

.script-catalog-list {
  flex: 1;
  overflow-y: auto;
}

.script-catalog-list .placeholder-text {
  text-align: center;
  color: var(--text-tertiary, #888);
  font-size: 0.875rem;
  padding: var(--spacing-xl, 32px) var(--spacing-md, 16px);
  line-height: 1.6;
}

/* 目录项样式 */
.catalog-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 8px);
  padding: var(--spacing-md, 16px);
  margin-bottom: var(--spacing-sm, 8px);
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #e5e5e5);
  border-radius: var(--radius-md, 10px);
  cursor: pointer;
  transition: all 0.2s ease;
}

.catalog-item:hover {
  border-color: var(--primary-color, #000);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
}

.catalog-item.active {
  background: var(--primary-color, #000);
  border-color: var(--primary-color, #000);
  color: white;
}

.catalog-item.active .catalog-episode-num {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.catalog-item.active .catalog-episode-title {
  color: white;
}

.catalog-item.generated {
  position: relative;
}

.catalog-item.generated::after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--success-color, #333);
  font-weight: bold;
}

.catalog-item.active.generated::after {
  color: white;
}

.catalog-episode-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary, #fafafa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary, #888);
}

.catalog-episode-title {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary, #000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右侧：剧本内容容器 */
.script-content-section {
  flex: 1;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: var(--radius-lg, 14px);
  padding: var(--spacing-lg, 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.script-content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md, 16px);
  padding-bottom: var(--spacing-md, 16px);
  border-bottom: 1px solid var(--border-light, #e5e5e5);
}

.script-content-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #000);
  margin: 0;
}

/**
 * @description 剧本内容区域标题栏按钮容器
 * @date 2025-01-18
 */
.script-header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/**
 * @description 剧本编辑区域样式
 * @date 2025-01-18
 */
.script-content-edit {
  width: 100%;
  height: 100%;
  min-height: 400px;
}

.script-edit-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  background: #f8faff;
  border: 1px solid #dfe7ff;
  border-radius: 14px;
}

.script-edit-mode-tabs,
.script-edit-copy-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.script-edit-mode-btn {
  border: 1px solid #d8e1ff;
  background: #ffffff;
  color: #66739a;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.script-edit-mode-btn.active {
  background: linear-gradient(135deg, #5d6bff 0%, #7b4dff 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(93, 107, 255, 0.22);
}

.script-edit-mode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.script-structured-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.script-structured-editor-note,
.script-parse-warning {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #51618d;
  background: #eef4ff;
  border: 1px solid #dbe6ff;
  font-size: 13px;
  line-height: 1.6;
}

.script-parse-warning {
  color: #9a5b00;
  background: #fff7e6;
  border-color: #ffe1a8;
}

.script-unit-editor-card {
  margin-bottom: 16px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #dfe7ff;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(75, 91, 160, 0.08);
}

.script-unit-editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1ff;
}

.script-unit-editor-head strong {
  color: #4355ff;
  font-size: 15px;
}

.script-unit-editor-head span {
  color: #1f2a4d;
  font-size: 14px;
  font-weight: 700;
}

.script-unit-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.script-unit-editor-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.script-unit-editor-grid label span {
  color: #66739a;
  font-size: 13px;
  font-weight: 700;
}

.script-unit-editor-grid input,
.script-unit-editor-grid textarea {
  width: 100%;
  border: 1px solid #dce5ff;
  border-radius: 12px;
  background: #fbfcff;
  color: #1f2a4d;
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
}

.script-unit-editor-grid input:focus,
.script-unit-editor-grid textarea:focus {
  outline: none;
  border-color: #6675ff;
  box-shadow: 0 0 0 3px rgba(102, 117, 255, 0.12);
  background: #ffffff;
}

.script-unit-editor-wide {
  grid-column: 1 / -1;
}

.script-content-edit > textarea {
  width: 100%;
  height: 100%;
  min-height: 400px;
  padding: 16px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  resize: vertical;
  background: var(--bg-secondary, #f9f9f9);
  color: var(--text-primary, #333);
}

.script-content-edit > textarea:focus {
  outline: none;
  border-color: var(--primary-color, #4CAF50);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

@media (max-width: 768px) {
  .script-edit-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .script-unit-editor-grid {
    grid-template-columns: 1fr;
  }
}

.script-content-loading {
  text-align: center;
  padding: var(--spacing-2xl, 48px) var(--spacing-md, 16px);
}

.script-content-loading .spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
}

.script-content-loading p {
  color: var(--text-tertiary, #888);
  font-size: 0.9375rem;
}

.script-content-display {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-primary, #fff);
  border-radius: var(--radius-md, 10px);
  padding: var(--spacing-lg, 24px);
}

.script-content-display .placeholder-text {
  text-align: center;
  color: var(--text-tertiary, #888);
  font-size: 0.9375rem;
  padding: var(--spacing-2xl, 48px) var(--spacing-md, 16px);
  line-height: 1.6;
}

/* 剧本表格样式 */
.script-table-container {
  overflow-x: auto;
}

.script-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.script-table th,
.script-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border-light, #e5e5e5);
  vertical-align: top;
}

.script-table th {
  background: var(--bg-tertiary, #fafafa);
  font-weight: 600;
  color: var(--text-primary, #000);
  white-space: nowrap;
}

.script-table td {
  background: var(--bg-primary, #fff);
  color: var(--text-secondary, #333);
  line-height: 1.5;
}

.script-table tr:hover td {
  background: var(--bg-tertiary, #fafafa);
}

/* 响应式设计 */
@media (max-width: 900px) {
  .script-writing-container {
    flex-direction: column;
  }

  .script-catalog-section {
    width: 100%;
    min-width: auto;
    min-height: auto;
  }

  .script-catalog-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 8px);
  }

  .catalog-item {
    flex: 0 0 auto;
    margin-bottom: 0;
  }
}
