@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ============================================================
   VideoQC Design System — Frame.io Inspired
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Surface hierarchy (darkest → lightest) */
  --surface-0: #090b0b;
  --surface-1: #0e1110;
  --surface-2: #141817;
  --surface-3: #1a1f1d;
  --surface-4: #232a27;

  /* Borders */
  --border: rgba(232, 240, 235, 0.09);
  --border-hover: rgba(232, 240, 235, 0.17);
  --border-active: rgba(185, 242, 39, 0.36);

  /* Text hierarchy */
  --text-primary: #f1f5f2;
  --text-secondary: #929b97;
  --text-tertiary: #65706b;
  --text-disabled: #454d49;

  /* Signal accent — shared with the marketing site */
  --accent: #b9f227;
  --accent-hover: #cdfa58;
  --accent-contrast: #11150b;
  --accent-muted: rgba(185, 242, 39, 0.10);
  --accent-glow: rgba(185, 242, 39, 0.18);

  /* Semantic colors */
  --success: #34d399;
  --success-muted: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --warning-muted: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-muted: rgba(248, 113, 113, 0.15);
  --info: #60a5fa;
  --info-muted: rgba(96, 165, 250, 0.15);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Typography */
  --font-sans: 'Manrope', sans-serif;
  --font-display: 'Space Grotesk', 'Manrope', sans-serif;
  --font-mono: 'Space Grotesk', 'SF Mono', monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Z-index scale */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-overlay: 40;
  --z-modal: 50;
  --z-toast: 100;

  /* Legacy aliases (backward compat with existing inline styles) */
  --accent-primary: var(--accent);
  --border-color: var(--border);
}

/* --- Base Reset --- */
body {
  font-family: var(--font-sans);
  background-color: var(--surface-0);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* --- Scrollbar (Frame.io style: ultra-thin, auto-hide) --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* --- Selection --- */
::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}

/* ============================================================
   Animations
   ============================================================ */

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
}

.animate-fade-in-slow {
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

/* Fade In Up */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

/* Fade In Down */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-down {
  animation: fadeInDown var(--duration-slow) var(--ease-out) forwards;
}

/* Slide In Left */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-slide-in-left {
  animation: slideInLeft var(--duration-slow) var(--ease-out) forwards;
}

/* Slide In Right */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-slide-in-right {
  animation: slideInRight var(--duration-slow) var(--ease-out) forwards;
}

/* Scale In */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.animate-scale-in {
  animation: scaleIn var(--duration-normal) var(--ease-out) forwards;
}

/* Pop In */
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.85); }
  70% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

.animate-pop-in {
  animation: popIn var(--duration-normal) var(--ease-out) forwards;
}

/* Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-shimmer {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.02) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Glow Pulse */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 4px var(--accent-glow); }
  50% { box-shadow: 0 0 16px var(--accent-glow); }
}

.animate-glow-pulse {
  animation: glowPulse 2s var(--ease-in-out) infinite;
}

/* Float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-float {
  animation: float 3s var(--ease-in-out) infinite;
}

/* Marquee */
@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.animate-marquee {
  animation: marquee 12s linear infinite;
}

/* ============================================================
   Animation Delays
   ============================================================ */
.animation-delay-100 { animation-delay: 0.1s; }
.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-300 { animation-delay: 0.3s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-500 { animation-delay: 0.5s; }

/* ============================================================
   Transitions & Hover Effects
   ============================================================ */
.transition-smooth {
  transition: all var(--duration-normal) var(--ease-in-out);
}

.hover-lift {
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.hover-glow {
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

/* ============================================================
   Staggered Children
   ============================================================ */
.stagger-children > *:nth-child(1) { animation-delay: 0.04s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.16s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.28s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.32s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.36s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.40s; }

/* ============================================================
   VideoQC Signal — authenticated application shell
   ============================================================ */
.app-shell {
  background:
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    var(--surface-0);
  background-size: 64px 64px;
}

.app-frame { isolation: isolate; }

.app-frame::before {
  content: '';
  width: 560px;
  height: 560px;
  position: fixed;
  right: -320px;
  top: -260px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 242, 39, 0.08), transparent 70%);
  pointer-events: none;
}

.app-sidebar {
  box-shadow: 16px 0 50px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

.app-sidebar nav button,
.app-sidebar > div:last-child button {
  transition: color 180ms ease, background 180ms ease, transform 180ms ease !important;
}

.app-sidebar nav button:hover { transform: translateX(2px); }

.app-logo {
  position: relative;
  color: var(--accent-contrast) !important;
}

.app-logo::after {
  content: '';
  width: 5px;
  height: 5px;
  position: absolute;
  right: -2px;
  top: -2px;
  border: 2px solid var(--surface-1);
  border-radius: 50%;
  background: var(--success);
}

.app-main { position: relative; }

.app-content { animation: app-content-enter 450ms cubic-bezier(0.16, 1, 0.3, 1) both; }

.app-content h1,
.app-content h2,
.app-content h3 { font-family: var(--font-display); }

.app-content h1 { letter-spacing: -0.035em; }

.app-content select,
.app-content input,
.app-content textarea,
.app-content button { font-family: var(--font-sans); }

.app-content select {
  color: var(--text-primary);
  background-color: var(--surface-2);
}

.app-content table,
.app-content [role='table'] { border-color: var(--border); }

.signal-card {
  background: linear-gradient(145deg, rgba(20, 24, 23, 0.98), rgba(14, 17, 16, 0.98)) !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12) !important;
}

.signal-card:hover { box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2) !important; }

.signal-input {
  background: rgba(10, 13, 12, 0.82) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.signal-primary {
  color: var(--accent-contrast) !important;
  font-weight: 700 !important;
  box-shadow: 0 10px 24px var(--accent-glow) !important;
}

.signal-primary:hover { transform: translateY(-1px); }

.signal-kpi {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(20, 24, 23, 0.96), rgba(13, 16, 15, 0.96)) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.signal-kpi::after {
  content: '';
  width: 90px;
  height: 90px;
  position: absolute;
  right: -52px;
  bottom: -58px;
  border: 16px solid rgba(185, 242, 39, 0.035);
  border-radius: 50%;
}

.signal-project-card {
  background: linear-gradient(150deg, rgba(20, 24, 23, 0.98), rgba(12, 15, 14, 0.98)) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
}

.signal-project-row { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); }

.signal-search {
  background: rgba(12, 15, 14, 0.92) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.screen-eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font: 700 9px var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.screen-title {
  font-family: var(--font-display) !important;
  font-size: clamp(24px, 2.5vw, 34px) !important;
  font-weight: 600 !important;
  letter-spacing: -0.045em !important;
}

.app-bottom-nav {
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
}

@keyframes app-content-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767px) {
  .app-shell { background-size: 44px 44px; }
  .app-frame::before { width: 360px; height: 360px; right: -260px; top: -180px; }
  .app-content { animation-duration: 300ms; }
}

@media (prefers-reduced-motion: reduce) {
  .app-content { animation: none; }
  .app-sidebar nav button:hover { transform: none; }
}
