/* ============================================================
   studio.css — 스튜디오 앱 전용 스타일
   BEM 접두사: studio-
   A-4 구현 | tokens.css 변수만 참조
   ============================================================ */

/* ── 페이지 ── */
.studio-page {
  padding: var(--nv-sp-6) var(--nv-sp-4);
  max-width: 960px;
  margin: 0 auto;
}

/* ── 탭 바 ── */
.studio-tabs {
  display: flex;
  gap: var(--nv-sp-1);
  background: var(--nv-bg-2);
  border-bottom: 1px solid var(--nv-border);
  margin-bottom: var(--nv-sp-6);
  overflow-x: auto;
  padding: 0 var(--nv-sp-4);
}

.studio-tabs__btn {
  display: flex;
  align-items: center;
  gap: var(--nv-sp-2);
  padding: var(--nv-sp-3) var(--nv-sp-4);
  font-size: var(--nv-text-sm);
  font-weight: var(--nv-fw-medium);
  font-family: var(--nv-font);
  color: var(--nv-text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--nv-tr-fast), border-color var(--nv-tr-fast);
}

.studio-tabs__btn:hover {
  color: var(--nv-text-2);
}

.studio-tabs__btn--active {
  color: var(--nv-primary);
  border-bottom-color: var(--nv-primary);
}

.studio-tabs__badge {
  font-size: var(--nv-text-xs);
  background: var(--nv-bg-3);
  color: var(--nv-text-3);
  border-radius: var(--nv-r-full);
  padding: 1px var(--nv-sp-2);
}

.studio-tabs__btn--active .studio-tabs__badge {
  background: rgba(108,99,255,0.15);
  color: var(--nv-primary);
}

/* ── 탭 패널 ── */
.studio-panel {
  display: none;
}

.studio-panel--active {
  display: block;
}

/* ── KPD 폼 ── */
.studio-form {
  background: var(--nv-bg-2);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-r-xl);
  padding: var(--nv-sp-6);
  margin-bottom: var(--nv-sp-4);
}

.studio-form__row {
  display: flex;
  flex-direction: column;
  gap: var(--nv-sp-2);
  margin-bottom: var(--nv-sp-4);
}

.studio-form__row:last-child {
  margin-bottom: 0;
}

.studio-form__label {
  font-size: var(--nv-text-sm);
  font-weight: var(--nv-fw-medium);
  color: var(--nv-text-2);
}

.studio-form__input,
.studio-form__textarea,
.studio-form__select {
  width: 100%;
  padding: var(--nv-sp-3) var(--nv-sp-4);
  font-size: var(--nv-text-sm);
  font-family: var(--nv-font);
  color: var(--nv-text);
  background: var(--nv-bg-3);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-r-md);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--nv-tr-fast), box-shadow var(--nv-tr-fast);
}

.studio-form__input:focus,
.studio-form__textarea:focus,
.studio-form__select:focus {
  border-color: var(--nv-primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.18);
}

.studio-form__textarea {
  min-height: 100px;
  resize: vertical;
}

/* ── 장르/채널 선택 그리드 ── */
.studio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--nv-sp-2);
}

.studio-grid__item {
  padding: var(--nv-sp-3);
  background: var(--nv-bg-3);
  border: 2px solid var(--nv-border);
  border-radius: var(--nv-r-lg);
  cursor: pointer;
  text-align: left;
  font-size: var(--nv-text-sm);
  font-family: var(--nv-font);
  color: var(--nv-text-2);
  transition: all var(--nv-tr-fast);
}

.studio-grid__item:hover {
  border-color: var(--nv-primary);
  color: var(--nv-text);
}

.studio-grid__item--selected {
  border-color: var(--nv-primary);
  background: rgba(108,99,255,0.08);
  color: var(--nv-primary);
}

/* ── 진행 상태 타임라인 ── */
.studio-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: var(--nv-sp-4);
}

.studio-timeline__step {
  display: flex;
  gap: var(--nv-sp-3);
  position: relative;
}

.studio-timeline__step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--nv-border);
}

.studio-timeline__dot {
  width: 24px;
  height: 24px;
  border-radius: var(--nv-r-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--nv-text-xs);
  font-weight: var(--nv-fw-bold);
  background: var(--nv-bg-3);
  border: 1px solid var(--nv-border);
  z-index: var(--z-base);
  transition: all var(--nv-tr-fast);
}

.studio-timeline__step--pending  .studio-timeline__dot { color: var(--nv-text-3); }
.studio-timeline__step--active   .studio-timeline__dot { background: var(--nv-primary); border-color: var(--nv-primary); color: var(--nv-text); }
.studio-timeline__step--done     .studio-timeline__dot { background: rgba(76,175,80,0.15); border-color: var(--nv-success); color: var(--nv-success); }
.studio-timeline__step--error    .studio-timeline__dot { background: rgba(244,67,54,0.15); border-color: var(--nv-error); color: var(--nv-error); }

