import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import Link from "next/link";
import { PlaySquare, ChevronDown, Wrench } from "lucide-react";
import MobileMenu from "@/components/MobileMenu";
import Script from "next/script";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
  metadataBase: new URL('https://yttoolkits.site'),
  title: "YT Toolkits | Free YouTube Creator Tools, Downloaders & Analytics Suite",
  description: "The ultimate free toolkit for YouTube creators. 32 free tools to download videos in 4K, check monetization status, extract SEO tags, calculate earnings, audit channel shadowbans, and grow your audience in 2026.",
  keywords: [
    // General & Brand
    "YouTube tools", "YTToolkits", "free YouTube creator tools", "YouTube tools online", "best YouTube tools 2026", "YouTube toolkit", "creator tools suite", "YouTube automation tools", "YouTube channel manager tools", "YouTube growth tools", "YouTube video utility", "YouTube studio tools", "free creator suite", "YouTube creator studio online", "YouTube helpers", "YouTube power tools", "online YouTube utilities", "free YouTube software", "YouTube productivity tools", "YouTube creator ecosystem",
    // 1. Video Downloader
    "youtube video downloader", "download youtube video", "youtube to mp4", "youtube video downloader 1080p", "youtube 4k video downloader", "youtube clip downloader", "save youtube video online", "free youtube video downloader", "download youtube videos fast", "youtube downloader no watermark", "youtube video grabber", "high quality youtube downloader", "youtube shorts downloader", "download youtube shorts online", "youtube downloader 60fps", "youtube 8k video downloader", "youtube downloader pc mobile", "save video from youtube", "youtube full hd downloader", "online youtube video saver",
    // 2. Thumbnail Downloader
    "youtube thumbnail downloader", "download youtube thumbnail", "youtube thumbnail grabber", "youtube thumbnail 1080p", "youtube maxresdefault downloader", "youtube thumbnail saver", "download hd youtube thumbnail", "get youtube thumbnail image", "youtube custom thumbnail downloader", "extract youtube thumbnail", "youtube thumbnail high resolution", "youtube shorts thumbnail downloader", "free youtube thumbnail download", "youtube cover image downloader", "save youtube video preview", "youtube hd image grabber",
    // 3. Tag Extractor
    "youtube tag extractor", "extract tags from youtube video", "youtube tags finder", "see youtube tags", "youtube tag inspector", "find youtube video tags", "copy youtube tags", "youtube hidden tag extractor", "extract youtube video keywords", "best youtube tags", "youtube tag viewer", "check competitor youtube tags", "youtube meta tags extractor", "extract youtube hashtags and tags", "youtube video tag finder free", "youtube keyword scraper",
    // 4. Monetization Checker
    "youtube monetization checker", "check if youtube channel is monetized", "youtube channel monetization status", "is youtube channel monetized", "check youtube video monetization", "youtube monetization audit", "youtube partner program checker", "ypp monetization eligibility", "how to tell if youtube channel makes money", "is this channel monetized", "youtube monetization tracker", "check youtube ads on video", "youtube monetization lookup", "monetization eligibility checker 2026", "check channel monetization free",
    // 5. Shadowban Detector
    "youtube shadowban detector", "youtube shadowban checker", "is my youtube channel shadowbanned", "check youtube shadowban", "youtube comment shadowban checker", "youtube search shadowban test", "youtube algorithm shadowban", "why are my youtube views dropping", "how to fix youtube shadowban", "youtube video shadowban checker", "detect shadowban on youtube", "shadowban test youtube 2026", "youtube shadowban diagnosis", "unban youtube channel", "why youtube stopped recommending my videos",
    // 6. Earnings Calculator
    "youtube earnings calculator", "youtube money calculator", "calculate youtube earnings", "how much money does youtube pay", "youtube adsense calculator", "youtube rpm calculator", "youtube cpm calculator", "youtube ad revenue estimator", "estimate youtube channel revenue", "youtube payout calculator", "youtube creator salary calculator", "calculate youtube view money", "youtube revenue per view calculator", "how much do youtubers make",
    // 7. Watch Time Calculator
    "youtube watch time calculator", "4000 watch hours calculator", "calculate 4000 watch hours youtube", "how to get 4000 watch hours", "youtube monetization watch time calculator", "youtube watch time tracker", "youtube watch hours to days", "how many views for 4000 watch hours", "youtube watch time goal calculator", "reach 4000 watch hours fast", "youtube watch hours progress", "calculate watch minutes to hours",
    // 8. Video Money Calculator
    "youtube video money calculator", "how much did this video make", "calculate single youtube video earnings", "video money estimator", "video revenue calculator", "youtube video payout estimator", "youtube income per video", "check video earnings youtube", "calculate video cpm earnings", "how much money a youtube video made",
    // 9. Views to Money
    "youtube views to money", "convert youtube views to dollars", "1000 views on youtube money", "100k views on youtube money", "1 million views youtube payout", "how much is 10k views worth on youtube", "views to cash youtube", "youtube views to earnings converter", "how much youtube pays per view", "youtube views dollar conversion", "estimated revenue per view youtube",
    // 10. Advanced Money Calculator
    "advanced youtube money calculator", "youtube sponsorship calculator", "calculate youtube brand deals", "youtube merch and adsense calculator", "youtube affiliate income calculator", "total youtube creator earnings", "youtube sponsorship rate estimator", "calculate brand collaboration rates", "youtube creator net worth calculator",
    // 11. Live Stream Calculator
    "youtube live stream calculator", "youtube super chat calculator", "super chat earnings estimator", "live stream revenue youtube", "youtube channel membership calculator", "youtube live donation calculator", "calculate youtube super thanks", "youtube live stream income tracker",
    // 12. SEO Score Checker
    "youtube seo score checker", "youtube seo audit", "check youtube video seo", "youtube seo rating tool", "youtube video optimization score", "youtube seo analyzer", "improve youtube seo score", "free youtube seo checker", "video ranking potential score", "youtube title description seo audit",
    // 13. Rank Checker
    "youtube rank checker", "youtube keyword rank tracker", "check youtube search rankings", "where does my video rank on youtube", "youtube video position checker", "track youtube keywords", "youtube search rank finder", "real time youtube rank checker", "youtube serps tracker",
    // 14. Channel ID Finder
    "youtube channel id finder", "find youtube channel id", "get channel id from handle", "youtube custom url to channel id", "lookup youtube channel id", "find youtube user id", "youtube channel id extractor", "convert youtube handle to id", "youtube rss feed channel id", "find channel uc id",
    // 15. Clickbait Title Generator
    "clickbait title generator", "high ctr youtube title generator", "youtube video title generator", "viral youtube titles", "catchy youtube title generator", "ai youtube headline generator", "youtube hook and title maker", "increase youtube ctr titles", "best video titles youtube", "youtube headline creator",
    // 16. Hashtag Generator
    "youtube hashtag generator", "youtube shorts hashtag generator", "viral hashtags for youtube", "best hashtags for youtube shorts", "trending youtube hashtags", "generate youtube hashtags", "youtube hashtag finder", "hashtags for gaming youtube", "top tags for shorts",
    // 17. Comment Generator
    "youtube comment generator", "ai youtube comment generator", "youtube reply generator", "generate engaging youtube comments", "youtube comment response tool", "smart youtube comments", "creator reply generator",
    // 18. Comment Sentiment
    "youtube comment sentiment", "youtube comment sentiment analysis", "analyze youtube audience comments", "youtube comment mood analyzer", "is my youtube audience happy", "youtube sentiment score", "video feedback sentiment tool",
    // 19. Comments Viewer
    "youtube comments viewer", "deep link youtube comments", "search youtube comments", "find specific youtube comment", "youtube comment finder", "view all comments youtube video", "jump to youtube comment timestamp",
    // 20. Profile Picture Downloader
    "youtube profile picture downloader", "youtube pfp downloader", "download youtube channel avatar", "youtube avatar grabber", "high resolution youtube profile picture", "download youtube channel icon", "extract youtube profile pic hd",
    // 21. Upload Date Finder
    "youtube upload date finder", "find exact upload time youtube", "when was youtube video uploaded", "exact youtube publish date", "youtube timestamp publish finder", "youtube publish time converter", "check original upload date youtube",
    // 22. Description Viewer
    "youtube description viewer", "extract youtube video description", "copy youtube description", "youtube description reader", "youtube description link extractor", "export youtube description",
    // 23. Embed Viewer
    "youtube embed viewer", "responsive youtube iframe generator", "youtube embed code maker", "embed youtube video with controls", "custom youtube embed player", "clean youtube embed iframe",
    // 24. Link Viewer
    "youtube link viewer", "youtube url parser", "clean youtube url", "youtube timestamp link generator", "inspect youtube link parameters", "decode youtube short link",
    // 25. Royalty Free Music
    "youtube royalty free music", "copyright free music for youtube", "safe background music for youtube videos", "monetizable music youtube", "no copyright music download", "free audio for youtube videos", "royalty free sound effects youtube",
    // 26. Deleted Video Finder
    "deleted youtube video finder", "how to watch deleted youtube videos", "find deleted youtube video url", "wayback machine youtube video", "recover deleted youtube video", "see deleted youtube videos archive", "find lost youtube video metadata",
    // 27. Private Video Checker
    "private video checker youtube", "check if youtube video is private", "is youtube video private or unlisted", "view private youtube video metadata", "check unlisted youtube status",
    // 28. Private YouTube Viewer
    "private youtube viewer", "cached youtube video finder", "view archived private youtube videos", "find private video title and description", "retrieve unlisted video info",
    // 29. Channel History Viewer
    "youtube channel history viewer", "youtube wayback channel stats", "see old youtube channel layout", "archive of youtube channel", "historical youtube stats viewer", "track old youtube subscriber counts",
    // 30. Age Restricted Viewer
    "youtube age restricted viewer", "check age restriction youtube", "bypass age restricted youtube video", "why is youtube video age restricted", "age gate checker youtube",
    // 31. Dislike Checker
    "youtube dislike checker", "return youtube dislike", "see youtube dislikes online", "youtube dislike counter", "check dislikes on youtube video", "how to see dislikes on youtube 2026", "youtube dislike ratio checker",
    // 32. Like Counter
    "youtube like counter", "real time youtube like counter", "youtube like to view ratio", "check exact youtube likes", "live youtube video like tracker", "accurate youtube likes checker",
    // Yearly & Future variations (2026 - 2035)
    "youtube creator tools 2026", "youtube seo guide 2026", "youtube monetization rules 2026", "youtube rpm rates 2026", "youtube cpm rates 2026", "best free youtube tools 2026", "youtube earnings per 1000 views 2026", "how to grow youtube channel 2026",
    "youtube creator tools 2027", "youtube earnings calculator 2027", "youtube algorithm 2027", "youtube seo 2027",
    "youtube creator tools 2028", "youtube money calculator 2028", "youtube growth tools 2028",
    "youtube creator tools 2029", "youtube earnings 2029", "youtube channel optimization 2029",
    "youtube creator tools 2030", "youtube creator toolkit 2030", "youtube ai tools 2030",
    "youtube tools 2031", "youtube tools 2032", "youtube tools 2033", "youtube tools 2034", "youtube tools 2035",
    // Long-tail high volume queries
    "how to download youtube videos without software", "best sites to download youtube videos", "youtube tag generator free", "youtube video tag finder online", "how much money does a youtuber make with 1 million subscribers", "how much money does 1 million views make on youtube", "how to get monetized on youtube without 1000 subscribers", "youtube monetization requirements 2026", "how to check if a youtube video is copyright protected", "free copyright free music for vloggers", "youtube shorts rpm calculator", "how much does youtube pay for 10 million shorts views", "youtube tags for gaming videos", "best youtube tags for tech channel", "find tags from popular youtube videos", "download youtube video in 1080p full hd free", "free online youtube downloader no registration", "extract audio from youtube video free", "youtube mp3 320kbps downloader", "youtube thumbnail grabber in 4k", "youtube high quality thumbnail save", "how to find deleted youtube videos with url", "wayback machine youtube video player", "view removed youtube video", "check unlisted youtube video", "unlisted youtube video finder", "check youtube shadowban comment not showing", "why are my youtube comments not showing up", "shadowban youtube appeal", "fix youtube channel low views", "youtube algorithm boost tools", "free youtube backlink maker", "youtube rank tracker free online", "see exact number of dislikes on youtube", "how to restore youtube dislike button", "check youtube channel id with handle", "find my channel id youtube", "what is my youtube channel id"
  ],
  icons: {
    icon: '/logo.png',
    apple: '/logo.png',
  },
  openGraph: {
    title: "YT Toolkits | Free YouTube Creator Tools, Downloaders & Analytics Suite",
    description: "The ultimate toolkit for YouTube creators. 32 free tools to download videos, check monetization, extract tags, calculate revenue, and grow your channel.",
    url: 'https://yttoolkits.site',
    siteName: 'YTToolkits',
    locale: 'en_US',
    type: 'website',
  },
  twitter: {
    card: 'summary_large_image',
    site: '@YTToolkits',
  },
  alternates: {
    canonical: 'https://yttoolkits.site',
  },
  verification: {
    google: 'placeholder',
  },
};

