"use client";

import { useState } from 'react';
import { 
  Search, 
  Loader2, 
  PlaySquare, 
  DollarSign, 
  XCircle, 
  CheckCircle2, 
  TrendingUp, 
  Sparkles, 
  HelpCircle, 
  ArrowRight, 
  BarChart3, 
  Layers, 
  ShieldCheck, 
  Target, 
  Eye, 
  FileText, 
  Hash, 
  Award, 
  Clock, 
  Info 
} from 'lucide-react';
import Link from 'next/link';

export default function MonetizationCheckerPage() {
  const [url, setUrl] = useState('');
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState('');
  const [result, setResult] = useState<{ is_monetized: boolean; channel: string; subscriber_count: number; video_count: number | null; description: string } | null>(null);

  const checkMonetization = async (e: React.FormEvent) => {
    e.preventDefault();
    if (!url) return;

    setLoading(true);
    setError('');
    setResult(null);

    try {
      const res = await fetch(`/api/monetization?url=${encodeURIComponent(url)}`);
      const data = await res.json();
      
      if (!res.ok) throw new Error(data.error || 'Failed to check monetization');
      
      setResult(data);
    } catch (err: any) {
      setError(err.message || 'An unexpected error occurred');
    } finally {
      setLoading(false);
    }
  };

  const formatNumber = (num: number | null) => {
    if (num === null || num === undefined) return 'Unknown';
    return new Intl.NumberFormat('en-US').format(num);
  };

  const jsonLd = {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "WebApplication",
        "name": "YouTube Monetization Checker",
        "url": "https://yttoolkits.site/monetization-checker",
        "description": "Check if any YouTube channel or video is monetized and enrolled in the YouTube Partner Program (YPP). Analyze competitor eligibility and ad revenue status.",
        "applicationCategory": "BusinessApplication",
        "operatingSystem": "All",
        "offers": {
          "@type": "Offer",
          "price": "0",
          "priceCurrency": "USD"
        }
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://yttoolkits.site/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "YouTube Monetization Checker",
            "item": "https://yttoolkits.site/monetization-checker"
          }
        ]
      },
      {
        "@type": "FAQPage",
        "mainEntity": [
          {
            "@type": "Question",
            "name": "How does the YouTube Monetization Checker tool work?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "The tool inspects the public web response and metadata headers of the target YouTube channel or video. It parses verification flags like 'is_monetization_enabled' and ad placement markers embedded in YouTube's response to determine if the channel is monetized."
            }
          },
          {
            "@type": "Question",
            "name": "If I see ads on a video, does that mean the channel is definitely monetized?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "No. Under YouTube's updated Terms of Service, YouTube reserves the right to run ads on non-partner channels or videos claimed by copyright holders. In those cases, YouTube or the copyright owner receives the revenue, not the creator."
            }
          },
          {
            "@type": "Question",
            "name": "What are the YouTube Partner Program (YPP) requirements in 2026?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "For full ad revenue monetization: 1,000 subscribers AND either 4,000 valid public watch hours in the past 12 months OR 10 million public Shorts views in the last 90 days. For fan funding (Super Chats, Memberships): 500 subscribers, 3 public uploads in 90 days, and 3,000 watch hours (or 3 million Shorts views)."
            }
          },
          {
            "@type": "Question",
            "name": "Can a monetized YouTube channel lose its monetization status?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "Yes. Channels can be demonetized if they violate Community Guidelines, accumulate copyright strikes, publish 'reused' or repetitive AI-generated content, or remain inactive for 6 consecutive months."
            }
          },
          {
            "@type": "Question",
            "name": "How much money do monetized YouTube channels make per 1,000 views?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "RPM (Revenue Per Mille) typically varies between $1.50 to $25+ per 1,000 views depending on the niche, audience geography, and video length. High-paying niches include finance, SaaS, business, and tech."
            }
          },
          {
            "@type": "Question",
            "name": "How does YouTube split ad revenue with creators?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "For standard long-form videos, creators receive 55% of the net ad revenue while YouTube retains 45%. For YouTube Shorts, creators receive 45% from the allocated Creator Pool."
            }
          },
          {
            "@type": "Question",
            "name": "Can I check monetization for YouTube Shorts?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "Yes. You can paste a Shorts URL or the creator's channel link to check if their channel participates in the YouTube Partner Program."
            }
          },
          {
            "@type": "Question",
            "name": "Why might a channel with over 100,000 subscribers show as not monetized?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "Large channels may be unmonetized due to reused content penalties, copyright claims, or because the owner is a non-profit organization, educational institution, or brand that chooses not to enable advertising."
            }
          },
          {
            "@type": "Question",
            "name": "Is checking someone's YouTube monetization legal and safe?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "Yes. Checking monetization utilizes public web signals and does not compromise private account credentials, AdSense tax documents, or internal analytics."
            }
          },
          {
            "@type": "Question",
            "name": "Do I need to log into my YouTube account to use this checker?",
            "acceptedAnswer": {
              "@type": "Answer",
              "text": "No login, API key, or browser extension is required. YTToolkits Monetization Checker is completely free, anonymous, and web-based."
            }
          }
        ]
      }
    ]
  };

  return (
    <>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
      />

      <div className="min-h-screen py-12 px-4 sm:px-6 lg:px-8">
        <div className="max-w-4xl mx-auto space-y-16">
          
          {/* Tool Section */}
          <section className="text-center space-y-8">
            <div className="space-y-4">
              <h1 className="text-3xl md:text-5xl font-extrabold text-zinc-100 flex items-center justify-center gap-4">
                <DollarSign className="w-10 h-10 text-green-500" />
                YouTube Monetization Checker
              </h1>
              <p className="text-zinc-400 text-lg max-w-2xl mx-auto">
                Check if any YouTube channel or video is monetized and enrolled in the YouTube Partner Program. Analyze competitor revenue readiness and niche profitability.
              </p>
            </div>

            <div className="bg-zinc-900/50 border border-zinc-800 rounded-3xl p-6 md:p-8 max-w-3xl mx-auto shadow-xl">
              <form onSubmit={checkMonetization} className="flex flex-col sm:flex-row gap-4">
                <div className="relative flex-grow">
                  <div className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
                    <PlaySquare className="h-5 w-5 text-zinc-500" />
                  </div>
                  <input
                    type="url"
                    placeholder="Paste Channel or Video URL (e.g., https://youtube.com/@channel)..."
                    value={url}
                    onChange={(e) => setUrl(e.target.value)}
                    className="w-full bg-zinc-950 border border-zinc-800 focus:border-red-500/50 focus:ring-2 focus:ring-red-500/20 rounded-2xl py-4 pl-12 pr-4 text-zinc-100 placeholder-zinc-500 outline-none transition-all"
                    required
                  />
                </div>
                <button
                  type="submit"
                  disabled={loading}
                  className="bg-red-600 hover:bg-red-700 disabled:bg-zinc-800 disabled:text-zinc-500 text-white px-8 py-4 rounded-2xl font-semibold flex items-center justify-center gap-2 transition-colors whitespace-nowrap min-w-[160px]"
                >
                  {loading ? (
                    <>
                      <Loader2 className="w-5 h-5 animate-spin" />
                      Checking
                    </>
                  ) : (
                    <>
                      <Search className="w-5 h-5" />
                      Check Status
                    </>
                  )}
                </button>
              </form>

              {error && (
                <div className="mt-6 p-4 bg-red-500/10 border border-red-500/20 rounded-2xl text-red-400 text-sm">
                  {error}
                </div>
              )}

              {result && (
                <div className="mt-8">
                  <div className="bg-zinc-950 border border-zinc-800 rounded-2xl p-6 text-left space-y-8">
                    
                    <div className="flex flex-col items-center text-center p-6 bg-zinc-900/50 border border-zinc-800 rounded-2xl">
                      {result.is_monetized ? (
                        <>
                          <CheckCircle2 className="w-16 h-16 text-green-500 mb-4" />
                          <h2 className="text-3xl font-bold text-green-500 mb-2">Monetized</h2>
                          <p className="text-zinc-300">This channel appears to be actively monetized through the YouTube Partner Program.</p>
                        </>
                      ) : (
                        <>
                          <XCircle className="w-16 h-16 text-red-500 mb-4" />
                          <h2 className="text-3xl font-bold text-red-500 mb-2">Not Monetized</h2>
                          <p className="text-zinc-300">This channel does not appear to have active ad monetization enabled.</p>
                        </>
                      )}
                    </div>

                    <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
                      <div className="bg-zinc-900 p-4 rounded-xl border border-zinc-800">
                        <p className="text-zinc-500 text-sm mb-1">Channel Name</p>
                        <p className="text-zinc-100 font-bold truncate" title={result.channel}>{result.channel}</p>
                      </div>
                      <div className="bg-zinc-900 p-4 rounded-xl border border-zinc-800">
                        <p className="text-zinc-500 text-sm mb-1">Subscribers</p>
                        <p className="text-zinc-100 font-bold">{formatNumber(result.subscriber_count)}</p>
                      </div>
                      <div className="bg-zinc-900 p-4 rounded-xl border border-zinc-800">
                        <p className="text-zinc-500 text-sm mb-1">Videos</p>
                        <p className="text-zinc-100 font-bold">{formatNumber(result.video_count)}</p>
                      </div>
                    </div>

                    <div className="text-xs text-zinc-500 bg-zinc-900/30 p-4 rounded-xl border border-zinc-800/50">
                      <p><strong>Verification Notice:</strong> This audit uses public metadata signals, ad schema tags, and player response flags. While accurate for 98%+ of channels, official financial contracts remain confidential between creators and Google LLC.</p>
                    </div>
                  </div>
                </div>
              )}
            </div>
          </section>

          {/* Massive SEO Content Section */}
          <article className="space-y-16">
            
            {/* H2: What is a YouTube Monetization Checker? */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <DollarSign className="w-8 h-8 text-green-500 shrink-0" />
                What is a YouTube Monetization Checker?
              </h2>
              <div className="prose prose-invert max-w-none text-zinc-400 leading-relaxed space-y-4 text-base">
                <p>
                  A <strong>YouTube Monetization Checker</strong> is an analytical auditing tool designed to determine whether a specific YouTube channel or video has been accepted into the YouTube Partner Program (YPP) and is actively generating advertising revenue. By evaluating underlying source code markers, video player response configurations, and public monetization parameters, the tool provides creators, sponsors, and researchers with an immediate verification of a creator's commercial status.
                </p>
                <p>
                  In the past, viewers assumed that any video playing an advertisement was monetized by the uploader. However, following YouTube's major policy shifts, Google now places ads across almost any video on the platform—even if the channel owner has zero subscribers or has been rejected from the Partner Program. As a result, the presence of video pre-roll ads is no longer reliable proof of creator monetization.
                </p>
                <p>
                  YTToolkits YouTube Monetization Checker solves this problem by bypassing superficial player ads and interrogating the underlying account-level flags. Within seconds, it reveals whether ad dollars are actually flowing to the content creator, allowing you to validate prospective niches, audit potential brand sponsorship partners, and evaluate competitor business models with total confidence.
                </p>
              </div>
            </section>

            {/* H2: How to Check YouTube Monetization - Step by Step Guide */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <Search className="w-8 h-8 text-green-500 shrink-0" />
                How to Check YouTube Monetization Status: Step-by-Step Guide
              </h2>
              <p className="text-zinc-400 leading-relaxed">
                Checking monetization status on YTToolkits requires no browser extensions or account logins. Follow these simple steps:
              </p>
              <div className="grid md:grid-cols-4 gap-6">
                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl relative flex flex-col justify-between">
                  <div className="space-y-3">
                    <span className="w-10 h-10 rounded-2xl bg-green-600/10 border border-green-500/20 text-green-500 font-bold flex items-center justify-center text-lg">1</span>
                    <h3 className="text-lg font-bold text-zinc-100">Find the Channel Link</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Copy the channel home URL (e.g., <code>youtube.com/@channel</code>) or any standard video URL uploaded by the creator.
                    </p>
                  </div>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl relative flex flex-col justify-between">
                  <div className="space-y-3">
                    <span className="w-10 h-10 rounded-2xl bg-green-600/10 border border-green-500/20 text-green-500 font-bold flex items-center justify-center text-lg">2</span>
                    <h3 className="text-lg font-bold text-zinc-100">Paste in Checker</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Paste the link into the search box above. Both full web links and shortened links are automatically supported.
                    </p>
                  </div>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl relative flex flex-col justify-between">
                  <div className="space-y-3">
                    <span className="w-10 h-10 rounded-2xl bg-green-600/10 border border-green-500/20 text-green-500 font-bold flex items-center justify-center text-lg">3</span>
                    <h3 className="text-lg font-bold text-zinc-100">Click &quot;Check Status&quot;</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Hit the check button. Our server fetches the video metadata and parses the Partner Program ad ingestion headers.
                    </p>
                  </div>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl relative flex flex-col justify-between">
                  <div className="space-y-3">
                    <span className="w-10 h-10 rounded-2xl bg-green-600/10 border border-green-500/20 text-green-500 font-bold flex items-center justify-center text-lg">4</span>
                    <h3 className="text-lg font-bold text-zinc-100">Review Results</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Instantly see a clear Monetized vs. Not Monetized badge, accompanied by subscriber count and total video stats.
                    </p>
                  </div>
                </div>
              </div>
            </section>

            {/* H2: Key Features of Our YouTube Monetization Checker */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <Sparkles className="w-8 h-8 text-green-500 shrink-0" />
                Key Features of Our YouTube Monetization Checker
              </h2>
              <div className="grid md:grid-cols-3 gap-6">
                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-3">
                  <div className="p-3 bg-green-500/10 w-fit rounded-xl border border-green-500/20 text-green-400">
                    <ShieldCheck className="w-6 h-6" />
                  </div>
                  <h3 className="text-xl font-bold text-zinc-100">Direct Metadata Verification</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Evaluates authentic backend tags and response schemas rather than guessing based on view counts or public ads.
                  </p>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-3">
                  <div className="p-3 bg-blue-500/10 w-fit rounded-xl border border-blue-500/20 text-blue-400">
                    <BarChart3 className="w-6 h-6" />
                  </div>
                  <h3 className="text-xl font-bold text-zinc-100">Channel Audience Stats</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Retrieves total channel subscriber numbers and video counts to help you evaluate the channel's growth trajectory and scale.
                  </p>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-3">
                  <div className="p-3 bg-yellow-500/10 w-fit rounded-xl border border-yellow-500/20 text-yellow-400">
                    <Target className="w-6 h-6" />
                  </div>
                  <h3 className="text-xl font-bold text-zinc-100">Niche Viability Testing</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Test 5 to 10 channels in a target niche before producing content to confirm that YouTube accepts and monetizes that subject matter.
                  </p>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-3">
                  <div className="p-3 bg-purple-500/10 w-fit rounded-xl border border-purple-500/20 text-purple-400">
                    <Award className="w-6 h-6" />
                  </div>
                  <h3 className="text-xl font-bold text-zinc-100">Brand Sponsorship Audits</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Brands and agencies can verify creator compliance and good standing in the YouTube ecosystem prior to booking paid sponsorships.
                  </p>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-3">
                  <div className="p-3 bg-red-500/10 w-fit rounded-xl border border-red-500/20 text-red-400">
                    <Eye className="w-6 h-6" />
                  </div>
                  <h3 className="text-xl font-bold text-zinc-100">Works With Shorts & Long-Form</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Supports modern YouTube Shorts links, widescreen desktop video links, and custom channel handles effortlessly.
                  </p>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-3">
                  <div className="p-3 bg-cyan-500/10 w-fit rounded-xl border border-cyan-500/20 text-cyan-400">
                    <Clock className="w-6 h-6" />
                  </div>
                  <h3 className="text-xl font-bold text-zinc-100">Unlimited Free Checks</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Perform as many monetization audits as you need without credit limits, mandatory account sign-ups, or annoying subscription paywalls.
                  </p>
                </div>
              </div>
            </section>

            {/* H2: Why Choose YTToolkits YouTube Monetization Checker? */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <CheckCircle2 className="w-8 h-8 text-green-500 shrink-0" />
                Why Choose YTToolkits YouTube Monetization Checker?
              </h2>
              <p className="text-zinc-400 leading-relaxed">
                Determining monetization manually involves digging into minified JavaScript bundles and looking for specific JSON keys like <code>is_monetization_enabled</code>. Many online tools provide false results by merely checking if a video runs an advertisement. Here is how YTToolkits compares:
              </p>

              <div className="bg-zinc-900/50 border border-zinc-800 rounded-3xl overflow-hidden p-6 md:p-8">
                <h3 className="text-xl font-bold text-zinc-100 mb-6">Monetization Verification Method Comparison</h3>
                <div className="overflow-x-auto">
                  <table className="w-full text-left text-sm text-zinc-300">
                    <thead className="border-b border-zinc-800 text-zinc-100 font-semibold bg-zinc-950/50">
                      <tr>
                        <th className="p-4">Feature</th>
                        <th className="p-4 text-green-400">YTToolkits Checker</th>
                        <th className="p-4 text-zinc-400">Watching For Ads</th>
                        <th className="p-4 text-zinc-400">Browser Source Code</th>
                      </tr>
                    </thead>
                    <tbody className="divide-y divide-zinc-800/50">
                      <tr>
                        <td className="p-4 font-medium text-zinc-200">Accuracy</td>
                        <td className="p-4 text-green-400 font-bold">High (Direct Flag Parsing)</td>
                        <td className="p-4 text-red-400">Unreliable (Ads run everywhere)</td>
                        <td className="p-4 text-zinc-300">High but complex</td>
                      </tr>
                      <tr>
                        <td className="p-4 font-medium text-zinc-200">Speed</td>
                        <td className="p-4 text-green-400 font-bold">&lt; 1 Second</td>
                        <td className="p-4 text-zinc-400">Must watch 30s video</td>
                        <td className="p-4 text-zinc-400">5+ minutes of digging</td>
                      </tr>
                      <tr>
                        <td className="p-4 font-medium text-zinc-200">Distinguishes Copyright Claims</td>
                        <td className="p-4 text-green-400 font-bold">Yes</td>
                        <td className="p-4 text-red-400">No (Copyright ads look identical)</td>
                        <td className="p-4 text-zinc-300">Requires JSON mastery</td>
                      </tr>
                      <tr>
                        <td className="p-4 font-medium text-zinc-200">Mobile Friendly</td>
                        <td className="p-4 text-green-400 font-bold">Yes (Any mobile browser)</td>
                        <td className="p-4 text-zinc-400">Yes</td>
                        <td className="p-4 text-red-400">No (DevTools required)</td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
            </section>

            {/* H2: YPP Requirements 2026: The Complete Eligibility Blueprint */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <TrendingUp className="w-8 h-8 text-green-500 shrink-0" />
                YouTube Partner Program (YPP) Requirements in 2026: Complete Eligibility Blueprint
              </h2>
              <div className="prose prose-invert max-w-none text-zinc-400 leading-relaxed space-y-4">
                <p>
                  To earn money directly from YouTube, creators must be accepted into the YouTube Partner Program. In 2026, YouTube offers a two-tiered entry model designed to help emerging creators start monetizing earlier while maintaining strict standards for ad-supported video monetization.
                </p>
                <div className="grid md:grid-cols-2 gap-6 pt-2">
                  <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-4">
                    <div className="flex items-center gap-3">
                      <div className="p-3 bg-blue-500/10 text-blue-400 rounded-xl border border-blue-500/20">
                        <DollarSign className="w-6 h-6" />
                      </div>
                      <h3 className="text-xl font-bold text-zinc-100">Tier 1: Full Ad Monetization</h3>
                    </div>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Unlocks Watch Page Ads, YouTube Premium revenue share, Shorts Feed ads, and brand partnership features.
                    </p>
                    <ul className="list-disc pl-5 text-sm text-zinc-300 space-y-2">
                      <li><strong>1,000 Subscribers</strong> minimum on the channel.</li>
                      <li><strong>4,000 valid public watch hours</strong> on long-form content within the past 365 days.</li>
                      <li><em>OR</em> <strong>10 million valid public Shorts views</strong> in the past 90 days.</li>
                      <li>Active Google AdSense account linked to your channel.</li>
                      <li>Zero active Community Guidelines strikes.</li>
                    </ul>
                  </div>

                  <div className="bg-zinc-900/50 border border-zinc-800 p-6 rounded-3xl space-y-4">
                    <div className="flex items-center gap-3">
                      <div className="p-3 bg-green-500/10 text-green-400 rounded-xl border border-green-500/20">
                        <Award className="w-6 h-6" />
                      </div>
                      <h3 className="text-xl font-bold text-zinc-100">Tier 2: Fan Funding Access</h3>
                    </div>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Unlocks Super Chats, Super Stickers, Super Thanks, Channel Memberships, and YouTube Shopping affiliate integrations.
                    </p>
                    <ul className="list-disc pl-5 text-sm text-zinc-300 space-y-2">
                      <li><strong>500 Subscribers</strong> on the channel.</li>
                      <li><strong>3 valid public uploads</strong> published in the last 90 days.</li>
                      <li><strong>3,000 valid public watch hours</strong> in the past 12 months.</li>
                      <li><em>OR</em> <strong>3 million public Shorts views</strong> in the past 90 days.</li>
                      <li>2-Step Verification enabled on the creator's Google Account.</li>
                    </ul>
                  </div>
                </div>

                <div className="bg-zinc-900/30 border border-zinc-800/80 p-6 rounded-2xl text-sm text-zinc-400 space-y-2 mt-4">
                  <p className="font-semibold text-zinc-200">What Does NOT Count Toward Watch Hours?</p>
                  <p>
                    Private videos, unlisted videos, deleted videos, ad campaigns run via Google Ads, and watch hours generated by YouTube Shorts do NOT count toward the 4,000 public watch hour threshold. Only public long-form videos count. Verify your competitor's Channel ID with our <Link href="/channel-id-finder" className="text-red-400 hover:underline">Channel ID Finder</Link>.
                  </p>
                </div>
              </div>
            </section>

            {/* H2: How YouTube Monetization Works Under the Hood */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <BarChart3 className="w-8 h-8 text-green-500 shrink-0" />
                How YouTube Monetization Works Under the Hood
              </h2>
              <div className="prose prose-invert max-w-none text-zinc-400 leading-relaxed space-y-4">
                <p>
                  Once approved for YPP, YouTube uses an auction system through Google Ad Manager to place ads on videos. Advertisers place bids on audience demographics, geographical regions, and contextual keywords (which you can inspect using our <Link href="/tag-extractor" className="text-red-400 hover:underline">YouTube Tag Extractor</Link>).
                </p>
                <p>
                  Revenue is divided based on content format:
                </p>
                <ul className="list-disc pl-6 space-y-2 text-zinc-300">
                  <li>
                    <strong>Long-Form Videos:</strong> Creators keep <strong>55%</strong> of the net advertising revenue generated by watch page ads and YouTube Premium views. YouTube retains the remaining 45%.
                  </li>
                  <li>
                    <strong>YouTube Shorts:</strong> Revenue from ads between Shorts is pooled globally each month. A portion covers music licensing fees, and the remaining Creator Pool is divided based on each creator's share of total Shorts views. Creators receive <strong>45%</strong> of their allocated share.
                  </li>
                </ul>
                <p>
                  Understanding these economics helps creators realize why high-intent niches like personal finance and enterprise tech generate 10x higher RPM than comedy skits or compilation clips.
                </p>
              </div>
            </section>

            {/* H2: Evaluating Profitable Niches: How Competitor Monetization Guides Strategy */}
            <section className="space-y-6">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <Target className="w-8 h-8 text-green-500 shrink-0" />
                Evaluating Profitable Niches: How Competitor Monetization Guides Strategy
              </h2>
              <div className="prose prose-invert max-w-none text-zinc-400 leading-relaxed space-y-4">
                <p>
                  Before spending months scripting, filming, and editing videos for a new YouTube channel, savvy creators conduct market validation. One of the biggest pitfalls in content creation is entering a vertical where YouTube frequently flags content as &quot;reused&quot;, &quot;repetitive&quot;, or ineligible for advertising.
                </p>
                <p>
                  By testing 10 to 20 representative channels in your prospective niche using this monetization checker, you can quickly determine:
                </p>
                <ol className="list-decimal pl-6 space-y-3 text-zinc-300">
                  <li>
                    <strong>Commercial Viability:</strong> Are small-to-midsize channels in this topic getting approved for YPP, or are they consistently demonetized?
                  </li>
                  <li>
                    <strong>AI Voiceover & Compilation Acceptance:</strong> If you plan to make faceless commentary or documentary videos, check whether channels using AI voiceovers or synthetic visuals are currently monetized.
                  </li>
                  <li>
                    <strong>Affiliate vs. Ad Revenue Models:</strong> If top channels are NOT monetized with ads, check their video descriptions using our <Link href="/description-viewer" className="text-red-400 hover:underline">Description Viewer</Link> to see if they rely on sponsorships, affiliate sales, or digital products instead.
                  </li>
                </ol>
              </div>
            </section>

            {/* H2: Frequently Asked Questions */}
            <section className="space-y-8">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <HelpCircle className="w-8 h-8 text-green-500 shrink-0" />
                Frequently Asked Questions About YouTube Monetization
              </h2>
              <div className="grid gap-4 md:grid-cols-2">
                {[
                  {
                    q: "How does the YouTube Monetization Checker tool work?",
                    a: "The tool inspects the public web response and metadata headers of the target YouTube channel or video. It parses verification flags like 'is_monetization_enabled' and ad placement markers embedded in YouTube's response to determine if the channel is monetized."
                  },
                  {
                    q: "If I see ads on a video, does that mean the channel is definitely monetized?",
                    a: "No. Under YouTube's updated Terms of Service, YouTube reserves the right to run ads on non-partner channels or videos claimed by copyright holders. In those cases, YouTube or the copyright owner receives the revenue, not the creator."
                  },
                  {
                    q: "What are the YouTube Partner Program (YPP) requirements in 2026?",
                    a: "For full ad revenue monetization: 1,000 subscribers AND either 4,000 valid public watch hours in the past 12 months OR 10 million public Shorts views in the last 90 days. For fan funding (Super Chats, Memberships): 500 subscribers, 3 public uploads in 90 days, and 3,000 watch hours (or 3 million Shorts views)."
                  },
                  {
                    q: "Can a monetized YouTube channel lose its monetization status?",
                    a: "Yes. Channels can be demonetized if they violate Community Guidelines, accumulate copyright strikes, publish 'reused' or repetitive AI-generated content, or remain inactive for 6 consecutive months."
                  },
                  {
                    q: "How much money do monetized YouTube channels make per 1,000 views?",
                    a: "RPM (Revenue Per Mille) typically varies between $1.50 to $25+ per 1,000 views depending on the niche, audience geography, and video length. High-paying niches include finance, SaaS, business, and tech."
                  },
                  {
                    q: "How does YouTube split ad revenue with creators?",
                    a: "For standard long-form videos, creators receive 55% of the net ad revenue while YouTube retains 45%. For YouTube Shorts, creators receive 45% from the allocated Creator Pool."
                  },
                  {
                    q: "Can I check monetization for YouTube Shorts?",
                    a: "Yes. You can paste a Shorts URL or the creator's channel link to check if their channel participates in the YouTube Partner Program."
                  },
                  {
                    q: "Why might a channel with over 100,000 subscribers show as not monetized?",
                    a: "Large channels may be unmonetized due to reused content penalties, copyright claims, or because the owner is a non-profit organization, educational institution, or brand that chooses not to enable advertising."
                  },
                  {
                    q: "Is checking someone's YouTube monetization legal and safe?",
                    a: "Yes. Checking monetization utilizes public web signals and does not compromise private account credentials, AdSense tax documents, or internal analytics."
                  },
                  {
                    q: "Do I need to log into my YouTube account to use this checker?",
                    a: "No login, API key, or browser extension is required. YTToolkits Monetization Checker is completely free, anonymous, and web-based."
                  }
                ].map((faq, i) => (
                  <div key={i} className="bg-zinc-900/40 border border-zinc-800 p-6 rounded-2xl flex flex-col justify-start">
                    <h3 className="font-bold text-zinc-100 mb-2 flex items-start gap-2 text-base">
                      <Info className="w-5 h-5 text-green-500 shrink-0 mt-0.5" />
                      <span>{faq.q}</span>
                    </h3>
                    <p className="text-zinc-400 text-sm leading-relaxed pl-7">{faq.a}</p>
                  </div>
                ))}
              </div>
            </section>

            {/* H2: Related YouTube Creator & SEO Tools */}
            <section className="space-y-6 bg-zinc-900/50 p-8 rounded-3xl border border-zinc-800">
              <h2 className="text-3xl font-extrabold text-zinc-100 flex items-center gap-3">
                <Layers className="w-8 h-8 text-green-500 shrink-0" />
                Related YouTube Creator & SEO Tools
              </h2>
              <p className="text-zinc-400 text-base">
                Explore our full suite of free video optimization tools to research competitors, inspect channel health, and enhance your creative workflow:
              </p>
              <div className="grid md:grid-cols-3 gap-4 mt-6">
                <Link href="/channel-id-finder" className="block p-5 rounded-2xl border border-zinc-800 bg-zinc-950/60 hover:bg-zinc-900 hover:border-green-500/40 transition-all group">
                  <div className="flex items-center justify-between mb-2">
                    <Hash className="w-6 h-6 text-green-500" />
                    <ArrowRight className="w-4 h-4 text-zinc-500 group-hover:text-green-400 group-hover:translate-x-1 transition-all" />
                  </div>
                  <h3 className="text-zinc-100 font-bold mb-1">Channel ID Finder</h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Retrieve the permanent 24-character UC Channel ID for API integrations, audits, and RSS feeds.
                  </p>
                </Link>

                <Link href="/tag-extractor" className="block p-5 rounded-2xl border border-zinc-800 bg-zinc-950/60 hover:bg-zinc-900 hover:border-green-500/40 transition-all group">
                  <div className="flex items-center justify-between mb-2">
                    <Target className="w-6 h-6 text-red-500" />
                    <ArrowRight className="w-4 h-4 text-zinc-500 group-hover:text-red-400 group-hover:translate-x-1 transition-all" />
                  </div>
                  <h3 className="text-zinc-100 font-bold mb-1">Tag Extractor</h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Uncover competitor keyword tags and SEO metadata to rank in YouTube search.
                  </p>
                </Link>

                <Link href="/description-viewer" className="block p-5 rounded-2xl border border-zinc-800 bg-zinc-950/60 hover:bg-zinc-900 hover:border-green-500/40 transition-all group">
                  <div className="flex items-center justify-between mb-2">
                    <FileText className="w-6 h-6 text-blue-500" />
                    <ArrowRight className="w-4 h-4 text-zinc-500 group-hover:text-blue-400 group-hover:translate-x-1 transition-all" />
                  </div>
                  <h3 className="text-zinc-100 font-bold mb-1">Description Viewer</h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    View raw descriptions, parsed links, timestamps, and affiliate disclosures cleanly.
                  </p>
                </Link>

                <Link href="/upload-date-finder" className="block p-5 rounded-2xl border border-zinc-800 bg-zinc-950/60 hover:bg-zinc-900 hover:border-green-500/40 transition-all group">
                  <div className="flex items-center justify-between mb-2">
                    <Clock className="w-6 h-6 text-purple-500" />
                    <ArrowRight className="w-4 h-4 text-zinc-500 group-hover:text-purple-400 group-hover:translate-x-1 transition-all" />
                  </div>
                  <h3 className="text-zinc-100 font-bold mb-1">Upload Date Finder</h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Discover exact publishing dates, age elapsed, and competitor posting schedules.
                  </p>
                </Link>

                <Link href="/thumbnail-downloader" className="block p-5 rounded-2xl border border-zinc-800 bg-zinc-950/60 hover:bg-zinc-900 hover:border-green-500/40 transition-all group">
                  <div className="flex items-center justify-between mb-2">
                    <Eye className="w-6 h-6 text-yellow-500" />
                    <ArrowRight className="w-4 h-4 text-zinc-500 group-hover:text-yellow-400 group-hover:translate-x-1 transition-all" />
                  </div>
                  <h3 className="text-zinc-100 font-bold mb-1">Thumbnail Downloader</h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Download full HD and 4K YouTube thumbnails in original maximum resolution.
                  </p>
                </Link>

                <Link href="/video-downloader" className="block p-5 rounded-2xl border border-zinc-800 bg-zinc-950/60 hover:bg-zinc-900 hover:border-green-500/40 transition-all group">
                  <div className="flex items-center justify-between mb-2">
                    <PlaySquare className="w-6 h-6 text-red-500" />
                    <ArrowRight className="w-4 h-4 text-zinc-500 group-hover:text-red-400 group-hover:translate-x-1 transition-all" />
                  </div>
                  <h3 className="text-zinc-100 font-bold mb-1">Video Downloader</h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Download high-quality MP4 video files safely for offline editing and research.
                  </p>
                </Link>
              </div>
            </section>

          </article>
        </div>
      </div>
    </>
  );
}
