import React from 'react';
import { YStack } from '@tamagui/stacks';
import { useAppearance } from '@/hooks/use-appearance';

type AmbientBackgroundProps = {
  children: React.ReactNode;
};

export default function AmbientBackground({ children }: AmbientBackgroundProps) {
  const { resolved } = useAppearance();
  const isDark = resolved === 'dark';

  return (
    <YStack
      flex={1}
      position="relative"
      style={{
        backgroundImage: isDark
          ? 'radial-gradient(circle at 15% 10%, rgba(255, 79, 216, 0.2), transparent 48%), radial-gradient(circle at 90% 20%, rgba(79, 209, 255, 0.18), transparent 40%), linear-gradient(180deg, rgba(6, 10, 22, 0.96), rgba(10, 15, 31, 1))'
          : 'radial-gradient(circle at 15% 10%, color-mix(in oklab, var(--guest-primary, #FF5A5F) 28%, white), transparent 48%), radial-gradient(circle at 90% 20%, color-mix(in oklab, var(--guest-secondary, #F43F5E) 24%, white), transparent 40%), linear-gradient(180deg, var(--guest-background, #FFF8F5), color-mix(in oklab, var(--guest-background, #FFF8F5) 85%, white))',
        backgroundSize: '140% 140%, 140% 140%, 100% 100%',
        animation: 'guestNightAmbientDrift 18s ease-in-out infinite',
      }}
    >
      {children}
    </YStack>
  );
}
