/* 白板声画工坊 - PHP版 样式 */
:root {
  --bg: #fafaf7;
  --panel: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --border: #e5e5e0;
  --primary: #1a1a1a;
  --primary-hover: #333;
  --accent: #e8734a;
  --success: #2d8a4e;
  --error: #d43838;
  --warning: #d49438;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.shell { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* 顶部栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brandMark img { width: 32px; height: 32px; border-radius: 8px; }
.pageSwitch { display: flex; gap: 4px; background: #f0f0ec; padding: 4px; border-radius: 8px; }
.pageSwitch button {
  border: none; background: transparent; padding: 8px 16px; border-radius: 6px;
  cursor: pointer; font-size: 14px; color: var(--text-secondary); transition: all .2s;
}
.pageSwitch button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.ghost {
  border: 1px solid var(--border); background: #fff; padding: 8px 16px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.ghost:hover { background: #f5f5f0; }

/* Hero */
.hero { text-align: center; margin-bottom: 32px; }
.eyebrow { font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: 1px; margin-bottom: 8px; }
.hero h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.hero .subtitle { color: var(--text-secondary); font-size: 15px; }

/* 面板 */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.sectionTitle { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.sectionTitle > div { display: flex; align-items: center; gap: 12px; }
.sectionTitle span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 13px; font-weight: 700;
}
.sectionTitle h2 { font-size: 18px; font-weight: 700; }
.sectionTitle p { font-size: 13px; color: var(--text-secondary); }

/* 工作区布局 */
.workspace { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
.rightStack { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }

/* 上传区 */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px;
  cursor: pointer; transition: all .2s; text-align: center; margin-bottom: 16px;
}
.dropzone:hover, .dropzone.ready { border-color: var(--accent); background: #fff8f5; }
.dropzone input { display: none; }
.uploadIcon { font-size: 32px; color: var(--accent); margin-bottom: 8px; }
.dropzone strong { font-size: 15px; margin-bottom: 4px; }
.dropzone small { color: var(--text-secondary); font-size: 13px; }

/* 文案输入 */
.copyLabel { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.copyLabel em { font-style: normal; color: var(--text-secondary); font-weight: 400; font-size: 13px; }
textarea {
  width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical;
  transition: border-color .2s;
}
textarea:focus { outline: none; border-color: var(--accent); }

/* 风格选择 */
.styleHeading { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 12px; }
.styleHeading strong { font-size: 15px; }
.styleHeading span { font-size: 13px; color: var(--text-secondary); }
.stylePicker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.styleCard {
  border: 2px solid var(--border); border-radius: 10px; overflow: hidden;
  cursor: pointer; background: #fff; transition: all .2s; text-align: left; padding: 0;
}
.styleCard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.styleCard.selected { border-color: var(--accent); }
.stylePreview { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #f0f0ec; }
.stylePreview img { width: 100%; height: 100%; object-fit: cover; }
.stylePreview em {
  position: absolute; top: 6px; right: 6px; background: var(--accent); color: #fff;
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-style: normal; font-weight: 600;
}
.stylePreview i {
  position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,0.6); color: #fff;
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-style: normal;
}
.styleCard.selected .stylePreview i { background: var(--accent); }
.styleCard strong { display: block; padding: 8px 10px 2px; font-size: 13px; }
.styleCard small { display: block; padding: 0 10px 10px; color: var(--text-secondary); font-size: 11px; }

/* 自定义参考 */
.referenceBuilder { margin-top: 16px; }
.visualDrop {
  display: flex; flex-direction: column; align-items: center; border: 2px dashed var(--border);
  border-radius: 10px; padding: 24px; cursor: pointer; margin-bottom: 16px; text-align: center;
}
.visualDrop:hover, .visualDrop.ready { border-color: var(--accent); background: #fff8f5; }
.visualDrop input { display: none; }
.characterHeading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.characterHeading button {
  border: 1px solid var(--border); background: #fff; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.characterList { display: flex; flex-direction: column; gap: 12px; }
.characterCard { border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.characterTop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.characterTop button { border: none; background: none; color: var(--error); cursor: pointer; font-size: 13px; }
.characterFields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.characterFields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.characterFields input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.characterUpload {
  display: flex; flex-direction: column; align-items: center; border: 1px dashed var(--border);
  border-radius: 8px; padding: 14px; cursor: pointer; text-align: center;
}
.characterUpload:hover, .characterUpload.ready { border-color: var(--accent); }
.characterUpload input { display: none; }
.referenceTip { font-size: 12px; color: var(--text-secondary); margin-top: 12px; }

/* 控制面板 */
.controlCaption { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.controlCaption strong { font-size: 15px; }
.controlCaption span { font-size: 12px; color: var(--text-secondary); }
.taskNameField { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.taskNameField label { font-size: 13px; font-weight: 600; }
.taskNameField input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.taskNameField small { font-size: 12px; color: var(--text-secondary); }
.styleRow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.styleRow label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.styleRow select, .styleRow input { padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.estimate { text-align: center; padding: 8px; background: #f5f5f0; border-radius: 6px; }
.estimate span { font-size: 11px; color: var(--text-secondary); display: block; }
.estimate strong { font-size: 14px; }

/* 开关 */
.subtitleToggle {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--border); cursor: pointer;
}
.subtitleToggle input { margin-top: 3px; }
.subtitleToggle span { flex: 1; }
.subtitleToggle strong { display: block; font-size: 14px; }
.subtitleToggle small { font-size: 12px; color: var(--text-secondary); }

.renderSetting { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.renderSetting div span { font-size: 12px; color: var(--text-secondary); display: block; }
.renderSetting select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* 按钮 */
.primary {
  display: block; width: 100%; padding: 14px; background: var(--primary); color: #fff;
  border: none; border-radius: 10px; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: all .2s; margin-top: 16px;
}
.primary:hover { background: var(--primary-hover); }
.primary:disabled { opacity: .5; cursor: not-allowed; }
.primary.small { width: auto; padding: 8px 20px; font-size: 14px; margin-top: 0; display: inline-block; }
.secondary {
  padding: 8px 16px; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.actions { display: flex; gap: 10px; margin-top: 16px; }

/* 消息 */
.message { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-top: 12px; }
.message.error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.message.success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* 结果面板 */
.emptyState { text-align: center; padding: 32px 16px; }
.paper { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.paper i {
  width: 40px; height: 50px; background: #f0f0ec; border-radius: 4px;
  display: inline-block; transform: rotate(-5deg);
}
.paper i:nth-child(2) { transform: rotate(3deg); background: #e8e8e0; }
.paper i:nth-child(3) { transform: rotate(-2deg); background: #f0f0ec; }
.emptyState h3 { font-size: 16px; margin-bottom: 6px; }
.emptyState p { font-size: 13px; color: var(--text-secondary); }

.jobState { text-align: center; }
.sharedTask { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.sharedTask strong { display: block; font-size: 14px; color: var(--text); }
.statusOrb {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700;
}
.statusOrb.queued { background: #fef3c7; color: #92400e; }
.statusOrb.running { background: #dbeafe; color: #1e40af; animation: pulse 2s infinite; }
.statusOrb.done { background: #d1fae5; color: #065f46; }
.statusOrb.error { background: #fee2e2; color: #991b1b; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
.jobState h3 { font-size: 16px; margin-bottom: 12px; }
.progress { height: 8px; background: #f0f0ec; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; border-radius: 4px; }
.jobState > p { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

/* 计时面板 */
.timingPanel { text-align: left; background: #fafaf7; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.timingTotal { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.timingTotal span { font-size: 13px; color: var(--text-secondary); }
.timingTotal strong { font-size: 15px; }
.timingTotal em { font-style: normal; font-size: 12px; color: var(--accent); margin-left: 8px; }
.timingRow { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.timingRow.running { color: var(--accent); font-weight: 600; }
.timingRow span { color: var(--text-secondary); }
.timingRow.running span { color: var(--accent); }

.jobState pre {
  text-align: left; background: #fef2f2; padding: 10px; border-radius: 6px;
  font-size: 12px; overflow-x: auto; white-space: pre-wrap; margin: 10px 0;
}
.retryButton {
  padding: 10px 20px; background: var(--warning); color: #fff; border: none;
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; margin-top: 8px;
}
.jobState video { width: 100%; border-radius: 8px; margin: 12px 0; }
.download {
  display: inline-block; padding: 10px 24px; background: var(--success); color: #fff;
  border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 600;
}

/* 步骤 */
.steps { list-style: none; display: flex; justify-content: space-between; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.steps li { font-size: 11px; color: var(--text-secondary); text-align: center; flex: 1; position: relative; }
.steps li::before {
  content: ''; display: block; width: 8px; height: 8px; background: var(--border);
  border-radius: 50%; margin: 0 auto 6px;
}

/* 历史记录 */
.historyList { display: flex; flex-direction: column; gap: 10px; }
.historyList article {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px;
}
.historyList article > div:first-child { flex: 1; }
.historyList strong { font-size: 14px; display: block; }
.historyList strong em {
  font-style: normal; font-size: 11px; background: #f0f0ec; padding: 2px 6px;
  border-radius: 4px; margin-right: 8px; color: var(--text-secondary);
}
.historyList span { font-size: 12px; color: var(--text-secondary); }
.historyList article > div:last-child { display: flex; gap: 8px; }
.historyList a, .historyList button {
  padding: 6px 12px; border: 1px solid var(--border); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 12px; text-decoration: none; color: var(--text);
}
.historyList .retryHistory { border-color: var(--warning); color: var(--warning); }
.historyEmpty { text-align: center; color: var(--text-secondary); font-size: 14px; padding: 20px; }

/* 设置面板 */
.settingsGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.settingsGrid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.settingsGrid input, .settingsGrid select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
.serviceSummary {
  margin-top: 16px; padding: 12px; background: #f5f5f0; border-radius: 8px; font-size: 13px;
}
.serviceSummary strong { display: block; margin-bottom: 4px; }
.serviceSummary span { color: var(--text-secondary); }
.serviceSummary div { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.serviceSummary i {
  font-style: normal; padding: 3px 8px; border-radius: 4px; font-size: 12px;
}
.serviceSummary i.busy { background: #fee2e2; color: #991b1b; }
.serviceSummary i.idle { background: #d1fae5; color: #065f46; }

/* 页脚 */
footer {
  display: flex; justify-content: space-between; padding: 24px 0; margin-top: 32px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .rightStack { position: static; }
  .styleRow { grid-template-columns: 1fr; }
}
