/* shadcn/ui Zinc Design System Tokens */
:root {
  --background: #fafafa;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --primary-hover: #27272a;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --accent: #f4f4f5;
  --destructive: #ef4444;
  --destructive-bg: #fef2f2;
  --destructive-border: #fecaca;
  --destructive-text: #b91c1c;
  --success: #16a34a;
  --ring: #18181b;
  --radius: 0.5rem;
  --shadow-xs: 0 1px 2px 0 rgba(9, 9, 11, 0.04);
}

html.dark {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #09090b;
  --card-foreground: #fafafa;
  --muted: #18181b;
  --muted-foreground: #a1a1aa;
  --border: #27272a;
  --input: #27272a;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --primary-hover: #e4e4e7;
  --secondary: #18181b;
  --secondary-foreground: #fafafa;
  --accent: #18181b;
  --destructive: #ef4444;
  --destructive-bg: rgba(127, 29, 29, 0.25);
  --destructive-border: rgba(239, 68, 68, 0.4);
  --destructive-text: #fca5a5;
  --success: #22c55e;
  --ring: #d4d4d8;
  --shadow-xs: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.brand-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: color 0.15s, background-color 0.15s;
}

.nav-link:hover {
  color: var(--foreground);
  background: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hero-pill {
  font-size: 0.75rem;
}

.hero-title {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0;
  max-width: 560px;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
}

/* Card */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.card-compact {
  padding: 16px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.muted-caption {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

/* Segmented Tabs */
.segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.seg-btn:hover {
  color: var(--foreground);
}

.seg-btn.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
}

/* Form & Inputs */
.extract-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-wrapper {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
}

.input-lead-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 36px;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-plain {
  padding-left: 12px;
  padding-right: 12px;
  height: 38px;
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 14%, transparent);
}

.clear-btn {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.clear-btn:hover {
  color: var(--foreground);
  background: var(--muted);
}

.clear-btn svg {
  width: 14px;
  height: 14px;
}

.form-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  min-width: 112px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--accent);
  color: var(--foreground);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 0.8125rem;
  min-width: auto;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

.helper-text {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.helper-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--muted);
  color: var(--foreground);
}

/* Accordion */
.accordion {
  margin-top: 2px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.accordion-trigger {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
}

.accordion-trigger::-webkit-details-marker {
  display: none;
}

.accordion-trigger:hover {
  color: var(--foreground);
}

.chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 0.15s;
}

details[open] > .accordion-trigger .chevron {
  transform: rotate(180deg);
}

.accordion-content {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 0.8125rem;
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  cursor: pointer;
}

/* Alert */
.alert {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
}

.alert-destructive {
  background: var(--destructive-bg);
  border: 1px solid var(--destructive-border);
  color: var(--destructive-text);
}

/* Result */
.result-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 640px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

.preview-frame {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #09090b;
  overflow: hidden;
  margin: 0 auto;
}

.preview-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.result-body {
  min-width: 0;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
}

.badge-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.badge-outline {
  background: transparent;
  color: var(--muted-foreground);
  border-color: var(--border);
}

.badge-fb {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

html.dark .badge-fb {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
}

.badge-tiktok {
  background: #fdf2f8;
  color: #be185d;
  border-color: #fbcfe8;
}

html.dark .badge-tiktok {
  background: rgba(236, 72, 153, 0.18);
  color: #f9a8d4;
  border-color: rgba(236, 72, 153, 0.35);
}

.result-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.result-author {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.separator {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.section-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quality-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
}

.quality-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.quality-desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.quality-tag.fhd {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

html.dark .quality-tag.fhd {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.quality-tag.hd {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

html.dark .quality-tag.hd {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
}

.quality-tag.mp3 {
  background: #faf5ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}

html.dark .quality-tag.mp3 {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.35);
}

.quality-tag.wm {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

html.dark .quality-tag.wm {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

.quality-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* History */
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-head .section-label {
  margin-bottom: 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  cursor: pointer;
  transition: background-color 0.15s;
}

.history-item:hover {
  background: var(--accent);
}

.history-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.history-title {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-action {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* SEO Content Sections */
.seo-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

.section-heading {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 700px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.feature-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--muted);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.feature-icon svg {
  width: 16px;
  height: 16px;
}

.step-num {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.card-copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.55;
}

.faq-card {
  padding: 6px 20px;
}

.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item .accordion-trigger {
  color: var(--foreground);
  font-size: 0.875rem;
}

.faq-answer {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-copy {
  margin: 0;
  font-size: 0.8125rem;
}

.footer-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Spinner */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--primary-foreground) 35%, transparent);
  border-top-color: var(--primary-foreground);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.hidden {
  display: none !important;
}
