@import "tailwindcss";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-4xl: calc(var(--radius) + 16px);
}

:root {
  --radius: 0.75rem;
  --background: oklch(0.98 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0 / 0.8);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.6 0.25 280);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.6 0.25 280);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.06 0.015 280);
  --foreground: oklch(0.95 0.01 280);
  --card: oklch(0.12 0.02 280 / 0.6);
  --card-foreground: oklch(0.95 0.01 280);
  --popover: oklch(0.12 0.02 280 / 0.95);
  --popover-foreground: oklch(0.95 0.01 280);
  --primary: oklch(0.72 0.22 280);
  --primary-foreground: oklch(0.98 0 0);
  --secondary: oklch(0.16 0.03 280);
  --secondary-foreground: oklch(0.95 0.01 280);
  --muted: oklch(0.14 0.02 280);
  --muted-foreground: oklch(0.60 0.03 280);
  --accent: oklch(0.18 0.04 300);
  --accent-foreground: oklch(0.95 0.01 280);
  --destructive: oklch(0.60 0.22 25);
  --border: oklch(0.25 0.04 280 / 0.4);
  --input: oklch(0.14 0.02 280);
  --ring: oklch(0.72 0.22 280);
  --chart-1: oklch(0.72 0.22 280);
  --chart-2: oklch(0.68 0.18 320);
  --chart-3: oklch(0.62 0.20 200);
  --chart-4: oklch(0.65 0.16 350);
  --chart-5: oklch(0.70 0.18 40);
  --sidebar: oklch(0.10 0.015 280);
  --sidebar-foreground: oklch(0.95 0.01 280);
  --sidebar-primary: oklch(0.72 0.22 280);
  --sidebar-primary-foreground: oklch(0.98 0 0);
  --sidebar-accent: oklch(0.14 0.02 280);
  --sidebar-accent-foreground: oklch(0.95 0.01 280);
  --sidebar-border: oklch(0.20 0.03 280 / 0.3);
  --sidebar-ring: oklch(0.72 0.22 280);
}

/* Keyframe Animations */
@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(2deg);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