export const viewport = {
  width: 'device-width',
  initialScale: 1,
  maximumScale: 1,
  userScalable: false,
};

const navCategories = [
  {
    title: "Core & Downloaders",
    links: [
      { name: "Video Downloader", href: "/video-downloader" },
      { name: "Thumbnail Downloader", href: "/thumbnail-downloader" },
      { name: "Profile Picture", href: "/profile-picture-downloader" },
      { name: "Embed Viewer", href: "/embed-viewer" },
      { name: "Link Viewer", href: "/link-viewer" },
    ]
  },
  {
    title: "Calculators & Revenue",
    links: [
      { name: "Earnings Calculator", href: "/earnings-calculator" },
      { name: "Views to Money", href: "/views-to-money" },
      { name: "Watch Time Calc", href: "/watch-time-calculator" },
      { name: "Video Money Calc", href: "/video-money-calculator" },
      { name: "Live Stream Calc", href: "/live-stream-calculator" },
    ]
  },
  {
    title: "SEO & Metadata",
    links: [
      { name: "Tag Extractor", href: "/tag-extractor" },
      { name: "SEO Score Checker", href: "/seo-score-checker" },
      { name: "Rank Checker", href: "/rank-checker" },
      { name: "Hashtag Generator", href: "/hashtag-generator" },
      { name: "Channel ID Finder", href: "/channel-id-finder" },
    ]
  },
  {
    title: "Archive & Privacy",
    links: [
      { name: "Deleted Video Finder", href: "/deleted-video-finder" },
      { name: "Private Video Checker", href: "/private-video-checker" },
      { name: "Shadowban Detector", href: "/shadowban-detector" },
      { name: "Monetization Checker", href: "/monetization-checker" },
      { name: "Age Restricted Viewer", href: "/age-restricted-viewer" },
    ]
  }
];

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en" className="dark">
      <body className={`${inter.className} bg-zinc-950 text-zinc-50 min-h-screen flex flex-col`}>
        {/* Google Analytics */}
        <Script src="https://www.googletagmanager.com/gtag/js?id=G-9FCDSCNF1W" strategy="afterInteractive" />
        <Script id="google-analytics" strategy="afterInteractive">
          {`
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());
            gtag('config', 'G-9FCDSCNF1W');
          `}
        </Script>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{
            __html: JSON.stringify({
              "@context": "https://schema.org",
              "@type": "Organization",
              "name": "YTToolkits",
              "url": "https://yttoolkits.site",
              "logo": "https://yttoolkits.site/favicon.ico"
            })
          }}
        />
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{
            __html: JSON.stringify({
              "@context": "https://schema.org",
              "@type": "WebSite",
              "name": "YTToolkits",
              "url": "https://yttoolkits.site",
              "potentialAction": {
                "@type": "SearchAction",
                "target": "https://yttoolkits.site/tools?q={search_term_string}",
                "query-input": "required name=search_term_string"
              }
            })
          }}
        />
        {/* Header */}
        <header className="border-b border-zinc-800 bg-zinc-950/80 backdrop-blur-md sticky top-0 z-50">
          <div className="container mx-auto px-3 sm:px-4 h-14 sm:h-16 flex items-center justify-between">
            <Link href="/" className="flex items-center gap-1.5 sm:gap-2 text-red-500 font-bold text-lg sm:text-xl tracking-tight">
              <PlaySquare className="w-5 h-5 sm:w-6 sm:h-6" />
              <span className="text-zinc-100">YT<span className="text-red-500">Toolkits</span></span>
            </Link>

            <nav className="hidden md:flex items-center gap-6 text-sm font-medium text-zinc-400">
              <Link href="/" className="hover:text-zinc-100 transition-colors">Home</Link>
              
              {/* Tools Dropdown */}
              <div className="relative group">
                <button className="flex items-center gap-1 hover:text-zinc-100 transition-colors py-4">
                  Tools <ChevronDown className="w-3 h-3" />
                </button>
                <div className="absolute top-[100%] left-0 w-[640px] bg-zinc-900 border border-zinc-800 rounded-xl shadow-2xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 overflow-hidden">
                  <div className="grid grid-cols-2 md:grid-cols-4 p-4 gap-4">
                    {navCategories.map((category, idx) => (
                      <div key={idx}>
                        <p className="px-2 py-1 text-[11px] font-bold text-zinc-500 uppercase tracking-wider mb-1">{category.title}</p>
                        {category.links.map((tool) => (
                          <Link key={tool.href} href={tool.href} className="block px-2 py-1.5 text-xs text-zinc-400 hover:text-white hover:bg-zinc-800/50 rounded-md transition-colors whitespace-nowrap">
                            {tool.name}
                          </Link>
                        ))}
                      </div>
                    ))}
                  </div>
                  <div className="bg-zinc-950 p-4 border-t border-zinc-800 flex justify-between items-center">
                    <span className="text-xs text-zinc-500">Access all 32 free creator tools</span>
                    <Link href="/tools" className="text-sm text-red-400 hover:text-red-300 font-medium transition-colors flex items-center gap-1">
                      View Directory <PlaySquare className="w-4 h-4" />
                    </Link>
                  </div>
                </div>
              </div>

              <Link href="/blog" className="hover:text-zinc-100 transition-colors">Blog</Link>
              <Link href="/about" className="hover:text-zinc-100 transition-colors">About</Link>
              <Link href="/contact" className="hover:text-zinc-100 transition-colors">Contact</Link>
            </nav>

            <div className="flex items-center gap-2 sm:gap-4">
              <Link href="/tools" className="hidden sm:flex text-zinc-400 hover:text-zinc-100 p-2 bg-zinc-900 rounded-full border border-zinc-800" title="Explore All Tools">
                <Wrench className="w-4 h-4" />
              </Link>
              <MobileMenu />
            </div>
          </div>
        </header>

        {/* Main Content */}
        <main className="flex-1">
          {children}
        </main>

        {/* Footer */}
        <footer className="border-t border-zinc-800 bg-zinc-950 py-10 sm:py-16 mt-8 sm:mt-12">
          <div className="container mx-auto px-3 sm:px-4 grid grid-cols-2 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-5 gap-6 sm:gap-8">
            <div className="col-span-2 lg:col-span-2">
              <Link href="/" className="flex items-center gap-2 text-red-500 font-bold text-xl sm:text-2xl tracking-tight mb-3 sm:mb-4">
                <PlaySquare className="w-6 h-6 sm:w-8 sm:h-8" />
                <span className="text-zinc-100">YT<span className="text-red-500">Toolkits</span></span>
              </Link>
              <p className="text-zinc-400 text-xs sm:text-sm leading-relaxed max-w-sm mb-4 sm:mb-6">
                The ultimate free creator toolkit with 32 specialized tools to analyze channels, optimize video SEO, calculate revenue, and grow faster in 2026. Free, fast, and no registration required.
              </p>
            </div>
            <div>
              <h3 className="font-semibold text-zinc-100 mb-3 sm:mb-4 text-sm sm:text-base">Core & Analysis</h3>
              <ul className="space-y-1.5 sm:space-y-2 text-xs sm:text-sm text-zinc-400">
                <li><Link href="/shadowban-detector" className="hover:text-red-400 transition-colors">Shadowban Detector</Link></li>
                <li><Link href="/monetization-checker" className="hover:text-red-400 transition-colors">Monetization Checker</Link></li>
                <li><Link href="/seo-score-checker" className="hover:text-red-400 transition-colors">SEO Score Checker</Link></li>
                <li><Link href="/rank-checker" className="hover:text-red-400 transition-colors">Rank Checker</Link></li>
                <li><Link href="/channel-id-finder" className="hover:text-red-400 transition-colors">Channel ID Finder</Link></li>
                <li><Link href="/tag-extractor" className="hover:text-red-400 transition-colors">Tag Extractor</Link></li>
              </ul>
            </div>
            <div>
              <h3 className="font-semibold text-zinc-100 mb-3 sm:mb-4 text-sm sm:text-base">Calculators & Money</h3>
              <ul className="space-y-1.5 sm:space-y-2 text-xs sm:text-sm text-zinc-400">
                <li><Link href="/earnings-calculator" className="hover:text-red-400 transition-colors">Earnings Calculator</Link></li>
                <li><Link href="/views-to-money" className="hover:text-red-400 transition-colors">Views to Money</Link></li>
                <li><Link href="/watch-time-calculator" className="hover:text-red-400 transition-colors">Watch Time Calculator</Link></li>
                <li><Link href="/video-money-calculator" className="hover:text-red-400 transition-colors">Video Money Calculator</Link></li>
                <li><Link href="/advanced-money-calculator" className="hover:text-red-400 transition-colors">Advanced Money Calc</Link></li>
                <li><Link href="/live-stream-calculator" className="hover:text-red-400 transition-colors">Live Stream Calc</Link></li>
              </ul>
            </div>
            <div>
              <h3 className="font-semibold text-zinc-100 mb-3 sm:mb-4 text-sm sm:text-base">Resources & Tools</h3>
              <ul className="space-y-1.5 sm:space-y-2 text-xs sm:text-sm text-zinc-400">
                <li><Link href="/blog" className="hover:text-red-400 transition-colors font-medium text-red-400">Blog & Guides</Link></li>
                <li><Link href="/deleted-video-finder" className="hover:text-red-400 transition-colors">Deleted Video Finder</Link></li>
                <li><Link href="/thumbnail-downloader" className="hover:text-red-400 transition-colors">Thumbnail Downloader</Link></li>
                <li><Link href="/comment-sentiment" className="hover:text-red-400 transition-colors">Comment Sentiment</Link></li>
                <li><Link href="/royalty-free-music" className="hover:text-red-400 transition-colors">Royalty Free Music</Link></li>
                <li><Link href="/tools" className="hover:text-red-400 transition-colors font-semibold text-red-500">View All 32 Tools &rarr;</Link></li>
              </ul>
            </div>
          </div>
          <div className="container mx-auto px-3 sm:px-4 mt-10 sm:mt-16 pt-6 sm:pt-8 border-t border-zinc-900 flex flex-col md:flex-row justify-between items-center gap-3 sm:gap-4 text-xs sm:text-sm text-zinc-500">
            <div className="text-center md:text-left">&copy; {new Date().getFullYear()} YTToolkits.site. All rights reserved. Not affiliated with YouTube.</div>
            <div className="flex flex-wrap justify-center gap-3 sm:gap-4">
              <Link href="/tools" className="hover:text-zinc-300">All Tools</Link>
              <Link href="/blog" className="hover:text-zinc-300">Blog & Guides</Link>
              <Link href="/about" className="hover:text-zinc-300">About Us</Link>
              <Link href="/contact" className="hover:text-zinc-300">Contact</Link>
              <Link href="/privacy-policy" className="hover:text-zinc-300">Privacy Policy</Link>
              <Link href="/terms" className="hover:text-zinc-300">Terms of Service</Link>
            </div>
          </div>
        </footer>
      </body>
    </html>
  );
}
