/* ==========================================================================
   Storyboard Preview Popup — styles for the buildStoryboardPreviewHtml
   popup window (Block #2 from inline <style> in JS template literal).
   ========================================================================== */
:root {
  --bg: #f4f7fb;
  --bg-grad-top: #f0f6ff;
  --panel: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e5e7eb;
  --border-soft: #eef2f7;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --story: #eff6ff;
  --narration: #faf5ff;
  --sfx: #ecfdf5;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg) 260px);
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  line-height: 1.5;
}
main {
  max-width: 1080px;
  margin: 22px auto;
  padding: 0 16px 30px;
}
.header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.export-btn {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.export-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.export-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.export-status {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-subtle);
  min-height: 1em;
}
.export-status.error {
  color: #b91c1c;
}
.header h1 {
  margin: 0;
  font-size: 22px;
  color: var(--text);
}
.context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.context .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}
.ad-copy {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.cuts {
  display: grid;
  gap: 12px;
}
.cut-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.cut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cut-num {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cut-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.cut-body {
  display: grid;
  gap: 8px;
}
.cut-field {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.cut-field.story { background: var(--story); }
.cut-field.narration { background: var(--narration); }
.cut-field.sfx { background: var(--sfx); }
.cut-field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}
.cut-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.cut-generate-image-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 120ms;
}
.cut-generate-image-btn:hover:not(:disabled) { background: var(--accent-hover); }
.cut-generate-image-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.cut-image-preview {
  margin-top: 10px;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid var(--border-soft);
}
.cut-image-preview.hidden { display: none; }
.cut-image-preview-loading.hidden { display: none; }
.footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.generate-video-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.generate-video-btn:hover:not(:disabled) { background: var(--accent-hover); }
.generate-video-btn:disabled { opacity: 0.55; cursor: not-allowed; }
#video-player-wrap {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #0f172a;
}
#video-player-wrap.hidden { display: none; }
.preview-generated-video {
  width: 100%;
  border-radius: var(--radius-md);
  display: block;
}
.preview-generated-video.hidden { display: none; }
#video-preview-loading {
  color: #cbd5e1;
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}
#video-preview-loading.hidden { display: none; }
/* 이전 마크업 스타일 복원 (Clean Blue 토큰으로 현대화) */
.cuts-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cut-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.cut-header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 220px;
}
.cut-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 0 1 auto;
}
.cut-header-actions.with-image-tools {
  width: 180px;
  max-width: 100%;
}
.cut-action-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cut-header-actions.with-image-tools .cut-action-row {
  width: 100%;
  justify-content: flex-end;
}
.cut-select {
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.cut-delete-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.cut-delete-btn:hover {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.tracks-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.track {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
}
.track.story-track {
  background: var(--story);
  border-color: #dbeafe;
}
.track.narration-track {
  background: var(--narration);
  border-color: #ede9fe;
}
.track.sfx-track {
  background: var(--sfx);
  border-color: #d1fae5;
}
.track h3 {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.track-input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: #fff;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}
.track-input:focus {
  outline: 2px solid #bfdbfe;
  outline-offset: 0;
  border-color: var(--accent);
}
.track-input::placeholder {
  color: var(--text-subtle);
}
.cut-image-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  width: 100%;
}
.cut-image-status {
  font-size: 12px;
  color: var(--text-subtle);
}
.cut-image-status.error {
  color: #b91c1c;
}
.cut-image-preview-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.cut-image-preview-frame {
  width: min(100%, 280px);
  min-height: 280px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.cut-image-preview-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.cut-image-preview-loading {
  width: 100%;
  min-height: 244px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-soft) 0%, #e0ebff 100%);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.cut-image-preview-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #c1d6f6;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.preview-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}
.regenerate-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  transition: background 120ms, border-color 120ms;
}
.regenerate-btn:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--accent);
}
.regenerate-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.regenerate-status {
  font-size: 12px;
  color: var(--text-subtle);
}
.regenerate-status.error {
  color: #b91c1c;
}
.video-generate-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.video-generate-status {
  font-size: 12px;
  color: var(--text-subtle);
}
.video-generate-status.error {
  color: #b91c1c;
}
/* class-based 변형 — id 기반 규칙과의 하위 호환 */
.video-player-wrap {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #0f172a;
}
.video-player-wrap.hidden { display: none; }
.video-preview-loading {
  width: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-soft) 0%, #e0ebff 100%);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.video-preview-loading.hidden { display: none; }
.video-preview-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #c1d6f6;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.no-cuts-message {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text-subtle);
  font-size: 13px;
  text-align: center;
}
.hidden { display: none; }
@keyframes spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 780px) {
  .tracks-row { grid-template-columns: 1fr; }
  .cut-header-actions.with-image-tools { width: 100%; }
}

/* ==========================================================================
   Loading Popup — styles for openStoryboardPreviewWindow loading state
   (Block #3 from inline <style> in JS template literal).
   ========================================================================== */
/* NOTE: body rules from loading/error popups share the same storyboard popup
   scope. The loading popup body rule is included here for reference but will
   be applied via the JS template literal in Tasks 18-20. */

/* ==========================================================================
   Error Popup — styles for renderStoryboardErrorWindow
   (Block #4 from inline <style> in JS template literal).
   ========================================================================== */
/* NOTE: The loading and error popup <style> blocks remain in the JS template
   literals (Tasks 18-20 will refactor them). This file serves as the
   extracted CSS reference for those popup styles. */
