@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─────────────────────────  Reset  ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The HTML `hidden` attribute must always win — author display:flex/grid rules
   would otherwise override the UA default and leave "hidden" elements visible
   (this was the dead "View analysis" CTA + always-on processing banners). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
ul, ol { list-style: none; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Subtle ambient violet glow behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 50% at 50% -10%, rgba(108, 92, 231, 0.10), transparent 70%),
    radial-gradient(40% 40% at 100% 100%, rgba(139, 124, 246, 0.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─────────────────────────  Layout  ───────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 var(--sp-5); width: 100%; }

.main-content { flex: 1 0 auto; padding: var(--sp-10) 0; position: relative; z-index: 1; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

/* ─────────────────────────  Header  ───────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-surface) 80%, transparent);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
}
.logo__img { width: 28px; height: 28px; border-radius: var(--radius-sm); object-fit: contain; flex-shrink: 0; }
.logo__text { display: inline-flex; }
.logo__v { color: var(--violet); }

/* Primary nav (right side) */
.site-nav { display: flex; align-items: center; gap: var(--sp-3); }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); border-color: var(--border-subtle); }
.nav-link svg { color: var(--violet-alt); }
@media (max-width: 480px) {
  .nav-link span { display: none; }   /* icon-only on small screens */
  .nav-link { padding: 0 var(--sp-2); min-width: 44px; justify-content: center; }
}

/* Status pill in the header (per-page) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 30px;
  padding: 0 var(--sp-4);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-display);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.status-pill::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.status-pill--processing { color: var(--warning); border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.10); }
.status-pill--ready      { color: var(--success); border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.10); }
.status-pill--failed     { color: var(--error);   border-color: rgba(239, 68, 68, 0.3);  background: rgba(239, 68, 68, 0.10); }
.status-pill--processing::before { animation: pulse-dot 1.4s ease-in-out infinite; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ─────────────────────────  Footer  ───────────────────────── */
.site-footer {
  flex-shrink: 0;
  margin-top: var(--sp-12);
  padding: var(--sp-10) 0 var(--sp-8);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13.5px;
  position: relative;
  z-index: 1;
}
.site-footer__grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-8); }
.site-footer__col h4 {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  color: var(--text-primary); margin-bottom: var(--sp-3);
  letter-spacing: 0.02em;
}
.site-footer__col h4:not(:first-child) { margin-top: var(--sp-5); }
.site-footer__brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text-primary); margin-bottom: var(--sp-3); }
.site-footer__brand-col p { margin-bottom: var(--sp-2); line-height: 1.6; }
.site-footer__company { color: var(--text-violet); font-weight: 600; }

.site-footer__contact { display: grid; gap: var(--sp-3); }
.site-footer__contact li { display: flex; align-items: flex-start; gap: var(--sp-2); }
.site-footer__contact svg { color: var(--violet-alt); flex-shrink: 0; margin-top: 3px; }
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text-violet); }

.site-footer__links { display: grid; gap: var(--sp-2); }
.site-footer__links a { display: inline-block; min-height: 28px; }

.site-footer__social { display: flex; gap: var(--sp-2); }
.site-footer__social a {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border-subtle);
  color: var(--text-secondary); background: var(--bg-card);
}
.site-footer__social a:hover { color: #fff; background: var(--violet); border-color: var(--violet); }

.site-footer__bottom {
  margin-top: var(--sp-8); padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  text-align: center; color: var(--text-muted); font-size: 13px;
}

@media (min-width: 600px) {
  .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; gap: var(--sp-10); }
}

/* ─────────────────────────  Buttons (shared)  ───────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}
.btn--primary { background: var(--violet); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--violet-alt); box-shadow: var(--violet-glow); }
.btn--ghost { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border-subtle); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--block { width: 100%; }

/* Small icon button (shared) */
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--text-muted); flex-shrink: 0; }
.icon-btn:hover { color: var(--violet-alt); background: var(--bg-hover); }

/* Inline spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────  Form inputs (shared)  ───────────────────────── */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.18s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--violet-glow);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239DA3BE' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-10);
  cursor: pointer;
}
.select option { background: var(--bg-card); color: var(--text-primary); }

/* ─────────────────────────  Transitions / focus / motion  ───────────────────────── */
a, button, input, select, textarea, .card, .clip-card { transition: all 0.18s ease; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─────────────────────────  Scrollbar  ───────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--violet) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: rgba(108, 92, 231, 0.5); border-radius: 999px; border: 2px solid var(--bg-surface); }
::-webkit-scrollbar-thumb:hover { background: var(--violet); }

/* ─────────────────────────  Search field (shared)  ───────────────────────── */
.search-field { position: relative; }
.search-field__icon { position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field .input { min-height: 44px; padding-left: var(--sp-8); }
.no-matches { color: var(--text-muted); font-size: 14px; text-align: center; padding: var(--sp-8) 0; }

/* "View all" expander (shared) */
.view-all-wrap { text-align: center; margin-top: var(--sp-6); }

/* ─────────────────────────  Empty-state illustration (shared)  ───────────────────────── */
.empty-state { text-align: center; padding: var(--sp-10) var(--sp-5); }
.empty-state svg { margin: 0 auto var(--sp-5); display: block; }
.empty-state__title { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--text-primary); margin-bottom: var(--sp-2); }
.empty-state__text { color: var(--text-secondary); font-size: 14px; max-width: 360px; margin: 0 auto var(--sp-5); }

/* ─────────────────────────  Toast  ───────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-width: calc(100vw - 48px);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-5);
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.25s ease;
}
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--error); }
.toast--info    { border-left-color: var(--info); }
.toast.is-leaving { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ─────────────────────────  Breakpoints (mobile-first layering)  ───────────────────────── */
@media (min-width: 481px) {
  body { font-size: 15px; }
}
@media (min-width: 769px) {
  .main-content { padding: var(--sp-12) 0; }
}
