/* ============================================================================
   Moart 상세페이지 스튜디오 — 우측 완성 샘플 쇼케이스 (2단 Sticky 레이아웃)
   - 데스크톱(1100px+): 좌측 입력 폼(64%) + 우측 Sticky 쇼케이스(34%)
   - 태블릿/모바일(<=1100px): 상단 접힘 바 자동 전환
   - 라이트/다크 모드 완벽 대응
   ============================================================================ */
.moart-ds-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: stretch;
}
.moart-ds-shell.is-rail-hidden {
  grid-template-columns: minmax(0, 1fr);
}
.moart-ds-shell.is-rail-hidden > .moart-ds-rail {
  display: none !important;
}
.moart-ds-shell > #inputPanel {
  min-width: 0;
}
/* 우측 샘플 레일이 있는 2단 레이아웃에서는 좌측 Step 1 카드들을 1열 풀폭(700px+)으로 정렬해 버튼 줄바꿈과 빈 공간을 제거 */
.moart-ds-shell:not(.is-rail-hidden) .workflow-photo-layout {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 14px !important;
}
.moart-ds-shell:not(.is-rail-hidden) .c45-step[data-wizard-step="1"].is-freeform {
  grid-template-columns: minmax(0, 1fr) !important;
}

.moart-ds-rail {
  min-width: 0;
  height: 100%;
  border-radius: 16px;
  border: 1px solid rgba(79, 70, 229, 0.24);
  background: var(--bg-surface, #ffffff);
  box-shadow: 0 8px 28px -12px rgba(79, 70, 229, 0.16), 0 2px 6px rgba(15, 23, 42, 0.04);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}
html[data-theme="dark"] .moart-ds-rail {
  border-color: rgba(129, 140, 248, 0.32);
  background: var(--bg-surface, #111827);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
}

.moart-ds-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.moart-ds-rail__title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary, #0f172a);
}
.moart-ds-rail__head-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.moart-ds-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
html[data-theme="dark"] .moart-ds-live-pill {
  background: rgba(129, 140, 248, 0.18);
  color: #a5b4fc;
}
.moart-ds-live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f46e5;
  display: inline-block;
  animation: moartDsPulse 1.6s ease-in-out infinite;
}
.moart-ds-live-pill.is-paused {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-secondary, #64748b);
}
.moart-ds-live-pill.is-paused i {
  background: #94a3b8;
  animation: none;
}
@keyframes moartDsPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.moart-ds-collapse-btn {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-default, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
  color: var(--text-primary, #0f172a);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.moart-ds-rail__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* 카테고리 4종 탭 */
.moart-ds-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.moart-ds-tab {
  height: 32px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border-default, #e2e8f0);
  background: var(--bg-subtle, #f1f5f9);
  color: var(--text-secondary, #475569);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.moart-ds-tab:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}
.moart-ds-tab.is-active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
}

/* 프리뷰 뷰포트 (좌측 입력 패널 높이에 자동 맞춤 + 스무스 스크롤) */
.moart-ds-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 380px;
  border-radius: 12px;
  border: 1px solid var(--border-default, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
  overflow: hidden;
}
.moart-ds-viewport {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.45) transparent;
  background: #ffffff;
}
.moart-ds-viewport::-webkit-scrollbar {
  width: 5px;
}
.moart-ds-viewport::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 999px;
}
.moart-ds-media-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.moart-ds-media-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0f172a;
}

.moart-ds-fade-bottom {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.22) 100%);
}

.moart-ds-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}
.moart-ds-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease;
}
.moart-ds-ctrl-btn:hover {
  background: rgba(15, 23, 42, 0.94);
  transform: translateY(-1px);
}

.moart-ds-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary, #0f172a);
}
.moart-ds-meta strong {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.moart-ds-meta span {
  font-size: 11px;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
}

.moart-ds-help {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-secondary, #64748b);
  text-align: center;
}

.moart-ds-chips {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 4px;
}
.moart-ds-chips span {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-default, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
  color: var(--text-primary, #334155);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* 전체 확대 보기 라이트박스 모달 */
.moart-ds-lightbox {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100dvh - 36px);
  padding: 0;
  border: 1px solid var(--border-default, #e2e8f0);
  border-radius: 16px;
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #0f172a);
  overflow: hidden;
}
.moart-ds-lightbox::backdrop {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}
.moart-ds-lightbox__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default, #e2e8f0);
}
.moart-ds-lightbox__head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}
.moart-ds-lightbox__close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-default, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
  color: var(--text-primary, #0f172a);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.moart-ds-lightbox__body {
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-subtle, #f1f5f9);
}
.moart-ds-lightbox__body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* 태블릿/모바일(<=1100px): 상단 접힘 바 자동 전환 */
@media (max-width: 1100px) {
  .moart-ds-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .moart-ds-rail {
    position: static;
    order: -1;
    padding: 12px 14px;
  }
  .moart-ds-collapse-btn {
    display: inline-flex;
  }
  .moart-ds-rail.is-collapsed .moart-ds-rail__body {
    display: none;
  }
  .moart-ds-stage {
    flex: none;
    height: 320px;
    min-height: 320px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .moart-ds-live-pill i {
    animation: none;
  }
}
