{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"ecommerce-product-features-3d-feature-carousel","type":"registry:block","title":"3D Feature Carousel","files":[{"path":"components/blocks/ecommerce/product-features/3d-feature-carousel.tsx","content":"import { useState, useRef, useEffect } from 'react';\n\nimport { ArrowRight, ArrowLeft, ChevronRight } from 'lucide-react';\nimport { Badge } from '@/components/ui/badge';\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/lib/utils';\n\ninterface Feature {\n  id: string;\n  title: string;\n  description: string;\n  image: string;\n  color: string;\n}\n\nexport default function ThreeDFeatureCarousel() {\n  const [activeIndex, setActiveIndex] = useState(0);\n  const setIsAutoRotating = useState(true)[1];\n  const [direction] = useState(1); // 1 for forward, -1 for backward\n  const autoRotateTimerRef = useRef<NodeJS.Timeout | null>(null);\n  const containerRef = useRef<HTMLDivElement>(null);\n\n  const features: Feature[] = [\n    {\n      id: 'anc',\n      title: 'Active Noise Cancellation',\n      description:\n        'Advanced microphones and proprietary algorithms detect and cancel unwanted noise, allowing you to focus on your music or calls without distractions.',\n      image:\n        'https://images.unsplash.com/photo-1484704849700-f032a568e944?q=80&w=2070&auto=format&fit=crop',\n      color: 'bg-blue-500/90',\n    },\n    {\n      id: 'sound',\n      title: 'Spatial Audio',\n      description:\n        'Experience immersive, theater-like sound with dynamic head tracking that makes music, movies, and games come alive all around you.',\n      image:\n        'https://images.unsplash.com/photo-1558537348-c0f8e733989d?q=80&w=2070&auto=format&fit=crop',\n      color: 'bg-purple-500/90',\n    },\n    {\n      id: 'battery',\n      title: '30-Hour Battery Life',\n      description:\n        'Enjoy a full day of listening with up to 30 hours of battery life, and quick-charge technology that gives you 3 hours of playback from just 10 minutes of charging.',\n      image:\n        'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?q=80&w=2070&auto=format&fit=crop',\n      color: 'bg-green-500/90',\n    },\n    {\n      id: 'comfort',\n      title: 'Premium Comfort',\n      description:\n        'Luxurious memory foam ear cushions wrapped in soft protein leather create a perfect seal while distributing pressure evenly for all-day comfort.',\n      image:\n        'https://images.unsplash.com/photo-1545127398-14699f92334b?q=80&w=2035&auto=format&fit=crop',\n      color: 'bg-amber-500/90',\n    },\n    {\n      id: 'connection',\n      title: 'Seamless Connection',\n      description:\n        'Bluetooth 5.3 with multipoint connection allows you to pair with multiple devices and switch between them effortlessly.',\n      image:\n        'https://images.unsplash.com/photo-1606131731446-5568d87113aa?q=80&w=2064&auto=format&fit=crop',\n      color: 'bg-rose-500/90',\n    },\n  ];\n\n  const handleNext = () => {\n    stopAutoRotate();\n    setActiveIndex((prev) => (prev === features.length - 1 ? 0 : prev + 1));\n  };\n\n  const handlePrev = () => {\n    stopAutoRotate();\n    setActiveIndex((prev) => (prev === 0 ? features.length - 1 : prev - 1));\n  };\n\n  const handleDotClick = (index: number) => {\n    stopAutoRotate();\n    setActiveIndex(index);\n  };\n\n  const getPositionStyles = (index: number) => {\n    const totalItems = features.length;\n    const angleDegree = (2 * Math.PI) / totalItems;\n    const radius = containerRef.current\n      ? containerRef.current.offsetWidth * 0.35\n      : 250;\n\n    // Calculate where this item should be in the carousel\n    let positionIndex = (index - activeIndex + totalItems) % totalItems;\n\n    // Adjust the index to make the items flow in order\n    if (positionIndex > totalItems / 2) {\n      positionIndex = positionIndex - totalItems;\n    }\n\n    const angle = positionIndex * angleDegree;\n\n    // Calculate 3D position\n    const x = radius * Math.sin(angle);\n    const z = radius * Math.cos(angle) - radius;\n\n    // Calculate opacity based on z position\n    const opacity = ((z + radius) / (radius * 2)) * 0.8 + 0.2;\n    const scale = 0.7 + opacity * 0.3;\n    const zIndex = Math.round(opacity * 10);\n\n    // Active item is larger and fully opaque\n    if (index === activeIndex) {\n      return {\n        transform: `translateX(0) translateZ(50px) scale(1.05)`,\n        opacity: 1,\n        zIndex: 20,\n      };\n    }\n\n    return {\n      transform: `translateX(${x}px) translateZ(${z}px) scale(${scale})`,\n      opacity,\n      zIndex,\n    };\n  };\n\n  const startAutoRotate = () => {\n    setIsAutoRotating(true);\n    if (autoRotateTimerRef.current) {\n      clearInterval(autoRotateTimerRef.current);\n    }\n\n    autoRotateTimerRef.current = setInterval(() => {\n      setActiveIndex((prev) => {\n        if (direction === 1) {\n          return prev === features.length - 1 ? 0 : prev + 1;\n        } else {\n          return prev === 0 ? features.length - 1 : prev - 1;\n        }\n      });\n    }, 4000);\n  };\n\n  const stopAutoRotate = () => {\n    setIsAutoRotating(false);\n    if (autoRotateTimerRef.current) {\n      clearInterval(autoRotateTimerRef.current);\n      autoRotateTimerRef.current = null;\n    }\n  };\n\n  // Start auto rotation on mount and clean up on unmount\n  useEffect(() => {\n    startAutoRotate();\n\n    return () => {\n      if (autoRotateTimerRef.current) {\n        clearInterval(autoRotateTimerRef.current);\n      }\n    };\n  }, [direction]);\n\n  // Current active feature\n  const activeFeature = features[activeIndex]!;\n\n  return (\n    <section className=\"bg-background w-full overflow-hidden py-12 md:py-24 lg:py-32\">\n      <div className=\"container mx-auto px-4 md:px-6 2xl:max-w-[1400px]\">\n        <div className=\"mb-12 flex flex-col items-center space-y-4 text-center\">\n          <Badge className=\"px-3.5 py-1.5\">Premium Sound Experience</Badge>\n          <h2 className=\"text-3xl font-bold tracking-tighter sm:text-4xl md:text-5xl\">\n            Discover exceptional features\n          </h2>\n          <p className=\"text-muted-foreground mb-4 max-w-[700px] md:text-xl/relaxed\">\n            Our flagship headphones combine cutting-edge technology with premium\n            materials for an unparalleled listening experience.\n          </p>\n        </div>\n\n        {/* 3D Carousel */}\n        <div className=\"perspective-1000 relative mb-12 h-[400px] md:h-[500px]\">\n          <div\n            ref={containerRef}\n            className=\"transform-style-3d relative h-full w-full\"\n          >\n            {features.map((feature, idx) => (\n              <div\n                key={feature.id}\n                className={cn(\n                  'transform-style-3d absolute top-0 right-0 bottom-0 left-0 mx-auto w-full max-w-[420px] overflow-hidden rounded-xl transition-all duration-700',\n                  'border shadow-lg'\n                )}\n                style={getPositionStyles(idx)}\n                onClick={() => handleDotClick(idx)}\n              >\n                <div className=\"group bg-card relative h-full cursor-pointer\">\n                  <div className=\"absolute inset-0 z-10 bg-gradient-to-t from-black/80 via-black/40 to-transparent\" />\n\n                  <img\n                    src={feature.image}\n                    alt={feature.title}\n                    className=\"object-cover transition-transform group-hover:scale-105\"\n                  />\n\n                  <div className=\"absolute right-0 bottom-0 left-0 z-20 p-6 text-left\">\n                    <div\n                      className={cn(\n                        'mb-2 inline-block rounded-full px-2.5 py-0.5 text-xs font-medium text-white',\n                        feature.color\n                      )}\n                    >\n                      Feature {idx + 1} of {features.length}\n                    </div>\n                    <h3 className=\"mb-1 text-xl font-bold text-white\">\n                      {feature.title}\n                    </h3>\n                    <p className=\"line-clamp-2 text-sm text-white/90\">\n                      {feature.description}\n                    </p>\n                  </div>\n                </div>\n              </div>\n            ))}\n          </div>\n\n          {/* Navigation arrows */}\n          <div className=\"absolute top-1/2 left-4 z-20 -translate-y-1/2\">\n            <Button\n              variant=\"outline\"\n              size=\"icon\"\n              className=\"bg-background/80 rounded-full backdrop-blur-sm\"\n              onClick={handlePrev}\n            >\n              <ArrowLeft className=\"h-5 w-5\" />\n            </Button>\n          </div>\n\n          <div className=\"absolute top-1/2 right-4 z-20 -translate-y-1/2\">\n            <Button\n              variant=\"outline\"\n              size=\"icon\"\n              className=\"bg-background/80 rounded-full backdrop-blur-sm\"\n              onClick={handleNext}\n            >\n              <ArrowRight className=\"h-5 w-5\" />\n            </Button>\n          </div>\n\n          {/* Dots indicator */}\n          <div className=\"absolute bottom-[-30px] left-1/2 z-20 flex -translate-x-1/2 space-x-2\">\n            {features.map((_, idx) => (\n              <button\n                key={idx}\n                className={cn(\n                  'h-2.5 w-2.5 rounded-full transition-all',\n                  activeIndex === idx\n                    ? 'bg-primary w-6'\n                    : 'bg-muted-foreground/20 hover:bg-primary/50'\n                )}\n                onClick={() => handleDotClick(idx)}\n              />\n            ))}\n          </div>\n        </div>\n\n        {/* Feature details */}\n        <div className=\"mx-auto max-w-3xl\">\n          <div className=\"bg-muted/40 grid items-start gap-6 overflow-hidden rounded-xl border md:grid-cols-5\">\n            <div className=\"p-6 md:col-span-3\">\n              <h3 className=\"text-2xl font-bold\">{activeFeature.title}</h3>\n              <p className=\"text-muted-foreground mt-2\">\n                {activeFeature.description}\n              </p>\n\n              <ul className=\"mt-6 space-y-3\">\n                <li className=\"flex items-start gap-2\">\n                  <ChevronRight className=\"text-primary mt-0.5 h-5 w-5 shrink-0\" />\n                  <span>\n                    Adaptive technology adjusts to your environment in real-time\n                  </span>\n                </li>\n                <li className=\"flex items-start gap-2\">\n                  <ChevronRight className=\"text-primary mt-0.5 h-5 w-5 shrink-0\" />\n                  <span>\n                    Customizable via the companion app for your perfect sound\n                    profile\n                  </span>\n                </li>\n                <li className=\"flex items-start gap-2\">\n                  <ChevronRight className=\"text-primary mt-0.5 h-5 w-5 shrink-0\" />\n                  <span>\n                    Premium materials ensure durability and lasting comfort\n                  </span>\n                </li>\n              </ul>\n\n              <div className=\"mt-8 flex flex-col gap-3 sm:flex-row\">\n                <Button asChild>\n                  <a href=\"#\">\n                    Learn more\n                    <ArrowRight className=\"ml-2 h-4 w-4\" />\n                  </a>\n                </Button>\n                <Button variant=\"secondary\">See all features</Button>\n              </div>\n            </div>\n\n            <div\n              className={cn(\n                'hidden items-center justify-center px-6 py-12 text-white md:col-span-2 md:flex',\n                activeFeature.color\n              )}\n            >\n              <div className=\"text-center\">\n                <div className=\"mb-2 text-4xl font-bold\">\n                  {activeIndex === 0 && '40dB'}\n                  {activeIndex === 1 && '360°'}\n                  {activeIndex === 2 && '30h'}\n                  {activeIndex === 3 && '320g'}\n                  {activeIndex === 4 && '5.3'}\n                </div>\n                <div className=\"text-sm text-white/80\">\n                  {activeIndex === 0 && 'Noise Reduction'}\n                  {activeIndex === 1 && 'Sound Field'}\n                  {activeIndex === 2 && 'Playback Time'}\n                  {activeIndex === 3 && 'Ultra Lightweight'}\n                  {activeIndex === 4 && 'Bluetooth Version'}\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n        {/* CTA section */}\n        <div className=\"mt-20 text-center\">\n          <h3 className=\"mb-4 text-2xl font-bold\">\n            Experience premium sound today\n          </h3>\n          <p className=\"text-muted-foreground mx-auto mb-8 max-w-xl\">\n            Join thousands of satisfied customers who have elevated their\n            listening experience with our flagship headphones.\n          </p>\n\n          <div className=\"flex flex-col justify-center gap-4 sm:flex-row\">\n            <Button size=\"lg\" asChild>\n              <a href=\"#\">\n                Shop now\n                <ArrowRight className=\"ml-2 h-4 w-4\" />\n              </a>\n            </Button>\n            <Button size=\"lg\" variant=\"outline\" asChild>\n              <a href=\"#\">Compare models</a>\n            </Button>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n","type":"registry:component","target":"components/blocks/ecommerce/product-features/3d-feature-carousel.tsx"},{"path":"components/ui/badge.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n  \"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n        secondary:\n          \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n        destructive:\n          \"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20\",\n        outline:\n          \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nfunction Badge({\n  className,\n  variant = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"span\"> &\n  VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot.Root : \"span\"\n\n  return (\n    <Comp\n      data-slot=\"badge\"\n      data-variant={variant}\n      className={cn(badgeVariants({ variant }), className)}\n      {...props}\n    />\n  )\n}\n\nexport { Badge, badgeVariants }\n","type":"registry:ui","target":"components/ui/badge.tsx"},{"path":"components/ui/button.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n  \"group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n        outline:\n          \"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n        destructive:\n          \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default:\n          \"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        xs: \"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n        sm: \"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5\",\n        lg: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        icon: \"size-9\",\n        \"icon-xs\":\n          \"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3\",\n        \"icon-sm\":\n          \"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md\",\n        \"icon-lg\": \"size-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction Button({\n  className,\n  variant = \"default\",\n  size = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"button\"> &\n  VariantProps<typeof buttonVariants> & {\n    asChild?: boolean\n  }) {\n  const Comp = asChild ? Slot.Root : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"button\"\n      data-variant={variant}\n      data-size={size}\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Button, buttonVariants }\n","type":"registry:ui","target":"components/ui/button.tsx"}],"description":"A rotating carousel that shows product features on 3D cards with depth and motion. Great for highlighting a few standout capabilities on a landing page.","dependencies":["class-variance-authority","lucide-react","radix-ui"]}