import type { Metadata } from "next";
import Link from "next/link";
import { ChevronDown, ArrowRight } from "lucide-react";
import { Button } from "@/components/ui/button";

export const metadata: Metadata = {
  title: "FAQ",
  description:
    "Answers to common questions about creating AI podcasts with PodcastYes — generation, voices, languages, plans, billing, repurposing, the API, and teams.",
};

interface QA {
  q: string;
  a: string;
}
interface Category {
  title: string;
  items: QA[];
}

const FAQ: Category[] = [
  {
    title: "Getting started",
    items: [
      {
        q: "What is PodcastYes and what does it do?",
        a: "PodcastYes is an all-in-one AI studio that turns a single topic into a finished podcast episode. It writes the script with GPT-4, records realistic multi-voice audio with ElevenLabs, and designs matching cover art with DALL·E — then lets you fine-tune, download, and repurpose the result. You go from idea to a publishable MP3 in minutes, with no microphone and no editing software.",
      },
      {
        q: "Do I need recording equipment or editing experience?",
        a: "Neither. There's nothing to record and nothing to install — every part of the episode is generated for you. If you can describe a topic, you can produce a polished episode, and the built-in script editor and one-click regeneration let you refine it without any audio-engineering knowledge.",
      },
      {
        q: "How do I create my first episode?",
        a: "Click “New episode” and follow the three-step wizard: describe your topic and pick a tone, length, language, and format; cast a voice for each speaker; then review and generate. The AI handles scripting, narration, and artwork, and the episode page shows live progress until it's ready.",
      },
      {
        q: "How long does it take to generate an episode?",
        a: "Most episodes finish in a minute or two. Longer scripts are split into segments, synthesized, and stitched back together, so length affects timing — but you can leave the page and we'll email you the moment it's ready.",
      },
    ],
  },
  {
    title: "Creating & editing episodes",
    items: [
      {
        q: "What episode formats can I make?",
        a: "Three: solo (a single host), interview (host and guest), and multi-host (a panel). Interview and multi-host formats produce natural back-and-forth dialogue, with a distinct AI voice for each speaker.",
      },
      {
        q: "Can I edit the AI-generated script?",
        a: "Yes. Every generated script is fully editable in the built-in editor, and you can regenerate any single section if you want a different take without rewriting the whole thing. When you're happy with the words, regenerate the audio so the narration matches your edits.",
      },
      {
        q: "Can I regenerate just the audio or the cover art?",
        a: "Yes. You can re-run the audio or the cover art independently of the script — handy for trying a new voice or a fresh design. Each regeneration draws from your monthly allowance for that step.",
      },
      {
        q: "Who owns the podcasts I create?",
        a: "You own the scripts, audio, and artwork you generate and are free to publish them, subject to our Terms of Service and our AI providers' terms. Because AI output can occasionally be inaccurate or resemble existing work, review it for accuracy and rights before publishing.",
      },
      {
        q: "How accurate and safe is the generated content?",
        a: "Treat the AI as a fast, high-quality first draft: it's strong but can make mistakes, so verify facts before you publish. To keep the platform safe, we automatically screen episode topics and generated scripts and flag anything that violates our Acceptable Use Policy for review.",
      },
    ],
  },
  {
    title: "Voices & languages",
    items: [
      {
        q: "How many voices are there, and can I use multiple speakers?",
        a: "There are 14+ realistic voices spanning genders and accents, and you can assign a different voice to each speaker for true multi-person dialogue. You can swap voices and regenerate the audio at any time.",
      },
      {
        q: "What languages are supported?",
        a: "PodcastYes supports 13+ languages, available on the Creator plan and above. Choose your language in the wizard and the script and narration are produced natively in that language — no re-recording required.",
      },
      {
        q: "Can I clone my own voice?",
        a: "No. Custom voice cloning isn't offered, and our Acceptable Use Policy prohibits cloning or impersonating a real person's voice without their consent. You choose from our library of licensed AI voices instead.",
      },
    ],
  },
  {
    title: "Plans, billing & limits",
    items: [
      {
        q: "What's included in the Free plan?",
        a: "The Free plan lets you try the full workflow at no cost and with no card: 3 scripts and 1 audio generation per month, episodes up to 5 minutes, two narrator voices, and cover-art generation. It's the easiest way to produce a complete sample episode before deciding to upgrade.",
      },
      {
        q: "How do the paid plans differ?",
        a: "Creator ($9/mo) unlocks all voices, 13+ languages, content repurposing, and much higher limits (50 scripts, 20 audio, 20-minute episodes). Pro ($29/mo) adds unlimited scripts, the series generator, AI co-host mode, API access, priority generation, and 45-minute episodes. Agency ($79/mo) adds a 5-seat team workspace, white-label mode, custom branding, and up to 90-minute episodes.",
      },
      {
        q: "How do usage limits work, and when do they reset?",
        a: "Each plan includes monthly allowances for scripts, audio, artwork, and repurposing. Allowances reset on the first of each calendar month, and you can always see exactly what's left on the Usage page.",
      },
      {
        q: "What payment methods do you accept, and can I cancel anytime?",
        a: "We accept cards through Stripe and payments through PayPal, and you can cancel anytime from the billing page — your plan stays active through the end of the period you've already paid for. Payments are generally non-refundable; see our Refund & Cancellation Policy for the details.",
      },
      {
        q: "What happens if I hit my monthly limit?",
        a: "When you reach a limit, that feature pauses until your allowance resets at the start of the next month — or you can upgrade to a higher plan to keep creating right away. Anything you've already generated is unaffected.",
      },
    ],
  },
  {
    title: "Repurposing, series & teams",
    items: [
      {
        q: "Can I turn an episode into other content?",
        a: "Yes. With one click you can repurpose any finished episode into a blog post, a social thread, or a newsletter, so a single recording fuels your whole content calendar. Repurposing is available on the Creator plan and above.",
      },
      {
        q: "Can I plan a whole season at once?",
        a: "Yes — the series generator (Pro and above) plans an entire season from a single prompt, proposing a season title plus a set of episodes with topics and summaries. You can then generate any episode in the plan with one click.",
      },
      {
        q: "Do you offer an API and team or white-label workspaces?",
        a: "The Pro plan includes API access, so you can create episodes programmatically with your own keys. The Agency plan adds a 5-seat team workspace plus white-label mode and custom branding, so you can run PodcastYes as your own studio for clients.",
      },
    ],
  },
];