@keyframes grid-wave {
  0% {
    transform: perspective(100vh) rotateX(60deg) translateY(0) scale(2);
  }
  50% {
    transform: perspective(120vh) rotateX(50deg) translateY(-2%) scale(2.2);
  }
  100% {
    transform: perspective(100vh) rotateX(60deg) translateY(0) scale(2);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes shimmer-text-sweep {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  
  body {
    @apply bg-background text-foreground;
    min-height: 100vh;
    overflow-x: hidden;
  }
}

@layer components {
  /* Animated gradient background */
  .animated-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: 
      radial-gradient(ellipse 80% 50% at 20% 40%, oklch(0.25 0.15 280 / 0.3) 0%, transparent 50%),
      radial-gradient(ellipse 60% 40% at 80% 60%, oklch(0.20 0.12 320 / 0.25) 0%, transparent 50%),
      radial-gradient(ellipse 50% 30% at 50% 90%, oklch(0.18 0.10 260 / 0.2) 0%, transparent 50%);
    animation: pulse-glow 8s ease-in-out infinite;
  }

  /* Subtle perspective grid */
  .background-grid {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: -6;
    background-image: 
      linear-gradient(to right, oklch(1 0 0 / 0.015) 1px, transparent 1px),
      linear-gradient(to bottom, oklch(1 0 0 / 0.015) 1px, transparent 1px);
    background-size: 80px 80px;
    transform-origin: 50% 50%;
    animation: grid-wave 25s ease-in-out infinite both alternate;
    mask-image: radial-gradient(circle at center, black 0%, transparent 60%);
    pointer-events: none;
  }

  /* Floating orbs */
  .floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: float 12s ease-in-out infinite;
    pointer-events: none;
  }

  .floating-orb-1 {
    width: 400px;
    height: 400px;
    background: oklch(0.50 0.20 280 / 0.15);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
  }

  .floating-orb-2 {
    width: 350px;
    height: 350px;
    background: oklch(0.45 0.18 320 / 0.12);
    bottom: -50px;
    right: -50px;
    animation-delay: -4s;
  }

  .floating-orb-3 {
    width: 250px;
    height: 250px;
    background: oklch(0.55 0.15 260 / 0.1);
    top: 40%;
    right: 20%;
    animation-delay: -8s;
  }

  /* Glass card effect */
  .glass-card {
    background: oklch(0.12 0.02 280 / 0.4);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid oklch(0.40 0.08 280 / 0.15);
    box-shadow: 
      0 8px 32px oklch(0 0 0 / 0.3),
      inset 0 1px 0 oklch(1 0 0 / 0.05);
  }

  .glass-card:hover {
    border-color: oklch(0.55 0.15 280 / 0.3);
    box-shadow: 
      0 12px 40px oklch(0.50 0.20 280 / 0.15),
      inset 0 1px 0 oklch(1 0 0 / 0.08);
  }

  /* Gradient text */
  .gradient-text {
    position: relative;
    background: linear-gradient(135deg, 
      oklch(0.85 0.18 280) 0%, 
      oklch(0.75 0.22 300) 50%, 
      oklch(0.70 0.20 260) 100%
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 6s ease infinite;
  }
  
  .gradient-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background: linear-gradient(
      110deg,
      transparent 35%,
      oklch(1 0 0 / 0.3) 45%,
      oklch(1 0 0 / 0.7) 50%,
      oklch(1 0 0 / 0.3) 55%,
      transparent 65%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer-text-sweep 4s linear infinite;
    pointer-events: none;
  }

  /* Shimmer effect for loading */
  .shimmer {
    background: linear-gradient(
      90deg,
      oklch(0.20 0.03 280 / 0) 0%,
      oklch(0.30 0.05 280 / 0.3) 50%,
      oklch(0.20 0.03 280 / 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
  }

  /* Glow button */
  .glow-button {
    position: relative;
    background: linear-gradient(135deg, oklch(0.65 0.22 280), oklch(0.55 0.20 300));
    box-shadow: 
      0 4px 20px oklch(0.50 0.20 280 / 0.4),
      inset 0 1px 0 oklch(1 0 0 / 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .glow-button:hover {
    transform: translateY(-2px);
    box-shadow: 
      0 8px 30px oklch(0.55 0.22 280 / 0.5),
      inset 0 1px 0 oklch(1 0 0 / 0.2);
  }

  .glow-button:active {
    transform: translateY(0);
  }

  /* Slide up animation for cards */
  .slide-up {
    animation: slide-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .slide-up-delay-1 { animation-delay: 0.1s; opacity: 0; }
  .slide-up-delay-2 { animation-delay: 0.2s; opacity: 0; }
  .slide-up-delay-3 { animation-delay: 0.3s; opacity: 0; }

  /* Input glow */
  .input-glow {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .input-glow:focus {
    box-shadow: 
      0 0 0 3px oklch(0.60 0.20 280 / 0.2),
      0 4px 20px oklch(0.50 0.18 280 / 0.15);
  }

  /* Thumbnail hover effect */
  .thumbnail-container {
    position: relative;
    overflow: hidden;
  }

  .thumbnail-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to top,
      oklch(0 0 0 / 0.6) 0%,
      oklch(0 0 0 / 0) 50%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .thumbnail-container:hover::after {
    opacity: 1;
  }

  .thumbnail-container img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .thumbnail-container:hover img {
    transform: scale(1.05);
  }

  /* Success card glow */
  .success-glow {
    background: oklch(0.15 0.08 150 / 0.3);
    border-color: oklch(0.60 0.20 150 / 0.4);
    box-shadow: 
      0 8px 32px oklch(0.50 0.18 150 / 0.15),
      inset 0 1px 0 oklch(0.70 0.15 150 / 0.1);
  }

  /* NEW: Background Effects - Subtle undulating waves */

  @keyframes aurora-drift {
    0%, 100% {
      transform: translateY(0%) rotate(0deg) scale(1);
      opacity: 0.4;
    }
    33% {
      transform: translateY(-5%) rotate(1deg) scale(1.02);
      opacity: 0.5;
    }
    66% {
      transform: translateY(3%) rotate(-1deg) scale(0.98);
      opacity: 0.35;
    }
  }

  @keyframes wave-flow {
    0% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
    100% {
      background-position: 0% 50%;
    }
  }

  /* Soft aurora wave - the main subtle effect */
  .bg-wave-lines {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: 
      linear-gradient(
        135deg,
        transparent 0%,
        oklch(0.55 0.25 280 / 0.4) 25%,
        transparent 40%,
        oklch(0.50 0.22 320 / 0.35) 60%,
        transparent 75%,
        oklch(0.60 0.2 240 / 0.3) 90%,
        transparent 100%
      );
    background-size: 200% 200%;
    filter: blur(60px);
    animation: wave-flow 20s ease-in-out infinite, aurora-drift 15s ease-in-out infinite;
    pointer-events: none;
  }

  .bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(
      ellipse 80% 60% at 70% 20%,
      oklch(0.6 0.25 280 / 0.35) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 60% 80% at 20% 80%,
      oklch(0.55 0.22 200 / 0.3) 0%,
      transparent 50%
    );
    filter: blur(50px);
    animation: aurora-drift 25s ease-in-out infinite reverse;
    pointer-events: none;
  }

  /* Very subtle noise texture */
  .bg-noise {
    position: fixed;
    inset: 0;
    z-index: 1000;
    opacity: 0.015;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  }
}