import * as React from 'react' import { cva, type VariantProps } from 'class-variance-authority' import { cn } from '@/lib/utils' const cardVariants = cva( 'flex flex-col rounded-[var(--radius-xl)] text-card-foreground transition-[box-shadow,background-color,border-color,transform] duration-[var(--duration-normal)] ease-out relative overflow-hidden', { variants: { variant: { default: 'bg-card border border-border shadow-lg shadow-black/10 hover:shadow-xl hover:shadow-black/15', elevated: 'bg-card border border-border shadow-lg hover:shadow-xl', ghost: 'bg-transparent border-0', outline: 'bg-transparent border border-border', muted: 'bg-muted/50 border border-border', glass: 'glass border border-white/10 hover:bg-[var(--glass-bg)] hover:border-white/15', interactive: 'bg-card border-0 shadow-lg shadow-black/5 cursor-pointer hover:shadow-xl hover:-translate-y-0.5', glow: 'bg-card border-0 shadow-lg hover:shadow-[0_0_30px_oklch(0.75_0.18_195_/_0.15)]', glowMagenta: 'bg-card border-0 shadow-lg hover:shadow-[0_0_30px_oklch(0.65_0.25_330_/_0.15)]', spotlight: 'bg-black/40 border border-white/10 hover:border-white/20', /* Immersive surface: subtle border, lighter + diffuse shadow on hover */ surface: 'bg-card border border-white/5 shadow-none hover:bg-card/90 hover:border-white/10 hover:shadow-[0_8px_30px_rgba(0,0,0,0.25)] transition-all duration-[var(--duration-immersive)] ease-in-out', }, padding: { none: '', sm: 'p-4', default: 'p-6', lg: 'p-8', }, }, defaultVariants: { variant: 'default', padding: 'none', }, }, ) interface CardProps extends React.ComponentProps<'div'>, VariantProps { spotlight?: boolean; spotlightColor?: string; } function Card({ className, variant, padding, spotlight, spotlightColor = 'rgba(255, 255, 255, 0.1)', ...props }: CardProps) { const divRef = React.useRef(null); const [position, setPosition] = React.useState({ x: 0, y: 0 }); const [opacity, setOpacity] = React.useState(0); const handleMouseMove = (e: React.MouseEvent) => { if (!divRef.current || (variant !== 'spotlight' && !spotlight)) return; const div = divRef.current; const rect = div.getBoundingClientRect(); setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top }); }; const handleMouseEnter = () => { setOpacity(1); }; const handleMouseLeave = () => { setOpacity(0); }; const isSpotlight = variant === 'spotlight' || spotlight; return (
{isSpotlight && (
)}
{props.children}
) } function CardHeader({ className, ...props }: React.ComponentProps<'div'>) { return (
) } function CardTitle({ className, ...props }: React.ComponentProps<'h3'>) { return (

) } function CardDescription({ className, ...props }: React.ComponentProps<'p'>) { return (

) } function CardAction({ className, ...props }: React.ComponentProps<'div'>) { return (

) } function CardContent({ className, ...props }: React.ComponentProps<'div'>) { return (
) } function CardFooter({ className, ...props }: React.ComponentProps<'div'>) { return (
) } export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, cardVariants, }