'use client';

import { useState } from 'react';
import Link from 'next/link';
import { 
  PlaySquare, Search, CheckCircle, XCircle, AlertTriangle, 
  ShieldCheck, HelpCircle, ArrowRight, Eye, ShieldAlert, 
  BarChart3, RefreshCw, Zap, Award, CheckCircle2 
} from 'lucide-react';

export default function ShadowbanDetectorPage() {
  const [url, setUrl] = useState('');
  const [loading, setLoading] = useState(false);
  const [result, setResult] = useState<any>(null);
  const [error, setError] = useState('');

  const analyzeChannel = async (e: React.FormEvent) => {
    e.preventDefault();
    setLoading(true);
    setError('');
    setResult(null);

    try {
      const response = await fetch('/api/shadowban', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ url }),
      });
      
      const data = await response.json();
      if (!response.ok) throw new Error(data.error || 'Failed to analyze channel');
      
      setResult(data);
    } catch (err: any) {
      setError(err.message);
    } finally {
      setLoading(false);
    }
  };

  return (
    <>
      {/* Structured Data: WebApplication & FAQPage */}
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{
          __html: JSON.stringify({
            "@context": "https://schema.org",
            "@graph": [
              {
                "@type": "WebApplication",
                "name": "YTToolkits YouTube Shadowban Detector",
                "url": "https://yttoolkits.site/shadowban-detector",
                "applicationCategory": "AnalyticsApplication",
                "operatingSystem": "All",
                "offers": {
                  "@type": "Offer",
                  "price": "0",
                  "priceCurrency": "USD"
                },
                "description": "Analyze your YouTube channel for algorithmic penalties, shadowbans, search visibility restrictions, and comment ghosting with our free detector."
              },
              {
                "@type": "FAQPage",
                "mainEntity": [
                  {
                    "@type": "Question",
                    "name": "What is a YouTube shadowban?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "A YouTube shadowban is an unofficial algorithmic suppression where a channel's videos are hidden from search suggestions, browse feeds, and recommended carousels without any formal notification or Community Guidelines strike."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "Does YouTube officially acknowledge shadowbans?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Officially, YouTube representatives claim that the platform does not possess a specific 'shadowban button'. However, YouTube openly admits to using algorithmic filtering to demote borderline content, suppress clickbait, and hide comments deemed toxic or spammy."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "What causes a channel to be shadowbanned on YouTube?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Common triggers include excessive keyword stuffing in tags and descriptions, mass commenting across other channels, sudden spikes in suspicious bot engagement, multiple copyright claims, using blacklisted keywords, or borderline violations of YouTube community policies."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "How long does a YouTube shadowban typically last?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Algorithmic visibility penalties usually last anywhere from 48 hours to 90 days. If the underlying policy or metadata triggers are resolved quickly, channels often see natural algorithmic recommendation resume within two to four weeks."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "Can you fix a YouTube shadowban?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Yes. You can recover by purging misleading tags, removing repeated affiliate links, auditing title metadata, halting any third-party engagement services, and consistently publishing high-retention, compliant videos."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "How do I check if my YouTube comments are shadowbanned?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Post a comment on an external video, copy the comment URL or navigate to the video in an incognito window without logging into your Google account. If your comment is invisible in incognito mode, it has been ghosted or held for review."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "Is a shadowban the same as a Community Guidelines strike?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "No. A Community Guidelines strike is an explicit, documented enforcement event displayed inside YouTube Studio that limits uploading permissions. A shadowban is a quiet algorithmic throttling that provides zero notifications."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "Does changing my video tags remove a shadowban?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Removing spammy, misleading, or overloaded tags helps the recommendation engine re-evaluate your video indexation and reduces metadata spam penalties over the following crawl cycles."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "Can purchasing fake views or subscribers cause a shadowban?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Yes. YouTube's automated fraud detection filters detect unnatural spikes in retention, viewer IP anomalies, and click farm patterns, which immediately suppresses video distribution to protect platform advertisers."
                    }
                  },
                  {
                    "@type": "Question",
                    "name": "Will my subscribers still see my videos if I am shadowbanned?",
                    "acceptedAnswer": {
                      "@type": "Answer",
                      "text": "Usually, your direct subscriber feed remains intact, but push notifications and home feed suggestions may be severely restricted or delayed, resulting in a dramatic collapse in first-24-hour velocity."
                    }
                  }
                ]
              }
            ]
          })
        }}
      />

      <div className="min-h-screen bg-zinc-950 text-zinc-100 py-12 px-4 md:px-8 lg:px-16">
        <div className="max-w-4xl mx-auto space-y-12">
          {/* Header */}
          <div className="text-center space-y-4">
            <div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-red-500/10 border border-red-500/20 text-xs sm:text-sm text-red-400 mb-2">
              <ShieldAlert className="w-4 h-4" />
              Algorithmic Health & Visibility Audit
            </div>
            <h1 className="text-3xl md:text-5xl font-extrabold flex items-center justify-center gap-3">
              <AlertTriangle className="w-10 h-10 text-red-500" />
              YouTube Shadowban Detector
            </h1>
            <p className="text-zinc-400 max-w-2xl mx-auto text-base sm:text-lg">
              Check if your YouTube channel is experiencing limited visibility, search suppression, recommendation penalties, or comment ghosting with our comprehensive audit tool.
            </p>
          </div>

          {/* Input Card */}
          <div className="bg-zinc-900/50 border border-zinc-800 rounded-3xl p-6 md:p-8 shadow-xl">
            <form onSubmit={analyzeChannel} className="flex flex-col md:flex-row gap-4">
              <input
                type="url"
                placeholder="Paste YouTube channel URL (e.g., https://youtube.com/@channel)"
                value={url}
                onChange={(e) => setUrl(e.target.value)}
                required
                className="flex-1 bg-zinc-950 border border-zinc-800 focus:border-red-500/50 focus:ring-2 focus:ring-red-500/20 rounded-2xl px-6 py-4 outline-none transition-all text-zinc-100 placeholder-zinc-500"
              />
              <button
                type="submit"
                disabled={loading}
                className="bg-red-600 hover:bg-red-700 text-white rounded-2xl px-8 py-4 font-semibold flex items-center justify-center gap-2 transition-colors disabled:opacity-50"
              >
                {loading ? (
                  <div className="w-6 h-6 border-2 border-white/30 border-t-white rounded-full animate-spin" />
                ) : (
                  <>
                    <Search className="w-5 h-5" />
                    Analyze Channel
                  </>
                )}
              </button>
            </form>
            {error && (
              <p className="text-red-500 mt-4 text-sm bg-red-500/10 p-3 rounded-xl border border-red-500/20">
                {error}
              </p>
            )}
          </div>

          {/* Results Section */}
          {result && (
            <div className="space-y-6">
              <div className="bg-zinc-900/50 border border-zinc-800 rounded-3xl p-6 md:p-8">
                <h2 className="text-2xl font-bold mb-4">Channel Details</h2>
                <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
                  <div className="bg-zinc-950 p-4 rounded-2xl border border-zinc-800">
                    <p className="text-zinc-500 text-sm">Channel Name</p>
                    <p className="font-semibold text-lg truncate">{result.channelName}</p>
                  </div>
                  <div className="bg-zinc-950 p-4 rounded-2xl border border-zinc-800">
                    <p className="text-zinc-500 text-sm">Subscribers</p>
                    <p className="font-semibold text-lg">{result.subscriberCount?.toLocaleString() || 'Hidden'}</p>
                  </div>
                  <div className="bg-zinc-950 p-4 rounded-2xl border border-zinc-800">
                    <p className="text-zinc-500 text-sm">Videos</p>
                    <p className="font-semibold text-lg">{result.videoCount || 0}</p>
                  </div>
                  <div className="bg-zinc-950 p-4 rounded-2xl border border-zinc-800">
                    <p className="text-zinc-500 text-sm">Country</p>
                    <p className="font-semibold text-lg">{result.country || 'Global'}</p>
                  </div>
                </div>
              </div>

              <div className="bg-zinc-900/50 border border-zinc-800 rounded-3xl p-6 md:p-8">
                <h2 className="text-2xl font-bold mb-6">Status Checklist</h2>
                <div className="space-y-4">
                  <StatusItem label="Search Visibility" status={result.status?.searchVisibility} />
                  <StatusItem label="Recommendation Eligibility" status={result.status?.recommendationEligibility} />
                  <StatusItem label="Comment Visibility" status={result.status?.commentVisibility} />
                  <StatusItem label="Monetization Status (Estimated)" status={result.status?.monetizationStatus} />
                </div>
              </div>
            </div>
          )}

          {/* MASSIVE SEO CONTENT SECTION (2000+ Words) */}
          <article className="pt-12 space-y-16 border-t border-zinc-800">
            
            {/* Section 1: What is a YouTube Shadowban? */}
            <section className="space-y-4">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                What is a YouTube Shadowban?
              </h2>
              <div className="text-zinc-400 space-y-4 leading-relaxed">
                <p>
                  A YouTube shadowban—frequently termed algorithmic suppression, ghost banning, or stealth demotion—describes a scenario in which the YouTube recommendation and search architecture intentionally limits or hides a creator&apos;s uploads without issuing any formal alert or strike. Unlike transparent moderation events like Community Guidelines strikes or copyright claims that trigger red warnings inside YouTube Studio, a shadowban operates quietly behind the scenes. Creators continue to upload videos, publish descriptions, and engage with comments, entirely oblivious to the reality that their content is invisible to viewers browsing search results, home recommendations, and suggested video sidebars.
                </p>
                <p>
                  While YouTube product liaisons have asserted on public forums that no literal &ldquo;shadowban button&rdquo; exists inside their engineering dashboards, machine learning research and patent filings from Google reveal a more nuanced reality. The platform actively relies on automated classifier systems that tag channels as &ldquo;borderline content,&rdquo; &ldquo;spam,&rdquo; or &ldquo;low quality advertiser risk.&rdquo; When a channel trips these automated tripwires, its distribution score is drastically reduced across browse features, search autocomplete, and notification routing.
                </p>
                <p>
                  The operational impact on an active channel is catastrophic. Video impressions often crash by 80% to 98% overnight. Longtime subscribers stop receiving push notifications, videos vanish from target search query pages, and comments posted on other creators&apos; channels are silently ghosted so that only the original author can view them. For digital entrepreneurs, YouTubers, and commercial brands depending on organic discovery, identifying whether your channel has fallen under algorithmic throttling is essential to restoring your digital reach.
                </p>
              </div>
            </section>

            {/* Section 2: How to Use the Shadowban Detector */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                How to Use the YouTube Shadowban Detector - Step-by-Step Guide
              </h2>
              <p className="text-zinc-400 leading-relaxed">
                Auditing your channel&apos;s algorithmic health with YTToolkits requires no technical expertise, API tokens, or login credentials. Follow our four-step diagnostic workflow to assess your channel status:
              </p>
              <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6">
                  <div className="text-red-500 font-extrabold text-2xl mb-2">01</div>
                  <h3 className="text-lg font-bold text-zinc-100 mb-2">Obtain Channel URL or Handle</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Navigate to YouTube on your desktop browser or mobile application. Copy your full channel URL (such as <code className="text-zinc-300 bg-zinc-950 px-2 py-0.5 rounded">https://youtube.com/@channelname</code>) or custom handle directly from your address bar. If you need your raw identifier, our <Link href="/channel-id-finder" className="text-red-400 hover:underline">Channel ID Finder</Link> can locate it instantly.
                  </p>
                </div>
                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6">
                  <div className="text-red-500 font-extrabold text-2xl mb-2">02</div>
                  <h3 className="text-lg font-bold text-zinc-100 mb-2">Paste URL into the Search Field</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Insert the copied link into the input box above. Ensure the URL format is valid and points to a public YouTube channel rather than an unlisted private playlist or individual video timestamp.
                  </p>
                </div>
                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6">
                  <div className="text-red-500 font-extrabold text-2xl mb-2">03</div>
                  <h3 className="text-lg font-bold text-zinc-100 mb-2">Run Algorithmic Visibility Analysis</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Click &ldquo;Analyze Channel&rdquo;. Our cloud scanners will query live YouTube search indexes, metadata registries, crawl feeds, and comment parsers to measure whether your uploads show normal distribution behavior.
                  </p>
                </div>
                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6">
                  <div className="text-red-500 font-extrabold text-2xl mb-2">04</div>
                  <h3 className="text-lg font-bold text-zinc-100 mb-2">Review Status Checklist</h3>
                  <p className="text-zinc-400 text-sm leading-relaxed">
                    Inspect the four diagnostic indicators: Search Visibility, Recommendation Eligibility, Comment Visibility, and Estimated Monetization Health. Any red flag indicates an area requiring immediate remediation.
                  </p>
                </div>
              </div>
            </section>

            {/* Section 3: Key Features */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                Key Features of Our YouTube Shadowban Detector
              </h2>
              <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6 flex items-start gap-4">
                  <div className="p-3 bg-red-500/10 rounded-xl text-red-500 shrink-0">
                    <Search className="w-6 h-6" />
                  </div>
                  <div>
                    <h3 className="text-lg font-bold text-zinc-100 mb-1">Search Index Verification</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Scans public YouTube search indexing to check whether your channel brand, exact video titles, and main keywords appear in standard user search queries.
                    </p>
                  </div>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6 flex items-start gap-4">
                  <div className="p-3 bg-purple-500/10 rounded-xl text-purple-400 shrink-0">
                    <BarChart3 className="w-6 h-6" />
                  </div>
                  <div>
                    <h3 className="text-lg font-bold text-zinc-100 mb-1">Recommendation Velocity Check</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Evaluates whether your channel is flagged as ineligible for the &ldquo;Up Next&rdquo; sidebar, home screen carousel, and YouTube Shorts recommendation shelf.
                    </p>
                  </div>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6 flex items-start gap-4">
                  <div className="p-3 bg-blue-500/10 rounded-xl text-blue-400 shrink-0">
                    <Eye className="w-6 h-6" />
                  </div>
                  <div>
                    <h3 className="text-lg font-bold text-zinc-100 mb-1">Comment Ghosting Detection</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Determines if your account has been placed into YouTube&apos;s automated comment spam quarantine, preventing your community engagement from showing up to others.
                    </p>
                  </div>
                </div>

                <div className="bg-zinc-900/50 border border-zinc-800 rounded-2xl p-6 flex items-start gap-4">
                  <div className="p-3 bg-green-500/10 rounded-xl text-green-400 shrink-0">
                    <ShieldCheck className="w-6 h-6" />
                  </div>
                  <div>
                    <h3 className="text-lg font-bold text-zinc-100 mb-1">Zero Credentials Required</h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Your channel remains 100% secure. We do not require OAuth authorization, channel permissions, Google passwords, or browser extension installations.
                    </p>
                  </div>
                </div>
              </div>
            </section>

            {/* Section 4: Why Choose YTToolkits */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                Why Choose YTToolkits YouTube Shadowban Detector?
              </h2>
              <div className="text-zinc-400 space-y-4 leading-relaxed">
                <p>
                  Diagnosing algorithmic penalties on YouTube is notoriously difficult because YouTube provides no official diagnostics panel. Many third-party websites attempt to capitalize on creator anxiety by charging monthly subscriptions for basic metadata scrapes or asking for full Google account administrative access. YTToolkits was engineered by YouTube SEO and growth engineers to deliver high-precision, completely free diagnostics without compromising channel security.
                </p>
              </div>
              <div className="overflow-x-auto">
                <table className="w-full text-left border-collapse bg-zinc-900/40 rounded-2xl border border-zinc-800">
                  <thead>
                    <tr className="border-b border-zinc-800 text-zinc-100 text-sm">
                      <th className="p-4">Feature Metric</th>
                      <th className="p-4 text-red-400 font-semibold">YTToolkits Detector</th>
                      <th className="p-4 text-zinc-500">Manual Incognito Check</th>
                      <th className="p-4 text-zinc-500">Generic SEO Tools</th>
                    </tr>
                  </thead>
                  <tbody className="text-sm divide-y divide-zinc-800/60 text-zinc-300">
                    <tr>
                      <td className="p-4 font-medium">Pricing / Subscription</td>
                      <td className="p-4 text-green-400 font-bold">100% Free Forever</td>
                      <td className="p-4">Free (Manual)</td>
                      <td className="p-4 text-red-400">$29 - $99 / Month</td>
                    </tr>
                    <tr>
                      <td className="p-4 font-medium">Login / Channel Access</td>
                      <td className="p-4 text-green-400">Never Required</td>
                      <td className="p-4">None</td>
                      <td className="p-4 text-red-400">Demands OAuth Access</td>
                    </tr>
                    <tr>
                      <td className="p-4 font-medium">Comprehensive Check</td>
                      <td className="p-4 text-green-400">Search + Feed + Comments</td>
                      <td className="p-4">Search Only</td>
                      <td className="p-4">Basic Tags Only</td>
                    </tr>
                    <tr>
                      <td className="p-4 font-medium">Speed of Execution</td>
                      <td className="p-4 text-green-400">Under 3 Seconds</td>
                      <td className="p-4">15-30 Minutes</td>
                      <td className="p-4">Several Minutes</td>
                    </tr>
                    <tr>
                      <td className="p-4 font-medium">Cross-Tool Compatibility</td>
                      <td className="p-4 text-green-400">Integrates with 30+ Tools</td>
                      <td className="p-4">None</td>
                      <td className="p-4">Isolated Tool</td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </section>

            {/* Section 5: Educational Deep Dive */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                Signs of a YouTube Shadowban vs. Normal Algorithm Shifts
              </h2>
              <div className="text-zinc-400 space-y-4 leading-relaxed">
                <p>
                  Before jumping to conclusions and assuming malicious algorithmic intent, creators must learn how to differentiate between true algorithmic penalization and common organic audience shifts. YouTube&apos;s recommendation engine updates its ranking models dozens of times each month, factoring in shifting seasonal trends, school schedules, competing viral uploads, and viewer retention fatigue.
                </p>
                <p>
                  When your channel is experiencing standard organic fluctuation, impressions may dip gradually over several weeks. However, your videos will still show up when you search their exact title in quotation marks inside an incognito window. Your existing subscribers will still receive notifications if they have the bell icon enabled, and your comment replies will remain visible to other users. You can evaluate your video metadata health with our <Link href="/seo-score-checker" className="text-red-400 hover:underline">YouTube SEO Score Checker</Link> to ensure your content is fully structured for organic search.
                </p>
                <p>
                  In contrast, a genuine shadowban or algorithmic strike exhibits distinct characteristics:
                </p>
                <div className="grid grid-cols-1 md:grid-cols-2 gap-4 pt-2">
                  <div className="bg-zinc-900/30 border border-zinc-800/80 rounded-2xl p-5 space-y-2">
                    <div className="flex items-center gap-2 text-red-400 font-bold">
                      <XCircle className="w-5 h-5 shrink-0" />
                      Total Zero-Impression Clifftops
                    </div>
                    <p className="text-sm text-zinc-400">
                      YouTube Studio analytics reveal a sudden vertical drop in impressions from &ldquo;Suggested Videos&rdquo; and &ldquo;Browse Features&rdquo; to virtually zero within 24 hours across recent uploads.
                    </p>
                  </div>
                  <div className="bg-zinc-900/30 border border-zinc-800/80 rounded-2xl p-5 space-y-2">
                    <div className="flex items-center gap-2 text-red-400 font-bold">
                      <XCircle className="w-5 h-5 shrink-0" />
                      Search Query Disappearance
                    </div>
                    <p className="text-sm text-zinc-400">
                      Even when searching the precise, verbatim video title using incognito mode with filtering set to &ldquo;Uploaded This Week&rdquo;, your video is completely absent from all search pages.
                    </p>
                  </div>
                  <div className="bg-zinc-900/30 border border-zinc-800/80 rounded-2xl p-5 space-y-2">
                    <div className="flex items-center gap-2 text-red-400 font-bold">
                      <XCircle className="w-5 h-5 shrink-0" />
                      Subscriber Notification Blackout
                    </div>
                    <p className="text-sm text-zinc-400">
                      Core community members report that push alerts, subscription feed cards, and community tab polls have vanished without explanation.
                    </p>
                  </div>
                  <div className="bg-zinc-900/30 border border-zinc-800/80 rounded-2xl p-5 space-y-2">
                    <div className="flex items-center gap-2 text-red-400 font-bold">
                      <XCircle className="w-5 h-5 shrink-0" />
                      Comment Ghosting Penalty
                    </div>
                    <p className="text-sm text-zinc-400">
                      When leaving replies on other creators&apos; videos or your own community tab, the comment is instantly filtered by YouTube&apos;s auto-moderator and only visible while logged in.
                    </p>
                  </div>
                </div>
              </div>
            </section>

            {/* Section 6: How to Fix a Shadowban */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                Action Plan: How to Recover and Lift a YouTube Shadowban
              </h2>
              <div className="text-zinc-400 space-y-4 leading-relaxed">
                <p>
                  If our detector flags your channel or your analytics match the symptoms of an algorithmic penalty, don&apos;t panic. Because shadowbans are almost always governed by automated machine-learning classifiers rather than permanent manual employee bans, taking deliberate corrective actions can reset your channel&apos;s safety score. Follow this comprehensive recovery protocol:
                </p>
                <div className="space-y-4">
                  <div className="bg-zinc-900/40 border border-zinc-800 rounded-2xl p-6">
                    <h3 className="text-lg font-bold text-zinc-100 mb-2 flex items-center gap-2">
                      <span className="w-7 h-7 rounded-lg bg-red-600/20 text-red-400 flex items-center justify-center text-sm font-extrabold">1</span>
                      Perform a Metadata Cleanse Across Recent Uploads
                    </h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      YouTube penalizes metadata stuffing heavily. Open your last 10-20 uploads in YouTube Studio. Remove lists of comma-separated keywords dumped into the description box. Delete misleading or sensationalized tags that do not accurately describe the video content. Check your video tags with our <Link href="/tag-extractor" className="text-red-400 hover:underline">Tag Extractor</Link> to ensure you are strictly following contextual relevance.
                    </p>
                  </div>

                  <div className="bg-zinc-900/40 border border-zinc-800 rounded-2xl p-6">
                    <h3 className="text-lg font-bold text-zinc-100 mb-2 flex items-center gap-2">
                      <span className="w-7 h-7 rounded-lg bg-red-600/20 text-red-400 flex items-center justify-center text-sm font-extrabold">2</span>
                      Audit External Links and Affiliate Disclaimers
                    </h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      Automated classifiers frequently penalize channels that repeatedly link to unverified landing pages, URL shorteners, adult domains, or unlicensed cryptocurrency exchanges. Ensure all outgoing links use clean, direct domains and include proper FTC disclosures.
                    </p>
                  </div>

                  <div className="bg-zinc-900/40 border border-zinc-800 rounded-2xl p-6">
                    <h3 className="text-lg font-bold text-zinc-100 mb-2 flex items-center gap-2">
                      <span className="w-7 h-7 rounded-lg bg-red-600/20 text-red-400 flex items-center justify-center text-sm font-extrabold">3</span>
                      Cease Mass Commenting & Aggressive Self-Promotion
                    </h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      If you or an assistant have been commenting on popular videos with promotional phrases like &ldquo;check out my channel&rdquo; or identical copy-pasted comments, YouTube&apos;s spam filters will blacklist your user ID. Cease this behavior immediately and allow the spam timeout filter to expire over 7 to 14 days.
                    </p>
                  </div>

                  <div className="bg-zinc-900/40 border border-zinc-800 rounded-2xl p-6">
                    <h3 className="text-lg font-bold text-zinc-100 mb-2 flex items-center gap-2">
                      <span className="w-7 h-7 rounded-lg bg-red-600/20 text-red-400 flex items-center justify-center text-sm font-extrabold">4</span>
                      Publish High-Quality, Compliant Video Content Consistently
                    </h3>
                    <p className="text-zinc-400 text-sm leading-relaxed">
                      The fastest way to demonstrate algorithmic rehabilitation is by feeding YouTube&apos;s AI positive behavioral data. Upload 2 to 3 pristine, family-friendly, high-retention videos that comply 100% with advertiser guidelines. As real viewers watch these uploads with positive engagement and low dislike ratios (which you can check with our <Link href="/dislike-checker" className="text-red-400 hover:underline">Dislike Checker</Link>), YouTube&apos;s trust score will gradually recover.
                    </p>
                  </div>
                </div>
              </div>
            </section>

            {/* Section 7: YouTube Algorithm Transparency */}
            <section className="space-y-4">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                YouTube Algorithm Transparency: What the Official Policy Says
              </h2>
              <div className="text-zinc-400 space-y-4 leading-relaxed">
                <p>
                  Over the past five years, YouTube has published several Creator Insider updates and whitepapers detailing how their recommendation neural networks function. According to platform engineers, recommendations are not driven by a top-down editorial team, but by dynamic viewer behavior models that analyze Click-Through Rate (CTR), Average View Duration (AVD), viewer satisfaction surveys, and &ldquo;Not Interested&rdquo; survey feedback.
                </p>
                <p>
                  However, YouTube officially recognizes &ldquo;Borderline Content&rdquo; policies. In their official transparency reports, YouTube confirms that their systems reduce the distribution of content that brushes right against the edge of violating Community Guidelines without explicitly crossing the line. Examples include sensationalist conspiracy theories, unsubstantiated health claims, clickbait sexualization, and aggressive confrontation. Rather than banning the channel, the recommendation model assigns a dampening multiplier, effectively hiding the content from general recommendation carousels.
                </p>
                <p>
                  Recognizing this operational dynamic empowers creators. By respecting platform thresholds, staying clear of misleading metadata, and auditing your channel with tools like YTToolkits, you ensure your channel maintains full recommendation eligibility across the global creator ecosystem.
                </p>
              </div>
            </section>

            {/* Section 8: Frequently Asked Questions (Accordion) */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                Frequently Asked Questions
              </h2>
              <p className="text-zinc-400">
                Detailed answers to the most common questions creators ask about algorithmic shadowbans and YouTube account safety:
              </p>
              <div className="space-y-4">
                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>What is a YouTube shadowban?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    A YouTube shadowban is an informal term describing algorithmic suppression where a channel&apos;s content is quietly deprioritized or hidden from search results, suggested video lists, and home recommendations without warning or strikes.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>Does YouTube officially acknowledge shadowbans?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Officially, YouTube denies the existence of intentional &ldquo;shadowbans&rdquo;. However, they openly document algorithmic systems designed to suppress &ldquo;borderline content,&rdquo; limit recommendation reach for controversial topics, and auto-filter spammy comments.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>What causes a channel to get shadowbanned?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Common triggers include excessive keyword stuffing in descriptions, using restricted tags, leaving promotional comments on other channels, buying artificial views or subscribers, copyright disputes, and uploading content flagged as borderline harmful or misleading.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>How long does a shadowban last?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Depending on the underlying cause, algorithmic penalties typically persist for anywhere from 7 days to 3 months. Once corrective actions are implemented and compliant videos are published, the algorithm usually reassesses the channel within 2 to 4 weeks.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>How do I know if my comments are ghosted?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Post a comment on a public video, copy the link, and open the video inside a private/incognito browser window without signing into Google. If your comment does not appear in the comment thread, YouTube has placed an algorithmic hold on your comments.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>Can buying subscribers or views trigger a shadowban?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Yes. YouTube employs sophisticated bot-detection algorithms that recognize artificial spikes in retention, mismatched geolocations, and click farm profiles. Channels caught using automated view services are quickly suppressed.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>Is a shadowban identical to a Community Guidelines strike?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    No. A strike is an official, transparent penalty recorded inside YouTube Studio that limits your upload privileges for a week or more. A shadowban produces no notification and leaves you able to upload, but strips your content of organic distribution.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>Does deleting flagged videos lift the penalty?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Setting problematic videos to private or unlisted is generally preferable to outright deletion, as deletion permanently deletes watch history and engagement signals. However, removing policy-violating videos completely clears the metadata from search crawl indexes.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>How can I check if my channel is monetized?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    You can use our companion <Link href="/monetization-checker" className="text-red-400 hover:underline font-medium">YouTube Monetization Checker</Link> to inspect whether your channel is verified and serving official AdSense ad units.
                  </p>
                </details>

                <details className="bg-zinc-900/40 border border-zinc-800/80 rounded-2xl p-5 cursor-pointer group">
                  <summary className="font-bold text-lg text-zinc-100 group-hover:text-red-400 transition-colors list-none flex items-center justify-between">
                    <span>Does contacting TeamYouTube help with shadowbans?</span>
                    <HelpCircle className="w-5 h-5 text-zinc-500 group-hover:text-red-400 transition-colors" />
                  </summary>
                  <p className="mt-3 text-zinc-400 leading-relaxed text-sm">
                    Reaching out to @TeamYouTube on X (formerly Twitter) or creator support can help if your account has suffered an obvious technical bug or false automated strike. While support cannot manually adjust recommendation rankings, they can confirm whether your account is in good operational standing.
                  </p>
                </details>
              </div>
            </section>

            {/* Section 9: Related YouTube Tools */}
            <section className="space-y-6">
              <h2 className="text-2xl md:text-4xl font-extrabold text-zinc-100">
                Explore More Free YouTube Tools
              </h2>
              <p className="text-zinc-400 leading-relaxed">
                Elevate your channel optimization and diagnostics with our full collection of creator utilities:
              </p>
              <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
                <Link
                  href="/seo-score-checker"
                  className="p-5 bg-zinc-900/40 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700 rounded-2xl transition-all group block"
                >
                  <div className="p-3 bg-zinc-950 rounded-xl border border-zinc-800 w-fit mb-3 group-hover:scale-105 transition-transform text-red-500">
                    <Search className="w-5 h-5" />
                  </div>
                  <h3 className="font-semibold text-zinc-100 group-hover:text-red-400 transition-colors mb-1">
                    SEO Score Checker
                  </h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Audit video title lengths, descriptions, tags, and overall search discoverability score.
                  </p>
                </Link>

                <Link
                  href="/monetization-checker"
                  className="p-5 bg-zinc-900/40 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700 rounded-2xl transition-all group block"
                >
                  <div className="p-3 bg-zinc-950 rounded-xl border border-zinc-800 w-fit mb-3 group-hover:scale-105 transition-transform text-green-500">
                    <BarChart3 className="w-5 h-5" />
                  </div>
                  <h3 className="font-semibold text-zinc-100 group-hover:text-green-400 transition-colors mb-1">
                    Monetization Checker
                  </h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Instantly verify if any channel or video is generating active YouTube Partner Program revenue.
                  </p>
                </Link>

                <Link
                  href="/dislike-checker"
                  className="p-5 bg-zinc-900/40 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700 rounded-2xl transition-all group block"
                >
                  <div className="p-3 bg-zinc-950 rounded-xl border border-zinc-800 w-fit mb-3 group-hover:scale-105 transition-transform text-red-500">
                    <PlaySquare className="w-5 h-5" />
                  </div>
                  <h3 className="font-semibold text-zinc-100 group-hover:text-red-400 transition-colors mb-1">
                    Dislike Checker
                  </h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Reveal hidden YouTube dislike metrics and view exact audience satisfaction ratios.
                  </p>
                </Link>

                <Link
                  href="/tag-extractor"
                  className="p-5 bg-zinc-900/40 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700 rounded-2xl transition-all group block"
                >
                  <div className="p-3 bg-zinc-950 rounded-xl border border-zinc-800 w-fit mb-3 group-hover:scale-105 transition-transform text-blue-500">
                    <Zap className="w-5 h-5" />
                  </div>
                  <h3 className="font-semibold text-zinc-100 group-hover:text-blue-400 transition-colors mb-1">
                    Tag Extractor
                  </h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Extract hidden video metadata and competitor keywords with a single click.
                  </p>
                </Link>

                <Link
                  href="/channel-id-finder"
                  className="p-5 bg-zinc-900/40 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700 rounded-2xl transition-all group block"
                >
                  <div className="p-3 bg-zinc-950 rounded-xl border border-zinc-800 w-fit mb-3 group-hover:scale-105 transition-transform text-purple-500">
                    <Award className="w-5 h-5" />
                  </div>
                  <h3 className="font-semibold text-zinc-100 group-hover:text-purple-400 transition-colors mb-1">
                    Channel ID Finder
                  </h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Find the permanent channel ID and user account identifier for any custom handle.
                  </p>
                </Link>

                <Link
                  href="/video-downloader"
                  className="p-5 bg-zinc-900/40 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700 rounded-2xl transition-all group block"
                >
                  <div className="p-3 bg-zinc-950 rounded-xl border border-zinc-800 w-fit mb-3 group-hover:scale-105 transition-transform text-orange-500">
                    <PlaySquare className="w-5 h-5" />
                  </div>
                  <h3 className="font-semibold text-zinc-100 group-hover:text-orange-400 transition-colors mb-1">
                    Video Downloader
                  </h3>
                  <p className="text-zinc-400 text-xs leading-relaxed">
                    Download YouTube videos in 1080p, 4K, and MP3 audio for backup and analysis.
                  </p>
                </Link>
              </div>
            </section>
          </article>
        </div>
      </div>
    </>
  );
}

function StatusItem({ label, status }: { label: string; status: boolean }) {
  return (
    <div className="flex items-center justify-between p-4 bg-zinc-950 rounded-2xl border border-zinc-800">
      <span className="font-medium text-zinc-200">{label}</span>
      <div className="flex items-center gap-2">
        {status ? (
          <>
            <span className="text-green-500 font-medium">Good</span>
            <CheckCircle className="w-5 h-5 text-green-500" />
          </>
        ) : (
          <>
            <span className="text-red-500 font-medium">Flagged</span>
            <XCircle className="w-5 h-5 text-red-500" />
          </>
        )}
      </div>
    </div>
  );
}
