/* ─── cardnews.css — visual-pipeline-mirra (AI 카드뉴스 위자드) ─── */
/* Codex C-P2-9: CSS 없이는 wizard + carousel 가 QA 불가 → 필수 승격. */

/* Local tokens (index.css 에 없는 nuance — 디자인 시스템 합류 전 임시) */
:root {
  --cn-muted: rgba(0, 0, 0, 0.45);
  --cn-accent-bg: rgba(241, 90, 36, 0.08);
  --cn-danger: #c0392b;
}

/* ─── Wizard shell ───────────────────────────────────────── */
#page-cardnews { padding: 24px; }
.cardnews-wizard { max-width: 1200px; margin: 0 auto; }

.wizard-steps {
  display: flex; gap: 12px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.wizard-steps .step {
  padding: 8px 16px; border-radius: 999px;
  background: var(--bg-secondary, var(--bg));
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.wizard-steps .step.active {
  background: var(--accent); color: #fff; font-weight: 600;
}

.step-section { margin-bottom: 24px; }
.step-section h3 {
  font-size: 13px; color: var(--text-secondary);
  margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.4px;
}

.cn-input,
.step-section textarea,
.step-section input[type="text"],
.step-section input[type="number"] {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 14px;
  background: var(--surface, #fff);
  box-sizing: border-box;
}
.cn-input:focus,
.step-section textarea:focus,
.step-section input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.step-cta { margin-top: 24px; text-align: right; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

.btn-primary {
  padding: 10px 20px; border: none; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
  font-size: 14px;
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface, #fff); cursor: pointer;
}
.btn-danger {
  padding: 6px 12px; border: 1px solid var(--cn-danger);
  background: transparent; color: var(--cn-danger);
  border-radius: 6px; cursor: pointer; font-size: 12px;
}
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

.muted { color: var(--cn-muted); font-size: 12px; }
.empty-state {
  padding: 24px; text-align: center; color: var(--cn-muted);
  border: 1px dashed var(--border); border-radius: 8px;
}

/* ─── Step M1: 디자인 그리드 + 칩 + 옵션 ─────────────── */
.set-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.set-card {
  padding: 14px; border: 2px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  background: var(--surface, #fff);
}
.set-card:hover { border-color: var(--accent); }
.set-card.selected { border-color: var(--accent); background: var(--cn-accent-bg); }

.topic-chips {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.chip {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  cursor: pointer; font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--bg-secondary, var(--bg)); border-color: var(--accent); }

.option-row {
  display: flex; align-items: center; gap: 16px; padding: 8px 0;
  flex-wrap: wrap;
}
.option-row-vertical { flex-direction: column; align-items: stretch; }
.option-label {
  min-width: 110px; font-size: 13px; color: var(--text-secondary); font-weight: 500;
}
.option-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.option-row input[type="number"] { width: 64px; margin-left: 4px; }

/* ─── Step M2: 슬라이드 목록 + 편집기 ─────────────── */
.step2-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px;
  align-items: start;
}
.slides-sidebar {
  border-right: 1px solid var(--border); padding-right: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.slide-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 6px; cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13px;
}
.slide-row:hover { background: var(--bg-secondary, var(--bg)); }
.slide-row.active {
  background: var(--cn-accent-bg);
  border-left-color: var(--accent);
}
.slide-row .slide-idx { font-weight: 600; color: var(--text-secondary); min-width: 18px; }
.slide-row .slide-type {
  font-size: 11px; padding: 2px 6px; border-radius: 4px;
  background: var(--bg-secondary, var(--bg));
}
.slide-row .slide-headline {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slide-type.type-cover { color: #d4a017; font-weight: 600; }
.slide-type.type-body { color: var(--text-secondary); }
.slide-type.type-closing { color: #5cb85c; font-weight: 600; }

.slide-editor {
  background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 16px;
}
.editor-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.editor-header .editor-actions { display: flex; gap: 6px; }
.editor-header button {
  padding: 4px 10px; border: 1px solid var(--border);
  background: var(--surface, #fff); border-radius: 4px; cursor: pointer;
  font-size: 12px;
}
.editor-header button:disabled { opacity: 0.4; cursor: not-allowed; }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.field input[type="text"],
.field textarea,
.field input[type="datetime-local"],
.field select {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 14px;
  box-sizing: border-box;
}

.texts-editor {
  background: var(--bg-secondary, var(--bg));
  padding: 12px; border-radius: 6px;
}
.text-editor {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.text-editor .text-role {
  min-width: 90px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
}
.text-editor input[type="text"] {
  flex: 1; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 4px; font-size: 13px;
}

.autosave-indicator {
  margin-top: 12px; font-size: 12px; color: var(--cn-muted); text-align: right;
}

/* ─── Step M3: 발행 + 인스타 미리보기 ─────────────── */
.step3-layout {
  display: grid; grid-template-columns: 1fr 380px; gap: 24px;
  align-items: start;
}
.publish-form { display: flex; flex-direction: column; gap: 12px; }
.schedule-field {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px;
}
.schedule-field legend { padding: 0 6px; }
.schedule-field label { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; }
.cn-schedule-input { display: block; margin-top: 8px; }

.preview-pane { position: sticky; top: 16px; }

/* Insta preview widget */
.insta-preview {
  position: relative;
  border: 1px solid #dbdbdb; border-radius: 10px;
  overflow: hidden; background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.insta-preview .insta-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #efefef;
  font-size: 13px;
}
.insta-preview .insta-header .username { font-weight: 600; }
.insta-preview .insta-slide {
  background: #fafafa; padding: 28px;
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
  position: relative;
  min-height: 320px;
}
.insta-preview.aspect-1-1 .insta-slide { aspect-ratio: 1 / 1; }
.insta-preview.aspect-4-5 .insta-slide { aspect-ratio: 4 / 5; }
.insta-preview.aspect-9-16 .insta-slide { aspect-ratio: 9 / 16; }
.insta-preview .slide-text { font-size: 17px; line-height: 1.45; color: #1a1a1a; }
.insta-preview .slide-text.role-headline { font-size: 22px; font-weight: 700; }
.insta-preview .slide-indicator {
  position: absolute; top: 14px; right: 14px;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  padding: 4px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
}
.insta-preview .insta-actions {
  padding: 8px 14px; font-size: 20px; color: #262626;
}
.insta-preview .insta-actions .bookmark { float: right; }
.insta-preview .insta-meta {
  padding: 0 14px 12px; font-size: 12px; color: #8e8e8e;
}
.insta-preview .dots-container {
  display: flex; justify-content: center; gap: 5px;
  padding: 6px 0 12px;
}
.insta-preview .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #cfcfcf; cursor: pointer;
  transition: background 0.15s;
}
.insta-preview .dot.active { background: var(--accent); }
.insta-preview button.prev,
.insta-preview button.next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.92); border: 1px solid #efefef;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 20px; color: #333;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.insta-preview button.prev { left: 10px; }
.insta-preview button.next { right: 10px; }
.insta-preview button.prev:hover,
.insta-preview button.next:hover { background: #fff; }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 960px) {
  .step2-layout, .step3-layout { grid-template-columns: 1fr; }
  .slides-sidebar { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
  .preview-pane { position: static; }
}
