/* ==========================================================================
   TubeInsight — 보조 스타일시트
   Tailwind(vendor/tailwind.js)가 처리하지 못하는 상태 클래스·마크다운 서식·컴포넌트
   ========================================================================== */

:root {
  --ink: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --soft: #F7F7F8;
  --ok: #059669;
  --warn: #B45309;
  --bad: #DC2626;
}

body {
  background-color: #FAFAFA;
  color: var(--ink);
  font-family: 'Pretendard Variable', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── 카드 ── */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: #C9CDD3; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05); }
.card-title {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.subtle-box { background: var(--soft); border: 1px solid #EEF0F2; border-radius: 8px; }

/* ── 입력 ── */
.input {
  background: #fff; border: 1px solid var(--line); color: var(--ink); border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: #000; box-shadow: 0 0 0 1px #000; outline: none; }
.select { background: transparent; font-weight: 600; color: #000; outline: none; cursor: pointer; max-width: 260px; }
.opt { display: flex; align-items: center; gap: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.opt > span:first-child { color: var(--muted); white-space: nowrap; }

/* ── 버튼 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; font-weight: 600; font-size: 12px; padding: 7px 12px; border: 1px solid transparent; transition: all .15s ease; white-space: nowrap; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #000; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #262626; }
.btn-ghost { background: #fff; color: #374151; border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: #000; color: #000; }
.btn-danger { background: #fff; color: var(--bad); border-color: #FECACA; }
.btn-danger:hover:not(:disabled) { background: #FEF2F2; }
.btn-accent { background: #DC2626; color: #fff; }
.btn-accent:hover:not(:disabled) { background: #B91C1C; }
.btn-lg { font-size: 14px; padding: 11px 22px; border-radius: 10px; }
.btn .spin { animation: spin .9s linear infinite; }

/* ── 모드 전환 / 탭 ── */
.mode-btn { color: #525252; }
.mode-btn:hover { color: #000; }
.mode-btn.active { background: #000; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mode-btn .step-no { font-family: 'JetBrains Mono', monospace; font-size: 10px; opacity: .7; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-btn { color: #525252; }
.tab-btn:hover { color: #000; background: #F5F5F5; }
.tab-btn.active { background: #000; color: #fff; }
.tab-btn.active:hover { background: #171717; }

.chip { border: 1px solid var(--line); background: #fff; color: #374151; border-radius: 6px; padding: 3px 10px; font-size: 12px; transition: all .15s ease; }
.chip:hover, .chip.active { border-color: #000; color: #000; }
.chip.active { font-weight: 700; }

/* ── 상태 배지 (헤더) ── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-family: 'JetBrains Mono', monospace; border: 1px solid var(--line); background: #FAFAFA; color: #9CA3AF; cursor: pointer; transition: all .15s ease; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 999px; background: #D1D5DB; }
.pill.online { color: #4B5563; }
.pill.online .dot { background: var(--ok); }
.pill.active { background: #fff; border-color: #000; color: #000; font-weight: 600; }
.pill.active .dot { animation: pulse 1.6s ease-in-out infinite; }
.pill.nomodel .dot { background: #F59E0B; }
.pill.chosen-offline { border-color: #F87171; color: var(--bad); }
.pill.chosen-offline .dot { background: var(--bad); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ── 작은 배지 ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid var(--line); background: #F4F5F7; color: #4B5563; white-space: nowrap; }
.badge-ok { background: #ECFDF5; border-color: #A7F3D0; color: #047857; }
.badge-warn { background: #FFFBEB; border-color: #FDE68A; color: var(--warn); }
.badge-bad { background: #FEF2F2; border-color: #FECACA; color: var(--bad); }
.badge-red { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }
.badge-mono { font-family: 'JetBrains Mono', monospace; font-weight: 500; }

/* ── 진행 표시 ── */
.progress-track { width: 100%; height: 4px; background: #EEF0F2; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: #000; transition: width .4s ease; }
.step-item { color: #9CA3AF; transition: color .2s ease; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.step-item.active { color: #000; font-weight: 700; }
.step-item.done { color: var(--ok); }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .9s linear infinite; }

/* ── 알림 박스 ── */
.notice { border-radius: 10px; padding: 10px 14px; font-size: 12px; display: flex; gap: 10px; align-items: flex-start; }
.notice-warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.notice-bad { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.notice-info { background: #F0F9FF; border: 1px solid #BAE6FD; color: #0C4A6E; }
.notice-ok { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }

/* ── 감정 막대 ── */
.sentiment-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #EEF0F2; }
.sentiment-bar > span { display: block; height: 100%; }

/* ── 자막 뷰어 ── */
.transcript-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; background: #FAFAFA; border: 1px solid #F0F0F0; border-radius: 8px; transition: border-color .15s ease; }
.transcript-row:hover { border-color: #C4C7CC; }
.transcript-row.highlight { background: #FEF3C7; border-color: #F59E0B; }
.time-badge { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; color: #525252; background: #fff; border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; transition: all .15s ease; }
.time-badge svg { width: 11px; height: 11px; }
a.time-badge:hover { background: #000; color: #fff; border-color: #000; }
.transcript-text { color: #404040; line-height: 1.6; flex: 1; }

/* ── 코드 박스 ── */
.code-box { background: #111318; color: #D1FAE5; border-radius: 10px; padding: 14px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; line-height: 1.6; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.code-box.light { background: #fff; color: #1F2937; border: 1px solid var(--line); }

/* ── 씬 미디어 슬롯 (③ 제작) ── */
.dropzone { border: 1.5px dashed #C9CDD3; border-radius: 10px; background: #FAFAFA; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; color: #9CA3AF; font-size: 12px; cursor: pointer; transition: all .15s ease; position: relative; overflow: hidden; }
.dropzone:hover, .dropzone.over { border-color: #000; color: #000; background: #fff; }
.dropzone img, .dropzone video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone .media-tag { position: absolute; top: 6px; left: 6px; z-index: 2; }
.dropzone .media-remove { position: absolute; top: 6px; right: 6px; z-index: 2; }

/* ── 모달 ── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); z-index: 999; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-panel { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 560px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.2); max-height: 90vh; overflow: auto; }

/* ── 녹음 펄스 ── */
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(255,0,0,.4) } 50% { box-shadow: 0 0 0 8px rgba(255,0,0,.12) } }
.recording-red { animation: pulse-red 1.2s infinite ease-in-out; }

/* ── 토스트 ── */
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; background: #000; color: #fff; border-radius: 8px; padding: 12px 18px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); display: flex; align-items: center; gap: 8px; opacity: 0; transform: translateY(12px); transition: all .25s ease; pointer-events: none; max-width: 420px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #B91C1C; }

/* ── 마크다운 렌더 서식 ── */
.md { line-height: 1.65; overflow-x: auto; }
.md h1, .md h2 { font-size: 1.1em; font-weight: 800; color: #000; margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 1.02em; font-weight: 700; color: #000; margin: 14px 0 6px; }
.md h4 { font-weight: 700; color: #171717; margin: 10px 0 4px; }
.md p { margin-bottom: 8px; }
.md ul, .md ol { margin: 4px 0 10px 18px; }
.md ul { list-style: disc; } .md ol { list-style: decimal; }
.md li { margin-bottom: 4px; }
.md strong { font-weight: 700; color: #000; }
.md blockquote { border-left: 3px solid #000; background: #FAFAFA; padding: 8px 12px; margin: 10px 0; border-radius: 0 6px 6px 0; }
.md code { font-family: 'JetBrains Mono', monospace; font-size: .9em; background: #F4F5F7; border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
.md pre { background: #F4F5F7; border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; margin: 8px 0; }
.md pre code { border: none; background: transparent; padding: 0; }
.md table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: .95em; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { background: #FAFAFA; font-weight: 700; color: #000; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md a { color: #000; text-decoration: underline; }

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ── 추가 제작 스타일 (3단계 고도화) ── */
.cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  color: #92400E;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.badge-purple {
  background: #F3E8FF;
  border-color: #E9D5FF;
  color: #7E22CE;
}
.auto-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
  border: 1.5px solid #111827;
}

/* ── 4단계: 멀티채널 마케팅 & SNS 스튜디오 스타일 ── */
.thread-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
  position: relative;
}
.thread-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.thread-card.role-hook {
  border-left: 4px solid #38BDF8;
  background: linear-gradient(135deg, #F0F9FF 0%, #FFFFFF 100%);
}
.thread-card.role-cta {
  border-left: 4px solid #818CF8;
  background: linear-gradient(135deg, #EEF2FF 0%, #FFFFFF 100%);
}
.thread-index-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0F172A;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}
.char-count-badge {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.char-count-badge.ok {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}
.char-count-badge.warn {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.char-count-badge.danger {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #F1F5F9;
  color: #0284C7;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.15s ease;
}
.hashtag-chip:hover {
  background: #E0F2FE;
  border-color: #BAE6FD;
  transform: translateY(-1px);
}

.subject-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.15s ease;
}
.subject-item-card:hover {
  border-color: #A855F7;
  background: #FAF5FF;
}

/* 블로그 렌더러 타이포그래피 */
#blogRenderedViewer h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0F172A;
  margin-top: 1.2rem;
  margin-bottom: 0.8rem;
  line-height: 1.3;
}
#blogRenderedViewer h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1E293B;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 0.3rem;
}
#blogRenderedViewer h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #334155;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
#blogRenderedViewer p {
  margin-bottom: 0.9rem;
  line-height: 1.75;
  color: #334155;
}
#blogRenderedViewer ul, #blogRenderedViewer ol {
  margin-bottom: 0.9rem;
  padding-left: 1.4rem;
}
#blogRenderedViewer li {
  margin-bottom: 0.3rem;
  line-height: 1.6;
}
#blogRenderedViewer blockquote {
  border-left: 4px solid #6366F1;
  background: #F8FAFC;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
  color: #1E293B;
  font-size: 0.92rem;
}
#blogRenderedViewer strong {
  color: #0F172A;
  font-weight: 700;
}
#blogRenderedViewer code {
  background: #F1F5F9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

/* ── 0단계: 유튜브 채널 세팅 스튜디오 스타일 ── */
.handle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  transition: all 0.15s ease;
}
.handle-card.available {
  border-color: #86EFAC;
  background: #F0FDF4;
}
.handle-card.taken {
  border-color: #FECACA;
  background: #FEF2F2;
}
.handle-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
}
.handle-status-badge.available {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
}
.handle-status-badge.taken {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.avatar-preview-box {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #E2E8F0;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.avatar-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #1E293B;
  border: 1px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner-safe-zone-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 29.3%;
  border: 1.5px dashed rgba(255, 255, 255, 0.8);
  background: rgba(99, 102, 241, 0.15);
  border-radius: 6px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.step-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  transition: all 0.15s ease;
}
.step-checklist-item:hover {
  border-color: #CBD5E1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.step-checklist-item.completed {
  background: #F8FAFC;
  opacity: 0.75;
}
.step-checklist-item.completed span {
  text-decoration: line-through;
  color: #94A3B8;
}

/* ── 접근성·모션 ── */
:focus-visible { outline: 2px solid #000; outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

