/* SlideStudio v2 스튜디오 UI 스타일 (T4.3) */
:root {
  --bg: #EFECE4;
  --surface: #FBFAF6;
  --surface-alt: #F4F1EA;
  --ink: #1A1915;
  --ink2: #4A4740;
  --ink3: #8A867C;
  --line: #DDD8CC;
  --accent: #C8643B;
  --accent-soft: #F1DDD2;
  --on-accent: #FFFFFF;
  --font-base: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --radius: 12px;
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg);
  color: var(--ink);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 상단 헤더 & 스텝 바 (높이 56px) */
#v2-header {
  height: 56px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  font-size: 12px;
  background: var(--accent);
  color: var(--on-accent);
  padding: 2px 6px;
  border-radius: 6px;
}

#v2-steps {
  display: flex;
  height: 100%;
}

.step-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-btn:hover {
  color: var(--ink);
}

.step-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 메인 작업 영역 */
#v2-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* 왼쪽 대화 패널 (폭 440px) */
#v2-chat {
  width: 440px;
  background-color: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink2);
}

.chat-log {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}

.chat-msg.ai {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
}

.msg-bubble {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--ink);
}

.chat-msg.user .msg-bubble {
  background-color: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* 브리프 입력 도구 패널 */
.brief-panel {
  padding: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--surface);
}

#brief-text {
  width: 100%;
  height: 110px;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff;
  resize: vertical;
}

.brief-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#brief-file {
  display: none;
}

.file-label {
  cursor: pointer;
  font-size: 13px;
}

.file-name {
  font-size: 12px;
  color: var(--ink3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brief-btn-row {
  display: flex;
  gap: 8px;
}

/* 대화 입력창 */
.chat-input-row {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  background-color: var(--surface);
}

#chat-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

#chat-input:focus {
  border-color: var(--accent);
}

/* 버튼 스타일 */
button {
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface-alt);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--ink3);
  font-size: 12px;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--ink);
}

.btn-icon {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* 오른쪽 메인 뷰 컨테이너 */
#v2-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.view-panel {
  display: none;
  flex: 1;
  height: 100%;
  flex-direction: column;
  overflow-y: auto;
  padding: 32px;
}

.view-panel.active {
  display: flex;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.title-wrap h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 14px;
  color: var(--ink3);
}

/* 1단계 브리프 뷰 */
.card-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
}

.questions-box {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.summary-text {
  background: var(--surface-alt);
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  margin: 12px 0 20px 0;
}

.q-item {
  margin-bottom: 16px;
}

.q-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.q-options {
  display: flex;
  gap: 8px;
}

.q-option {
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.q-option.selected {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* 2단계 스토리라인 카드 뷰 */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
  padding-bottom: 60px;
}

.story-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  cursor: grab;
  transition: transform 0.15s, border-color 0.15s;
}

.story-card.dragging {
  opacity: 0.5;
  border-color: var(--accent);
}

.story-card-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink3);
  width: 32px;
}

.story-card-body {
  flex: 1;
}

.story-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--surface-alt);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.story-keyword {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.story-headline {
  font-size: 15px;
  color: var(--ink2);
  line-height: 1.4;
}

.story-card-actions {
  display: flex;
  gap: 6px;
}

/* 3단계 디자인 방향 테마 뷰 */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.theme-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.theme-header {
  margin-bottom: 16px;
}

.theme-header h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.theme-header p {
  font-size: 13px;
  color: var(--ink3);
  margin-bottom: 12px;
}

.theme-preview-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mini-preview-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000;
  position: relative;
}

.mini-preview-wrap section.slide {
  transform-origin: 0 0;
}

/* 4~6단계 에디터 뷰 */
#view-editor {
  padding: 0;
  overflow: hidden;
}

.toolbar {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.tool-group {
  display: flex;
  gap: 6px;
}

.tool-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tool-btn:hover {
  background: var(--surface-alt);
}

.why-text {
  font-size: 13px;
  color: var(--ink3);
}

/* 캔버스 무대 (Stage) */
.stage-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  position: relative;
}

.stage {
  width: 1920px;
  height: 1080px;
  transform-origin: center center;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.build-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(251, 250, 246, 0.95);
  border: 1px solid var(--line);
  padding: 24px 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 15px;
  font-weight: 600;
  z-index: 100;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 썸네일 스트립 */
.thumbs-wrapper {
  height: 110px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  overflow-x: auto;
  flex-shrink: 0;
}

.thumbs {
  display: flex;
  gap: 12px;
  height: 100%;
}

.thumb-item {
  width: 150px;
  height: 84px;
  aspect-ratio: 16 / 9;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  flex-shrink: 0;
  position: relative;
}

.thumb-item.active {
  border-color: var(--accent);
}

.thumb-item section.slide {
  transform: scale(0.078125);
  transform-origin: 0 0;
  pointer-events: none;
}

/* 레이아웃 팝오버 */
.layout-picker {
  position: absolute;
  top: 56px;
  left: 16px;
  width: 480px;
  max-height: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.picker-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
}

.options-grid {
  padding: 16px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.option-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.option-card:hover {
  border-color: var(--accent);
}

.option-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* 린트 패널 */
.lint-panel {
  padding: 12px 24px;
  background: #FFF5F5;
  border-top: 1px solid #FED7D7;
  color: #C53030;
  font-size: 13px;
}

.lint-list {
  margin-top: 6px;
  list-style: square inside;
}

.lint-item {
  cursor: pointer;
  text-decoration: underline;
}
