/**
 * 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-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);
}

.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;
  }
}