.studio-timeline__body {
  flex: 1;
  padding-bottom: var(--nv-sp-4);
}

.studio-timeline__name {
  font-size: var(--nv-text-sm);
  font-weight: var(--nv-fw-medium);
  color: var(--nv-text);
  padding-top: var(--nv-sp-1);
}

.studio-timeline__detail {
  font-size: var(--nv-text-xs);
  color: var(--nv-text-3);
  margin-top: var(--nv-sp-1);
  font-family: var(--nv-font-mono);
}

/* ── 작업 히스토리 ── */
.studio-history {
  display: flex;
  flex-direction: column;
  gap: var(--nv-sp-2);
}

.studio-history__item {
  display: flex;
  align-items: center;
  gap: var(--nv-sp-3);
  padding: var(--nv-sp-3) var(--nv-sp-4);
  background: var(--nv-bg-2);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-r-lg);
  cursor: pointer;
  transition: background var(--nv-tr-fast);
}

.studio-history__item:hover {
  background: var(--nv-bg-3);
}

.studio-history__thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--nv-r-md);
  background: var(--nv-bg-3);
  flex-shrink: 0;
  object-fit: cover;
}

.studio-history__info {
  flex: 1;
  min-width: 0;
}

.studio-history__title {
  font-size: var(--nv-text-sm);
  font-weight: var(--nv-fw-medium);
  color: var(--nv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-history__meta {
  font-size: var(--nv-text-xs);
  color: var(--nv-text-3);
  margin-top: var(--nv-sp-1);
}

.studio-history__status {
  font-size: var(--nv-text-xs);
  font-weight: var(--nv-fw-medium);
  padding: var(--nv-sp-1) var(--nv-sp-2);
  border-radius: var(--nv-r-full);
  flex-shrink: 0;
}

.studio-history__status--done    { background: rgba(76,175,80,0.12); color: var(--nv-success); }
.studio-history__status--running { background: rgba(33,150,243,0.12); color: var(--nv-info); }
.studio-history__status--failed  { background: rgba(244,67,54,0.12); color: var(--nv-error); }
.studio-history__status--pending { background: var(--nv-bg-3); color: var(--nv-text-3); }

/* ── 쇼츠 — 토론 미리보기 패널 ── */
.studio-debate {
  background: var(--nv-bg-2);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-r-xl);
  overflow: hidden;
}

.studio-debate__header {
  padding: var(--nv-sp-4) var(--nv-sp-5);
  border-bottom: 1px solid var(--nv-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-debate__topic {
  font-size: var(--nv-text-base);
  font-weight: var(--nv-fw-semibold);
  color: var(--nv-text);
}

.studio-debate__chars {
  display: flex;
  flex-direction: column;
  gap: var(--nv-sp-2);
  padding: var(--nv-sp-4) var(--nv-sp-5);
}

.studio-debate__line {
  display: flex;
  gap: var(--nv-sp-3);
  align-items: flex-start;
}

.studio-debate__avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--nv-r-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--nv-text-xs);
  font-weight: var(--nv-fw-bold);
  color: var(--nv-text);
}

.studio-debate__avatar--claude   { background: rgba(108,99,255,0.3); }
.studio-debate__avatar--gpt     { background: rgba(0,210,200,0.3); }
.studio-debate__avatar--gemini  { background: rgba(255,193,7,0.25); }
.studio-debate__avatar--grok    { background: rgba(255,107,107,0.25); }
.studio-debate__avatar--pplx    { background: rgba(120,193,243,0.3); }

.studio-debate__bubble {
  flex: 1;
  padding: var(--nv-sp-3);
  background: var(--nv-bg-3);
  border-radius: 0 var(--nv-r-lg) var(--nv-r-lg) var(--nv-r-lg);
  font-size: var(--nv-text-xs);
  color: var(--nv-text-2);
  line-height: var(--nv-lh-relaxed);
}

/* ── 라이트 테마 ── */
[data-theme="light"] .studio-form,
[data-theme="light"] .studio-history__item,
[data-theme="light"] .studio-debate {
  background: var(--nv-surface);
}

[data-theme="light"] .studio-grid__item,
[data-theme="light"] .studio-form__input,
[data-theme="light"] .studio-form__textarea,
[data-theme="light"] .studio-form__select {
  background: var(--nv-bg-2);
}

/* ── 반응형 ── */
@media (min-width: 480px) {
  .studio-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .studio-page {
    padding: var(--nv-sp-8) var(--nv-sp-6);
  }

  .studio-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
