{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-section-v4",
  "title": "Pricing Section V4",
  "author": "AlgorizeTech",
  "description": "A refreshed pricing section with a cleaner card treatment and no animation dependency. Use it as the lighter alternative to the GSAP-based pricing sections.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/components/custom/blocks/PricingSectionV4.tsx",
      "content": "\"use client\";\n\nimport { ArrowRight, Star } from \"lucide-react\";\nimport type React from \"react\";\nimport { useEffect, useState } from \"react\";\n\nexport interface PricingV4Plan {\n  id: string | number;\n  name: string;\n  price: string | number;\n  description?: string;\n  features?: string[];\n  isFeatured?: boolean;\n  billingCycle?: \"monthly\" | \"yearly\" | string;\n}\n\n/** Plans already split by cycle, optionally one level down. */\nexport interface PricingV4Groups {\n  monthly?: PricingV4Plan[];\n  yearly?: PricingV4Plan[];\n  packages?: PricingV4Groups;\n  data?: PricingV4Groups;\n}\n\n/**\n * Either a flat list, where each plan carries its own `billingCycle`, or a\n * grouped object. Both are accepted; the block sorts it out.\n */\nexport type PricingV4Packages = PricingV4Plan[] | PricingV4Groups;\n\nexport interface PricingSectionV4Props {\n  packages: PricingV4Packages;\n  /** Animate prices up from zero on mount. */\n  counting?: boolean;\n  /** Swap in your router link, e.g. `linkComponent={Link}`. */\n  linkComponent?: React.ElementType;\n}\n\ninterface AnimatedPriceProps {\n  value: string | number;\n  counting?: boolean;\n}\n\nconst AnimatedPrice = ({ value, counting = true }: AnimatedPriceProps) => {\n  const cleanValue = value.toString().replace(/\\.00$/, \"\");\n  const numericValue = parseFloat(cleanValue.replace(/[^0-9.]/g, \"\"));\n  const [displayValue, setDisplayValue] = useState(counting ? 0 : numericValue);\n\n  useEffect(() => {\n    // Both cases render the value directly, without reading state.\n    if (!counting || isNaN(numericValue)) return;\n\n    let startTime: number | undefined;\n    const duration = 600;\n    const startValue = 0;\n\n    const animate = (time: number) => {\n      if (!startTime) startTime = time;\n      const progress = Math.min((time - startTime) / duration, 1);\n      const easeProgress = 1 - Math.pow(1 - progress, 5);\n\n      setDisplayValue(startValue + (numericValue - startValue) * easeProgress);\n\n      if (progress < 1) requestAnimationFrame(animate);\n      else setDisplayValue(numericValue);\n    };\n\n    requestAnimationFrame(animate);\n  }, [numericValue, value, counting]);\n\n  if (isNaN(numericValue)) return <span>{cleanValue}</span>;\n  if (!counting) return <span>{cleanValue.replace(/[^0-9.]/g, \"\")}</span>;\n\n  const isDecimal = cleanValue.includes(\".\");\n  const formatted = isDecimal ? displayValue.toFixed(2) : Math.round(displayValue).toLocaleString();\n\n  return <span>{formatted}</span>;\n};\n\nexport default function PricingSectionV4({ packages, counting = true, linkComponent: Link = \"a\" }: PricingSectionV4Props) {\n  const [billingCycle, setBillingCycle] = useState(\"monthly\");\n  const [selectedPlanId, setSelectedPlanId] = useState<string | number | null>(null);\n\n  let monthlyPlans: PricingV4Plan[] = [];\n  let yearlyPlans: PricingV4Plan[] = [];\n\n  if (Array.isArray(packages)) {\n    monthlyPlans = packages.filter((p) => p.billingCycle?.toLowerCase() === \"monthly\");\n    yearlyPlans = packages.filter((p) => p.billingCycle?.toLowerCase() === \"yearly\");\n  } else if (packages && typeof packages === \"object\") {\n    monthlyPlans = packages.monthly || packages.packages?.monthly || packages.data?.monthly || [];\n    yearlyPlans = packages.yearly || packages.packages?.yearly || packages.data?.yearly || [];\n  }\n\n  const activePlans = billingCycle === \"monthly\" ? monthlyPlans : yearlyPlans;\n  const hasYearlyPlans = yearlyPlans.length > 0;\n\n  // The featured plan is resolved here rather than written back in an effect,\n  // which rendered once with nothing selected before correcting itself.\n  const defaultPlan =\n    activePlans.find((p) => p.isFeatured) ?? activePlans[0] ?? null;\n  const activePlanId = selectedPlanId ?? (defaultPlan ? defaultPlan.id : null);\n\n  const activePlan = activePlans.find((p) => p.id === activePlanId) || activePlans[0];\n\n  const handleToggleCycle = (cycle: string) => {\n    setBillingCycle(cycle);\n    const newPlans = cycle === \"monthly\" ? monthlyPlans : yearlyPlans;\n    if (newPlans.length > 0) {\n      const newFeatured = newPlans.find((p) => p.isFeatured) || newPlans[0];\n      setSelectedPlanId(newFeatured.id);\n    }\n  };\n\n  if (!packages) {\n    return (\n      <section id=\"pricing\" className=\"py-32 bg-background flex justify-center items-center min-h-[500px] transition-colors duration-300\">\n        <div className=\"w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin\" />\n      </section>\n    );\n  }\n\n  if (!activePlans.length) {\n    return (\n      <section id=\"pricing\" className=\"py-32 bg-background text-center text-muted-foreground text-sm font-mono transition-colors duration-300\">\n        No pricing plans available.\n      </section>\n    );\n  }\n\n  return (\n    <section id=\"pricing\" className=\"py-6 md:py-12 bg-background text-foreground font-sans antialiased overflow-hidden selection:bg-primary selection:text-primary-foreground transition-colors duration-300 relative\">\n      <style\n        dangerouslySetInnerHTML={{\n          __html: `\n          .outline-text {\n            color: transparent;\n            -webkit-text-stroke: 1px color-mix(in srgb, var(--foreground) 25%, transparent);\n            transition: -webkit-text-stroke 0.3s ease;\n          }\n          .group:hover .outline-text {\n            -webkit-text-stroke: 1px color-mix(in srgb, var(--foreground) 70%, transparent);\n          }\n        `,\n        }}\n      />\n\n      <div className=\"max-w-[1300px] mx-auto px-6\">\n        <div className=\"flex flex-col md:flex-row justify-between items-start md:items-end gap-8 mb-16 lg:mb-20\">\n          <div className=\"max-w-xl\">\n            <h2 className=\"text-xs font-mono text-primary mb-4\">\n              <span className=\"flex items-center gap-3 justify-center md:justify-start\">\n                <span className=\"w-2 h-2 rounded-full bg-primary animate-pulse mb-6\" />\n              </span>\n            </h2>\n            <h3 className=\"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tighter leading-none mb-5 text-foreground\">\n              Pricing Model.\n            </h3>\n            <p className=\"text-muted-foreground text-lg md:text-xl font-medium leading-relaxed\">\n              Transparent, value-driven pricing designed for high-growth brands. Select a tier to explore what&apos;s included.\n            </p>\n          </div>\n\n          {hasYearlyPlans && (\n            <div className=\"flex gap-6 shrink-0\">\n              {[\"monthly\", \"yearly\"].map((cycle) => (\n                <button\n                  key={cycle}\n                  onClick={() => handleToggleCycle(cycle)}\n                  className={`text-sm font-semibold uppercase tracking-widest pb-1 border-b-2 transition-all duration-300 ${\n                    billingCycle === cycle\n                      ? \"text-primary border-primary\"\n                      : \"text-muted-foreground border-transparent hover:text-foreground\"\n                  }`}\n                >\n                  {cycle}\n                </button>\n              ))}\n            </div>\n          )}\n        </div>\n\n        <div className=\"hidden lg:flex w-full border-t border-border min-h-[550px] transition-colors duration-300\">\n          <div className=\"w-[45%] border-r border-border py-12 pr-8 flex flex-col justify-center gap-6 transition-colors duration-300\">\n            {activePlans.map((plan) => {\n              const isActive = activePlanId === plan.id;\n              return (\n                <button\n                  key={plan.id}\n                  onMouseEnter={() => setSelectedPlanId(plan.id)}\n                  onClick={() => setSelectedPlanId(plan.id)}\n                  className=\"group flex flex-col items-start text-left w-full py-4 pr-4\"\n                >\n                  {plan.isFeatured && (\n                    <span className={`text-[10px] font-mono tracking-widest uppercase mb-2 transition-colors duration-300 ${isActive ? \"text-primary\" : \"text-muted-foreground group-hover:text-primary\"}`}>\n                      [ Most Popular ]\n                    </span>\n                  )}\n                  <span className={`text-4xl lg:text-5xl xl:text-[4rem] font-bold uppercase tracking-tighter leading-[0.85] break-words whitespace-normal inline-block transition-all duration-500 ease-out ${isActive ? \"text-primary translate-x-4\" : \"outline-text group-hover:translate-x-2\"}`}>\n                    {plan.name}\n                  </span>\n                </button>\n              );\n            })}\n          </div>\n\n          <div className=\"w-[55%] py-12 pl-12 xl:pl-16 relative overflow-hidden flex flex-col\">\n            {activePlan && (\n              <div key={activePlan.id} className=\"animate-in fade-in slide-in-from-right-8 duration-700 fill-mode-both flex flex-col h-full z-10 relative\">\n                {activePlan.isFeatured && (\n                  <div className=\"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[400px] h-[400px] bg-primary/10 blur-[100px] rounded-full pointer-events-none\" />\n                )}\n\n                <div className=\"absolute -right-4 -top-8 text-[150px] xl:text-[200px] font-bold text-foreground/[0.03] pointer-events-none select-none tracking-tighter leading-none transition-colors duration-300\">\n                  ${activePlan.price}\n                </div>\n\n                <div className=\"mb-12 relative z-10\">\n                  {activePlan.isFeatured && (\n                    <div className=\"inline-flex items-center gap-1.5 px-3 py-1 bg-primary/10 border border-primary/20 text-primary text-[10px] font-semibold uppercase tracking-widest ml-35 mb-4 rounded-full\">\n                      <Star className=\"w-3 h-3 fill-primary\" /> Recommended\n                    </div>\n                  )}\n\n                  <div className=\"flex items-end gap-2 mb-4\">\n                    <span className=\"text-3xl font-semibold text-muted-foreground mb-2\">$</span>\n                    <span className=\"text-[70px] xl:text-[90px] leading-none font-bold tracking-tighter text-foreground\">\n                      <AnimatedPrice value={activePlan.price} counting={counting} />\n                    </span>\n                  </div>\n                  <p className=\"text-lg text-muted-foreground max-w-md leading-relaxed\">\n                    {activePlan.description}\n                  </p>\n                </div>\n\n                <div className=\"grid grid-cols-2 gap-x-10 gap-y-5 mb-14 relative z-10\">\n                  {activePlan.features?.map((feature: string, i: number) => (\n                    <div key={i} className=\"flex items-center gap-3 border-b border-border pb-3 group/feat transition-colors duration-300\">\n                      <div className=\"w-1.5 h-1.5 bg-foreground/20 group-hover/feat:bg-primary rounded-full transition-colors shrink-0\" />\n                      <span className=\"text-sm lg:text-base text-muted-foreground group-hover/feat:text-foreground transition-colors\">\n                        {feature}\n                      </span>\n                    </div>\n                  ))}\n                </div>\n\n                <Link\n                  href=\"#\"\n                  className={`group mt-auto w-max py-4 px-8 rounded-full text-sm font-semibold uppercase tracking-widest flex items-center justify-center gap-3 relative overflow-hidden ${activePlan.isFeatured ? \"bg-primary text-primary-foreground hover:text-primary\" : \"bg-muted text-foreground hover:text-primary-foreground\"}`}\n                >\n                  <div className={`absolute inset-0 translate-y-[100%] rounded-full group-hover:translate-y-0 transition-transform duration-500 ease-[cubic-bezier(0.19,1,0.22,1)] ${activePlan.isFeatured ? \"bg-primary-foreground\" : \"bg-primary\"}`} />\n                  <span className=\"relative z-10 transition-colors duration-500\">Initiate Project</span>\n                  <div className=\"relative z-10 w-4 h-4 overflow-hidden flex items-center\">\n                    <ArrowRight className=\"absolute w-4 h-4 -translate-x-full group-hover:translate-x-0 transition-transform duration-500 ease-[cubic-bezier(0.19,1,0.22,1)]\" />\n                    <ArrowRight className=\"absolute w-4 h-4 translate-x-0 group-hover:translate-x-full transition-transform duration-500 ease-[cubic-bezier(0.19,1,0.22,1)]\" />\n                  </div>\n                </Link>\n              </div>\n            )}\n          </div>\n        </div>\n\n        {/* MOBILE ACCORDION */}\n        <div className=\"flex flex-col lg:hidden border-t border-border transition-colors duration-300\">\n          {activePlans.map((plan) => {\n            const isActive = activePlanId === plan.id;\n            return (\n              <div key={plan.id} className=\"border-b border-border transition-colors duration-300\">\n                <button onClick={() => setSelectedPlanId(isActive ? null : plan.id)} className=\"w-full py-6 md:py-8 flex justify-between items-center text-left\">\n                  <div className=\"flex flex-col pr-4\">\n                    {plan.isFeatured && (\n                      <span className={`text-[9px] font-mono tracking-widest uppercase mb-1 transition-colors duration-300 ${isActive ? \"text-primary\" : \"text-muted-foreground\"}`}>\n                        [ Most Popular ]\n                      </span>\n                    )}\n                    <span className={`text-3xl md:text-4xl font-bold uppercase tracking-tighter leading-[0.9] break-words whitespace-normal transition-colors duration-300 ${isActive ? \"text-primary\" : \"outline-text\"}`}>\n                      {plan.name}\n                    </span>\n                  </div>\n                  <div className={`transition-transform duration-500 shrink-0 ${isActive ? \"rotate-90 text-primary\" : \"text-foreground/30\"}`}>\n                    <ArrowRight size={24} strokeWidth={2} />\n                  </div>\n                </button>\n\n                <div className={`grid transition-all duration-500 ease-[cubic-bezier(0.16,1,0.3,1)] ${isActive ? \"grid-rows-[1fr] opacity-100\" : \"grid-rows-[0fr] opacity-0\"}`}>\n                  <div className=\"overflow-hidden\">\n                    <div className=\"pb-8 pt-2 flex flex-col relative\">\n                      {plan.isFeatured && <div className=\"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full h-[200px] bg-primary/10 blur-[80px] rounded-full pointer-events-none\" />}\n                      <div className=\"flex items-end gap-1.5 mb-3 relative z-10\">\n                        <span className=\"text-xl font-semibold text-muted-foreground mb-1.5\">$</span>\n                        <span className=\"text-5xl md:text-6xl font-bold tracking-tighter text-foreground\">\n                          <AnimatedPrice value={plan.price} counting={counting} />\n                        </span>\n                      </div>\n                      <p className=\"text-muted-foreground text-sm md:text-base leading-relaxed mb-8 relative z-10\">{plan.description}</p>\n                      <div className=\"flex flex-col gap-3 mb-8 relative z-10\">\n                        {plan.features?.map((feature: string, i: number) => (\n                          <div key={i} className=\"flex items-start gap-3 border-b border-border pb-3\">\n                            <div className=\"w-1.5 h-1.5 bg-primary rounded-full mt-1.5 shrink-0\" />\n                            <span className=\"text-sm md:text-base text-foreground\">{feature}</span>\n                          </div>\n                        ))}\n                      </div>\n                      <Link href=\"#\" className={`group w-full py-4 rounded-xl text-sm font-semibold uppercase tracking-widest flex items-center justify-center gap-3 relative overflow-hidden z-10 ${plan.isFeatured ? \"bg-primary text-primary-foreground hover:text-primary\" : \"bg-muted text-foreground hover:text-primary-foreground\"}`}>\n                        <div className={`absolute inset-0 translate-y-[100%] rounded-xl group-hover:translate-y-0 transition-transform duration-500 ease-[cubic-bezier(0.19,1,0.22,1)] ${plan.isFeatured ? \"bg-primary-foreground\" : \"bg-primary\"}`} />\n                        <span className=\"relative z-10 transition-colors duration-500\">Initiate Project</span>\n                        <div className=\"relative z-10 w-4 h-4 overflow-hidden flex items-center\">\n                          <ArrowRight className=\"absolute w-4 h-4 -translate-x-full group-hover:translate-x-0 transition-transform duration-500 ease-[cubic-bezier(0.19,1,0.22,1)]\" />\n                          <ArrowRight className=\"absolute w-4 h-4 translate-x-0 group-hover:translate-x-full transition-transform duration-500 ease-[cubic-bezier(0.19,1,0.22,1)]\" />\n                        </div>\n                      </Link>\n                    </div>\n                  </div>\n                </div>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}",
      "type": "registry:component",
      "target": "components/custom/blocks/PricingSectionV4.tsx"
    }
  ],
  "docs": "Named export: PricingSectionV4. Self-contained with hardcoded plans — copy and adapt. Uses next/link, so it needs edits outside Next.js. No GSAP, so it is the lightest of the pricing items.",
  "categories": [
    "commerce",
    "marketing"
  ],
  "type": "registry:component"
}
