/* TikTok Product Hunter Pro - UI */
:root {
  --bg: #0d0d0f;
  --bg-card: #16161a;
  --border: #2a2a2e;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --accent: #00f5d4;
  --accent-dim: #00b4a0;
  --danger: #f43f5e;
  --success: #22c55e;
  --radius: 10px;
  --font: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.root {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem 0;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.status {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-height: 1.25rem;
}

.status.loading { color: var(--accent-dim); }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: 0.6rem 1rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(0,245,212,0.06);
}

/* Main */
.main {
  flex: 1;
  min-height: 200px;
}

.panel {
  display: none;
}

.panel.active {
  display: block !important;
  min-height: 180px;
  animation: fadeIn 0.2s ease;
}

/* 선택된 패널은 [hidden]이 있어도 표시 */
.panel.active[hidden] {
  display: block !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.hint {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.form-row label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-row input[type="text"],
.form-row input[type="number"] {
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  min-width: 120px;
}

.form-row input[type="number"] {
  width: 4rem;
}

.form-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  padding: 0.5rem 1rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

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

.btn.primary {
  background: var(--accent);
  color: var(--bg);
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.result-area {
  min-height: 120px;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.result-area .placeholder {
  color: var(--text-muted);
  margin: 0;
}

.result-area pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Result blocks */
.video-list, .opp-list, .trend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.video-list li, .opp-list li, .trend-list li {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.video-list li:last-child, .opp-list li:last-child, .trend-list li:last-child {
  border-bottom: none;
}

.video-item .desc, .opp-item .desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.video-item .meta, .opp-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.video-item a, .opp-item a {
  color: var(--accent);
  text-decoration: none;
}

.video-item a:hover, .opp-item a:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge.viral { background: rgba(124, 58, 237, 0.3); color: #a78bfa; }
.badge.intent { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.badge.margin { background: rgba(0, 245, 212, 0.2); color: var(--accent); }

.saved-files {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.footer code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .root { padding: 1rem; }
  .tabs { flex-wrap: wrap; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row input[type="text"] { min-width: 0; }
}