export default function FaqPage() {
  return (
    <div className="bg-hero-wash">
      <div className="container max-w-3xl py-20 md:py-28">
        <div className="text-center">
          <p className="text-[13px] font-semibold uppercase tracking-[0.04em] text-brand">Support</p>
          <h1 className="mt-3 font-display text-5xl font-extrabold tracking-tight md:text-6xl">
            Frequently asked questions
          </h1>
          <p className="mx-auto mt-4 max-w-2xl text-lg text-muted-foreground">
            Everything you need to know about producing podcasts with PodcastYes. Can&apos;t find your
            answer? Email{" "}
            <a href="mailto:support@podcastyes.app" className="font-semibold text-brand hover:underline">
              support@podcastyes.app
            </a>
            .
          </p>
        </div>

        <div className="mt-16 space-y-12">
          {FAQ.map((category) => (
            <section key={category.title}>
              <h2 className="font-display text-sm font-semibold uppercase tracking-[0.06em] text-muted-foreground/70">
                {category.title}
              </h2>
              <div className="mt-4 space-y-3">
                {category.items.map((item) => (
                  <details
                    key={item.q}
                    className="group rounded-2xl border border-border bg-card px-5 transition-shadow open:shadow-sm"
                  >
                    <summary className="flex cursor-pointer list-none items-center justify-between gap-4 py-5 [&::-webkit-details-marker]:hidden">
                      <span className="font-display text-base font-bold tracking-tight">{item.q}</span>
                      <ChevronDown className="h-5 w-5 shrink-0 text-muted-foreground transition-transform duration-200 group-open:rotate-180" />
                    </summary>
                    <p className="pb-5 leading-relaxed text-muted-foreground">{item.a}</p>
                  </details>
                ))}
              </div>
            </section>
          ))}
        </div>

        {/* CTA */}
        <div className="mt-20 rounded-3xl border border-border bg-card p-10 text-center shadow-sm">
          <h2 className="font-display text-2xl font-extrabold tracking-tight md:text-3xl">
            Ready to make your first episode?
          </h2>
          <p className="mx-auto mt-3 max-w-md text-muted-foreground">
            Spin up a fully produced episode on the free plan in a couple of minutes — no card required.
          </p>
          <div className="mt-7 flex flex-col justify-center gap-3 sm:flex-row">
            <Button asChild size="lg">
              <Link href="/sign-up">
                Start free <ArrowRight className="h-4 w-4" />
              </Link>
            </Button>
            <Button asChild size="lg" variant="outline">
              <Link href="/pricing">See pricing</Link>
            </Button>
          </div>
        </div>
      </div>
    </div>
  );
}
