/* ==========================================================================
   QuickPDFHubPro — Premium Design System
   Complements Tailwind (utility classes) with the custom 3D / glass / motion
   layer that Tailwind's core utilities can't express: glassmorphism, gradient
   mesh backgrounds, floating motion, tilt, blobs, noise texture, custom
   scrollbars and print-safe fallbacks.
   ========================================================================== */

:root {
  --color-primary: #4F46E5;
  --color-primary-rgb: 79, 70, 229;
  --color-secondary: #7C3AED;
  --color-secondary-rgb: 124, 58, 237;
  --color-accent: #06B6D4;
  --color-accent-rgb: 6, 182, 212;
  --color-success: #10B981;
  --color-success-rgb: 16, 185, 129;
  --color-bg: #F8FAFC;
  --color-dark: #0F172A;
  --color-dark-rgb: 15, 23, 42;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-float: 0 20px 60px -12px rgba(79, 70, 229, 0.25);
  --shadow-glow-primary: 0 0 40px rgba(79, 70, 229, 0.35);
  --shadow-glow-accent: 0 0 40px rgba(6, 182, 212, 0.35);

  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
}

html.dark {
  --color-bg: #0F172A;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-dark);
  overflow-x: hidden;
  transition: background-color .4s var(--ease-premium), color .4s var(--ease-premium);
}

html.dark body {
  color: #E2E8F0;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Plus Jakarta Sans', 'Poppins', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

.font-heading { font-family: 'Poppins', 'Plus Jakarta Sans', sans-serif; }

/* --------------------------------------------------------------------------
   Custom scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
  border-radius: 999px;
  border: 2px solid var(--color-bg);
}

/* --------------------------------------------------------------------------
   Loading screen
   -------------------------------------------------------------------------- */
#loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1e1b4b 0%, #0F172A 70%);
  transition: opacity .6s var(--ease-premium), visibility .6s var(--ease-premium);
}
#loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-ring {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--color-accent);
  border-right-color: var(--color-primary);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Glass surfaces
   -------------------------------------------------------------------------- */
.glass {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.45);
}
html.dark .glass {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-card {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: transform .5s var(--ease-premium), box-shadow .5s var(--ease-premium), border-color .5s var(--ease-premium);
}
html.dark .glass-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.glass-card:hover {
  box-shadow: var(--shadow-float);
  transform: translateY(-6px);
}

.glass-navbar {
  background: rgba(248, 250, 252, 0.7);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}
html.dark .glass-navbar {
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* --------------------------------------------------------------------------
   Gradient mesh / hero backgrounds
   -------------------------------------------------------------------------- */
.mesh-bg {
  position: absolute; inset: 0; z-index: -2; overflow: hidden;
  background:
    radial-gradient(40% 50% at 15% 20%, rgba(79, 70, 229, 0.35), transparent 60%),
    radial-gradient(45% 55% at 85% 15%, rgba(124, 58, 237, 0.3), transparent 60%),
    radial-gradient(50% 60% at 50% 90%, rgba(6, 182, 212, 0.25), transparent 60%),
    linear-gradient(180deg, #0F172A 0%, #111a3a 45%, #0F172A 100%);
}

.noise-overlay {
  position: absolute; inset: 0; z-index: -1; opacity: .05; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.text-gradient {
  background: linear-gradient(100deg, var(--color-primary), var(--color-secondary) 55%, var(--color-accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.btn-gradient {
  background: linear-gradient(100deg, var(--color-primary), var(--color-secondary));
  box-shadow: var(--shadow-glow-primary);
  transition: transform .35s var(--ease-premium), box-shadow .35s var(--ease-premium), filter .35s var(--ease-premium);
}
.btn-gradient:hover { transform: translateY(-3px) scale(1.02); filter: brightness(1.08); box-shadow: 0 0 55px rgba(79,70,229,.5); }
.btn-gradient:active { transform: translateY(-1px) scale(.99); }

.btn-ghost {
  transition: transform .35s var(--ease-premium), background-color .35s var(--ease-premium), border-color .35s var(--ease-premium);
}
.btn-ghost:hover { transform: translateY(-3px); }

/* --------------------------------------------------------------------------
   Floating / parallax motion
   -------------------------------------------------------------------------- */
@keyframes floatY {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50% { transform: translateY(-22px) rotate(var(--r, 0deg)); }
}
@keyframes floatSlow {
  0%, 100% { transform: translate(0,0) rotate(0deg); }
  33% { transform: translate(10px,-18px) rotate(4deg); }
  66% { transform: translate(-12px,10px) rotate(-3deg); }
}
.floating { animation: floatY 6s ease-in-out infinite; will-change: transform; }
.floating-slow { animation: floatSlow 10s ease-in-out infinite; will-change: transform; }
.floating-delay-1 { animation-delay: .8s; }
.floating-delay-2 { animation-delay: 1.6s; }
.floating-delay-3 { animation-delay: 2.4s; }

.blob {
  position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: .55; z-index: -1;
  animation: floatSlow 14s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   3D tilt (driven by JS setting --rx / --ry custom props on mousemove)
   -------------------------------------------------------------------------- */
[data-tilt] {
  --rx: 0deg; --ry: 0deg;
  transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .2s ease-out;
  transform-style: preserve-3d;
}
[data-tilt] > * { transform: translateZ(20px); }

/* --------------------------------------------------------------------------
   Scroll reveal (GSAP toggles .is-visible)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(40px); }
.reveal.is-visible { opacity: 1; transform: translateY(0); transition: opacity .9s var(--ease-premium), transform .9s var(--ease-premium); }

/* --------------------------------------------------------------------------
   Cursor glow
   -------------------------------------------------------------------------- */
#cursor-glow {
  position: fixed; width: 420px; height: 420px; border-radius: 50%;
  pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(79,70,229,.18), transparent 70%);
  transform: translate(-50%, -50%);
  transition: opacity .3s ease;
  display: none;
}
@media (hover: hover) and (pointer: fine) { #cursor-glow { display: block; } }

/* --------------------------------------------------------------------------
   Upload dropzone
   -------------------------------------------------------------------------- */
.dropzone {
  position: relative;
  border: 2px dashed rgba(var(--color-primary-rgb), .35);
  border-radius: var(--radius-xl);
  transition: border-color .3s var(--ease-premium), background-color .3s var(--ease-premium), box-shadow .3s var(--ease-premium);
}
.dropzone.dragover {
  border-color: var(--color-primary);
  background-color: rgba(var(--color-primary-rgb), .06);
  box-shadow: 0 0 0 8px rgba(var(--color-primary-rgb), .08);
}
.dropzone-cloud { animation: floatY 4.5s ease-in-out infinite; }

.progress-ring circle { transition: stroke-dashoffset .3s var(--ease-premium); }

@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(320px) rotate(540deg); opacity: 0; }
}
.confetti-piece {
  position: absolute; top: 0; width: 8px; height: 14px;
  animation: confetti-fall 1.8s var(--ease-premium) forwards;
}

@keyframes pop-in {
  0% { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.pop-in { animation: pop-in .5s var(--ease-premium) forwards; }

/* --------------------------------------------------------------------------
   Skeleton loading
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, rgba(148,163,184,.15) 25%, rgba(148,163,184,.3) 37%, rgba(148,163,184,.15) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,.35), transparent);
}

@media (prefers-reduced-motion: reduce) {
  .floating, .floating-slow, .blob, .dropzone-cloud { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* Print-safe fallback */
@media print {
  .glass, .glass-card, .glass-navbar { background: #fff !important; backdrop-filter: none !important; }
}
