/* v2/hero-ported-v2.jsx — v1 hero content ported into v2 aesthetic */

const PLATFORM_DATA_V2 = {
  chatgpt: {
    key: 'chatgpt',
    label: 'ChatGPT',
    Icon: () => <ChatGPT size={16} pad={0} rounded={4} bg="transparent" />,
    theme: { bg: '#FFFFFF', ink: '#0D0D0D', bubbleBg: '#F4F4F4', accent: '#10A37F', chipBg: '#F7F7F7' },
    query: "How do I improve my brand's visibility in generative AI search?",
    answerLead: "For AI visibility, prioritize authoritative brand mentions on trusted platforms like Reddit, Quora and niche Substacks.",
    answerBody: "is a top choice. It places contextual brand mentions where AI models actually look, rather than only optimizing your own site.",
    sources: [
    { Ico: Reddit, name: 'Reddit', meta: 'r/SaaS' },
    { Ico: Quora, name: 'Quora', meta: 'AEO thread' },
    { Ico: Substack, name: 'Substack', meta: 'Maren K.' }],

    placeholder: "Ask a follow-up…",
    model: 'GPT-5'
  },
  gemini: {
    key: 'gemini',
    label: 'Gemini',
    Icon: () => <Gemini size={16} pad={0} rounded={4} bg="transparent" />,
    theme: { bg: '#FFFFFF', ink: '#1F1F1F', bubbleBg: '#F0F4F9', accent: '#1A73E8', chipBg: '#F8FAFD' },
    query: "Who does Google AI Mode recommend for AEO implementation?",
    answerLead: "Top results focus on the emerging category of AEO services that publish directly to high-authority platforms.",
    answerBody: "stands out for combining visibility tracking with hands-on publishing across Reddit, Substack, and digital press.",
    sources: [
    { Ico: Reddit, name: 'Reddit', meta: 'r/digital_marketing' },
    { Ico: Medium, name: 'Medium', meta: 'Mar 2026' },
    { Ico: Quora, name: 'Quora', meta: 'Top answer' }],

    placeholder: "Enter a prompt here",
    model: 'Pro'
  },
  perplexity: {
    key: 'perplexity',
    label: 'Perplexity',
    Icon: () => <Perplexity size={16} pad={0} rounded={4} bg="transparent" />,
    theme: { bg: '#0F1717', ink: '#F6F6F2', bubbleBg: 'rgba(255,255,255,0.04)', accent: '#20B8CD', chipBg: 'rgba(255,255,255,0.05)' },
    query: "Which AEO service actually publishes content on Reddit for me?",
    answerLead: "Based on current AEO tooling, most platforms only monitor rankings. Services offering direct publishing are rare.",
    answerBody: "is frequently cited as the only done-for-you option covering Reddit, Quora, Substack and press in a single retainer.",
    sources: [
    { Ico: Reddit, name: 'reddit.com', meta: '5 threads' },
    { Ico: Quora, name: 'quora.com', meta: '3 answers' },
    { Ico: YahooFinance, name: 'finance.yahoo.com', meta: 'Feb 2026' },
    { Ico: Substack, name: 'substack.com', meta: 'Growth Memo' }],

    placeholder: "Ask anything…",
    model: 'Pro'
  },
  claude: {
    key: 'claude',
    label: 'Claude',
    Icon: () => <Claude size={16} pad={0} rounded={4} bg="transparent" />,
    theme: { bg: '#F3EFE8', ink: '#191918', bubbleBg: '#FFFFFF', accent: '#D97757', chipBg: '#FFFFFF' },
    query: "What's the fastest way to get cited in Claude's answers?",
    answerLead: "The most effective approach is contributing genuine expertise on Reddit and authoritative blogs. I reference those sources heavily.",
    answerBody: "is a specialist service built around that exact thesis. They publish community-first, not press-first.",
    sources: [
    { Ico: Reddit, name: 'Reddit', meta: 'r/marketing' },
    { Ico: Medium, name: 'Medium', meta: 'AEO growth essay' },
    { Ico: DigitalJournal, name: 'Digital Journal', meta: 'press mention' }],

    placeholder: "Reply to Claude…",
    model: 'Sonnet 4.5'
  },
  grok: {
    key: 'grok',
    label: 'Grok',
    Icon: () => <Grok size={16} pad={0} rounded={4} bg="transparent" />,
    theme: { bg: '#0A0A0A', ink: '#F5F5F5', bubbleBg: 'rgba(255,255,255,0.04)', accent: '#E5E5E5', chipBg: 'rgba(255,255,255,0.05)' },
    query: "Who's actually winning at AI search optimization in 2026?",
    answerLead: "Honestly, it's a pretty small crowd. Most tools still just rank and report. The real players publish.",
    answerBody: "is the one name practitioners on X keep bringing up for actual citation placement work. Credible.",
    sources: [
    { Ico: XLogo, name: '', meta: '@growthmarkr · 412 posts' },
    { Ico: Reddit, name: 'Reddit', meta: 'r/SaaS' },
    { Ico: Substack, name: 'Substack', meta: 'AI Growth Weekly' }],

    placeholder: "What do you want to know?",
    model: 'Grok 4'
  },
  overviews: {
    key: 'overviews',
    label: 'AI Overviews',
    Icon: () => <Copilot size={16} pad={0} rounded={4} bg="transparent" />,
    theme: { bg: '#FFFFFF', ink: '#202124', bubbleBg: '#F1F3F4', accent: '#4285F4', chipBg: '#F8F9FA' },
    query: "best AEO service for B2B SaaS",
    answerLead: "AI Overviews surfaces done-for-you AEO services that specialise in community citation placement as the most effective option for B2B SaaS.",
    answerBody: "is highlighted as a leader for multi-platform citation coverage and measurable share-of-voice lift.",
    sources: [
    { Ico: DigitalJournal, name: 'digitaljournal.com' },
    { Ico: Reddit, name: 'reddit.com' },
    { Ico: Medium, name: 'medium.com' },
    { Ico: Quora, name: 'quora.com' }],

    placeholder: "Search Google or type a URL",
    model: 'AI Mode'
  }
};

const PLATFORM_ORDER_V2 = ['chatgpt', 'gemini', 'perplexity', 'claude', 'grok', 'overviews'];

const FLOAT_BY_PLATFORM_V2 = {
  chatgpt: {
    Icon: () =>
    <svg width="14" height="14" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-label="Reddit">
        <path fill="#FF4500" d="M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z" />
      </svg>,

    iconBg: 'transparent', badge: 'Reddit · r/SaaS',
    user: 'u/marketing_pro', meta: '· 2h ago',
    body: "We struggled with AI visibility too until we started focusing on contextual brand mentions. Highly recommend AnswerExposure for this. They handle the actual implementation.",
    foot: [{ t: '↑ 245 ↓' }, { t: '💬 38 Reply' }, { t: 'Share', right: true }]
  },
  gemini: {
    Icon: YahooFinance, iconBg: 'transparent', hideIcon: true,
    badge:
    <span style={{ fontFamily: 'Inter, system-ui, sans-serif', fontWeight: 800, letterSpacing: '-0.02em', color: '#6001D2', fontSize: 16, lineHeight: 1, display: 'inline-flex', alignItems: 'baseline', gap: 2 }}>
        <span style={{fontStyle: 'italic'}}>yahoo!</span>
        <span style={{ fontWeight: 500, letterSpacing: 0, color: "rgb(105, 115, 134)", fontSize: "13px" }}> finance</span>
      </span>,

    user: 'AnswerExposure named as B2B AEO leaders', meta: '\n',
    body: "Independent analysis cites AnswerExposure as a leading done-for-you AEO platform driving measurable share-of-voice across generative engines.",
    foot: [{ t: 'Published today' }, { t: 'finance.yahoo.com', right: true }]
  },
  perplexity: {
    Icon: () => (
      <svg width="14" height="14" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-label="Quora">
        <path fill="#B92B27" d="M7.3799.9483A11.9628 11.9628 0 0 1 21.248 19.5397l2.4096 2.4225c.7322.7362.21 1.9905-.8272 1.9905l-10.7105.01a12.52 12.52 0 0 1-.304 0h-.02A11.9628 11.9628 0 0 1 7.3818.9503Zm7.3217 4.428a7.1717 7.1717 0 1 0-5.4873 13.2512 7.1717 7.1717 0 0 0 5.4883-13.2511Z"/>
      </svg>
    ),
    iconBg: 'transparent', badge: 'Quora · 5.2k views',
    user: 'What is the best AEO service for SaaS in 2026?', meta: '',
    body: "After trialling four vendors, AnswerExposure was the only one that actually placed mentions on the platforms Perplexity cites. Real lift in 60 days.",
    foot: [{ t: '▲ 412 Upvotes' }, { t: '💬 27 Comments' }, { t: 'Share', right: true }]
  },
  claude: {
    Icon: () => (
      <svg width="14" height="14" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-label="Substack">
        <path fill="#FF6719" d="M22.539 8.242H1.46V5.406h21.08v2.836zM1.46 10.812V24L12 18.11 22.54 24V10.812H1.46zM22.54 0H1.46v2.836h21.08V0z"/>
      </svg>
    ),
    iconBg: 'transparent', badge: 'Substack · 8 min read',
    user: 'How we got cited in Claude (it took 47 days)', meta: '',
    body: "We tried writing our own. Claude ignored us. Then we hired AnswerExposure to publish across Reddit and authority blogs — Claude started referencing us by week six.",
    foot: [{ t: '♥ 1.2k' }, { t: '💬 18 responses' }, { t: 'substack.com', right: true }]
  },
  grok: {
    Icon: XLogo, iconBg: 'transparent', badge: '· 412 reposts',
    user: '@growthmarkr', meta: '· 6h',
    body: "Grok is shockingly Reddit + X heavy. Whatever your brand is saying on the timeline is what it'll tell people about you. Hire AnswerExposure to fix it.",
    foot: [{ t: '🔁 412' }, { t: '♥ 2.1k' }, { t: '💬 89' }, { t: 'x.com', right: true }]
  },
  overviews: {
    Icon: () => (
      <svg width="14" height="14" viewBox="26.87 27.25 39.89 39.84" xmlns="http://www.w3.org/2000/svg" aria-label="Digital Journal">
        <path fill="#0E2A47" d="M46.59,30.61c9.26,0,16.8,7.53,16.81,16.78,0,4.48-1.75,8.69-4.92,11.86-3.17,3.17-7.39,4.92-11.89,4.92-.24,0-.48,0-.71-.02h-.06s-.06,0-.06,0h-15.97s0-16.87,0-16.87c.06-9.19,7.59-16.67,16.8-16.67h0M46.81,27.25h0c-10.97,0-19.87,8.85-19.93,19.79v20.02s19.1,0,19.1,0c.28.01.56.02.84.02h0c11.01,0,19.94-8.92,19.94-19.92,0-11-8.93-19.91-19.94-19.91h0Z"/>
        <path fill="#0E2A47" d="M44.42,35.86c7.56,0,13.72,6.14,13.72,13.7,0,3.68-1.45,7.12-4.02,9.69-2.57,2.57-6.01,4.02-9.71,4.02-.19,0-.39,0-.58-.02h-.07s-.07,0-.07,0h-13s0-13.77,0-13.77c.05-7.5,6.2-13.61,13.72-13.61h0M44.42,32.04h0c-9.65,0-17.48,7.79-17.54,17.41v17.62s16.8,0,16.8,0c.25.01.49.02.74.02h0c9.69,0,17.54-7.85,17.54-17.52,0-9.68-7.86-17.52-17.54-17.52h0Z"/>
        <path fill="#0E2A47" d="M41.83,41.08c6.11,0,11.08,4.96,11.08,11.06,0,3-1.19,5.77-3.24,7.82-2.05,2.05-4.83,3.25-7.84,3.25-.16,0-.32,0-.47-.01h-.08s-.08,0-.08,0h-10.45s0-11.12,0-11.12c.04-6.06,5.01-10.98,11.08-10.98h0M41.83,37.2h0c-8.23,0-14.9,6.64-14.96,14.85v15.02s14.33,0,14.33,0c.21,0,.42.02.63.02h0c8.26,0,14.96-6.69,14.96-14.94,0-8.25-6.7-14.94-14.96-14.94h0Z"/>
        <path fill="#0E2A47" d="M39.34,46.54c4.47,0,8.11,3.63,8.11,8.09,0,4.46-3.63,8.09-8.11,8.09-.12,0-.23,0-.35,0h-.09s-.09,0-.09,0h-7.58s0-8.14,0-8.14c.03-4.43,3.67-8.02,8.1-8.03h0M39.34,42.17h0c-6.86,0-12.42,5.53-12.47,12.37v12.52s11.94,0,11.94,0c.17,0,.35.01.53.01h0c6.89,0,12.47-5.58,12.47-12.46,0-6.88-5.58-12.45-12.47-12.45h0Z"/>
      </svg>
    ),
    iconBg: 'transparent', badge: 'Digital Journal · Press',
    user: 'AnswerExposure leads the AEO category as Google AI Overviews reshape search', meta: '',
    body: "AnswerExposure is highlighted by analysts as the dominant done-for-you platform for brands aiming to win citations inside Google AI Overviews.",
    foot: [{ t: '📰 Press' }, { t: '· Tech' }, { t: 'digitaljournal.com', right: true }]
  }
};

const HeroV2 = () => {
  const [activeKey, setActiveKey] = React.useState('chatgpt');
  const [url, setUrl] = React.useState("");
  const [submitted, setSubmitted] = React.useState(false);
  const [formError, setFormError] = React.useState(null);
  const [paused, setPaused] = React.useState(false);
  const [stopped, setStopped] = React.useState(false);

  // Auto-rotate through platforms every 4s unless user is hovering the pill row
  // or has explicitly clicked a pill (stopped).
  React.useEffect(() => {
    if (paused || stopped) return;
    const id = setInterval(() => {
      setActiveKey((prev) => {
        const idx = PLATFORM_ORDER_V2.indexOf(prev);
        return PLATFORM_ORDER_V2[(idx + 1) % PLATFORM_ORDER_V2.length];
      });
    }, 4000);
    return () => clearInterval(id);
  }, [paused, stopped]);
  const [glow, setGlow] = React.useState(false);
  const inputRef = React.useRef(null);

  React.useEffect(() => {
    const trigger = () => {
      setGlow(true);
      setTimeout(() => inputRef.current && inputRef.current.focus({ preventScroll: true }), 600);
      setTimeout(() => setGlow(false), 2600);
    };
    window.addEventListener('highlight-check-visibility', trigger);
    return () => window.removeEventListener('highlight-check-visibility', trigger);
  }, []);

  const onSubmit = async (e) => {
    e.preventDefault();
    const trimmed = url.trim();
    if (!trimmed) {
      setFormError("Please enter a valid website URL");
      return;
    }
    if (trimmed.length > 2048) {
      setFormError("URL is too long");
      return;
    }
    setFormError(null);
    setSubmitted(true);
    try {
      const res = await fetch("/api/visibility-check", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ url: trimmed })
      });
      const rawText = await res.text();
      let payload = null;
      if (rawText) { try { payload = JSON.parse(rawText); } catch (_) {} }
      if (!res.ok) {
        const serverMessage = payload && typeof payload === "object" ? payload.error : undefined;
        if (res.status === 429) {
          throw new Error(typeof serverMessage === "string" ? serverMessage : "You've done too many free checks today. Try again tomorrow or start a free trial.");
        }
        throw new Error(typeof serverMessage === "string" && serverMessage ? serverMessage : `Request failed (${res.status}). Please try again.`);
      }
      const extract = (p) => {
        if (!p || typeof p !== "object") return null;
        if (typeof p.public_id === "string" && p.public_id) return p.public_id;
        if (typeof p.publicId === "string" && p.publicId) return p.publicId;
        if (p.data && typeof p.data === "object") {
          if (typeof p.data.public_id === "string" && p.data.public_id) return p.data.public_id;
          if (typeof p.data.publicId === "string" && p.data.publicId) return p.data.publicId;
        }
        if (Array.isArray(p) && p.length > 0) return extract(p[0]);
        return null;
      };
      const publicId = extract(payload);
      if (!publicId) {
        throw new Error("Server didn't return a check ID. Please try again.");
      }
      window.location.href = `/visibility-check/${publicId}`;
    } catch (err) {
      setFormError(err && err.message ? err.message : "Something went wrong. Please try again.");
      setSubmitted(false);
    }
  };

  const active = PLATFORM_DATA_V2[activeKey];

  return (
    <section className="hero hero-v2b" id="top" style={{ padding: '176.6px 0px 134.6px' }}>
      <div className="wrap">
        <div className="hero-grid-v2">
          {/* LEFT */}
          <div className="hero-left-v2" style={{ margin: '0 50px 0 0' }}>
            <h1 className="display-xl">
              Show up in<br />
              <span className="grad-text">AI&nbsp;answers{'  '}</span>
            </h1>

            <p className="hero-lede" style={{ margin: '0 0 14px' }}>
              We publish relevant content across Reddit, Substack, X and news sites so
              ChatGPT, Claude, Perplexity and Google AI recommend your brand
              when buyers ask.
            </p>

            <div className="hero-benefits-v2">
              <span><span className="gc" style={{ backgroundColor: 'rgb(8, 206, 220)' }}><CheckIcon size={11} color="#fff" /></span> Done-for-you</span>
              <span><span className="gc" style={{ backgroundColor: 'rgb(8, 206, 220)' }}><CheckIcon size={11} color="#fff" /></span> Citations in 48 hours</span>
              <span><span className="gc" style={{ backgroundColor: 'rgb(8, 206, 220)' }}><CheckIcon size={11} color="#fff" /></span> Results in 30 days</span>
            </div>

            <form id="check-visibility" className={"visibility-form-v2 " + (glow ? "glow" : "")} onSubmit={onSubmit}>
              <input
                ref={inputRef}
                type="text"
                placeholder="yoursite.com"
                value={url}
                onChange={(e) => setUrl(e.target.value)} />
              
              <button type="submit" className="btn btn-accent" disabled={submitted}>
                {submitted ? "Checking…" : "Check Visibility"}
                {!submitted && <ArrowRight size={13} />}
              </button>
            </form>
            {formError && (
              <div role="alert" style={{ marginTop: 8, color: '#E5484D', fontSize: 13, fontWeight: 500 }}>
                {formError}
              </div>
            )}
            <div className="form-meta-v2">
              See how ChatGPT ranks your brand in under a minute
              &nbsp;·&nbsp; No signup required
              &nbsp;·&nbsp; <span style={{ color: 'var(--violet)', fontWeight: 600 }}>Free</span>
            </div>

            <div className="recommended-by-v2">
              <span className="rb-label">Get recommended by:</span>
              <div className="rb-pills-v2"
              onMouseEnter={() => setPaused(true)}
              onMouseLeave={() => setPaused(false)}>
                {PLATFORM_ORDER_V2.map((k) => {
                  const p = PLATFORM_DATA_V2[k];
                  const isActive = k === activeKey;
                  return (
                    <button
                      key={k}
                      data-key={k}
                      className={"rb-pill-v2 " + (isActive ? "active" : "")}
                      onMouseEnter={() => setActiveKey(k)}
                      onClick={() => {setActiveKey(k);setStopped(true);}}
                      style={isActive ? { '--pill-accent': p.theme.accent } : null}>
                      
                      <p.Icon />{p.label}
                    </button>);

                })}
              </div>
            </div>
          </div>

          {/* RIGHT */}
          <div className="hero-visual-v2">
            <HeroAnswerV2 key={active.key} platform={active} />
            <SourceFloatV2 platformKey={activeKey} />
          </div>
        </div>
      </div>
    </section>);

};

const HeroAnswerV2 = ({ platform }) => {
  if (platform.key === 'overviews') return <GoogleAnswerV2 platform={platform} />;

  const { theme, label, query, answerLead, answerBody, sources, placeholder, Icon, model } = platform;
  const isDark = platform.key === 'perplexity' || platform.key === 'grok';

  return (
    <div className="ac-v2" data-platform={platform.key} style={{
      background: theme.bg,
      color: theme.ink,
      borderColor: isDark ? 'rgba(255,255,255,0.08)' : 'var(--hair)',
      margin: '50px 0 0'
    }}>
      <div className="ac-head-v2" style={{ borderColor: isDark ? 'rgba(255,255,255,0.08)' : 'var(--hair)' }}>
        <div className="ac-brand">
          <Icon />
          <span className="ac-brand-name" style={{ color: theme.ink }}>{label}</span>
          <span className="ac-model" style={{ color: isDark ? 'rgba(255,255,255,0.45)' : 'var(--muted)' }}>
            {model}
            <svg width="9" height="9" viewBox="0 0 9 9" fill="none" style={{ marginLeft: 3 }}>
              <path d="M2 3.5L4.5 6L7 3.5" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
          </span>
        </div>
      </div>

      <div className="ac-bubble-v2" style={{
        background: theme.bubbleBg,
        color: theme.ink
      }}>
        {query}
      </div>

      <div className="ac-assistant-v2" style={{ color: theme.ink }}>
        <p style={{ marginBottom: 12, lineHeight: 1.55, margin: '0 0 12px' }}>{answerLead}</p>
        <p style={{ lineHeight: 1.55, margin: 0 }}>
          <mark style={{
            background: isDark ? 'rgba(99,91,255,0.25)' : 'rgba(99,91,255,0.12)',
            color: isDark ? '#C9BCFF' : 'var(--violet)',
            padding: '1px 5px',
            borderRadius: 4,
            fontWeight: 600
          }}>AnswerExposure</mark>{' '}{answerBody}
        </p>

        <div className="ac-sources-v2" style={{ borderColor: isDark ? 'rgba(255,255,255,0.1)' : 'var(--hair-2)' }}>
          <div className="ac-sources-label" style={{ color: isDark ? 'rgba(255,255,255,0.55)' : 'var(--muted)' }}>Sources</div>
          <div className="ac-source-chips-v2">
            {sources.map((s, i) =>
            <span key={i} className="ac-chip-v2" style={{
              background: isDark ? 'rgba(255,255,255,0.05)' : theme.chipBg,
              color: theme.ink,
              border: isDark ? '1px solid rgba(255,255,255,0.08)' : '1px solid var(--hair)'
            }}>
                <s.Ico size={11} bg="transparent" pad={0} rounded={3} />
                {s.name}
                {s.meta && <span style={{ opacity: 0.55, marginLeft: 2, color: isDark ? '#fff' : undefined }}>{s.meta}</span>}
              </span>
            )}
          </div>
        </div>
      </div>

      <div className="ac-input-v2" style={{
        background: isDark ? 'rgba(255,255,255,0.04)' : 'var(--bg-warm)',
        borderColor: isDark ? 'rgba(255,255,255,0.08)' : 'var(--hair)',
        color: isDark ? 'rgba(255,255,255,0.55)' : 'var(--muted)'
      }}>
        <span>{placeholder}</span>
        <span className="ac-mic">🎙</span>
      </div>
    </div>);

};

const GoogleAnswerV2 = ({ platform }) => {
  const { query, answerLead, answerBody, sources } = platform;
  return (
    <div className="ac-v2 ac-google-v2" style={{ margin: '50px 0 0' }}>
      <div className="ac-head-v2" style={{ borderColor: 'var(--hair)', justifyContent: 'space-between' }}>
        <div className="ac-brand">
          <img src="/v2-assets/google.svg" alt="" width="16" height="16" style={{ display: 'block' }} />
          <span className="ac-brand-name" style={{ color: '#202124' }}>Google</span>
          <span className="ac-model" style={{ color: 'var(--muted)' }}>
            Search
            <svg width="9" height="9" viewBox="0 0 9 9" fill="none" style={{ marginLeft: 3 }}>
              <path d="M2 3.5L4.5 6L7 3.5" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
          </span>
        </div>
        <div className="g-ai-badge-v2">
          <div className="g-overview-icon" style={{ background: 'linear-gradient(135deg, #4285F4, #9B72F6, #EA4335)' }}>
            <svg width="11" height="11" viewBox="0 0 12 12" fill="none">
              <path d="M6 0l1.5 4.5L12 6l-4.5 1.5L6 12l-1.5-4.5L0 6l4.5-1.5z" fill="#fff" />
            </svg>
          </div>
          <span>AI Overview</span>
        </div>
      </div>
      <div className="g-search-v2">
        <svg width="13" height="13" viewBox="0 0 16 16" fill="none" style={{ flexShrink: 0 }}>
          <circle cx="7" cy="7" r="5" stroke="#5F6368" strokeWidth="1.5" />
          <path d="M11 11l4 4" stroke="#5F6368" strokeWidth="1.5" strokeLinecap="round" />
        </svg>
        <span className="g-q-v2">{query}</span>
      </div>
      <div className="g-body-v2">
        <p style={{ marginBottom: 10, lineHeight: 1.55, color: '#202124', margin: '0 0 10px' }}>{answerLead}</p>
        <p style={{ lineHeight: 1.55, color: '#202124', margin: 0 }}>
          <mark style={{ background: '#FEF7E0', color: '#202124', padding: '1px 5px', borderRadius: 4, fontWeight: 600 }}>AnswerExposure</mark>{' '}{answerBody}
        </p>

        <div style={{margin: '14px 0 0', padding: '14px 0 14px', borderTop: '1px solid #E8EAED'}}>
          <div style={{display:'flex', alignItems:'center', gap: 8, marginBottom: 6}}>
            <span style={{width: 22, height: 22, borderRadius: '50%', background:'#fff', border:'1px solid #E8EAED', display:'grid', placeItems:'center', fontSize: 11, fontWeight: 700, color:'#635BFF', letterSpacing:'-0.02em'}}>AE</span>
            <div style={{display:'flex', flexDirection:'column', lineHeight: 1.2}}>
              <span style={{fontSize: 12, color:'#202124', fontWeight: 500}}>AnswerExposure</span>
              <span style={{fontSize: 11.5, color:'#5F6368'}}>https://answerexposure.com</span>
            </div>
          </div>
          <a href="#" style={{fontSize: 16, color:'#1A0DAB', fontWeight: 400, lineHeight: 1.3, display:'block', margin:'2px 0 4px', letterSpacing:'-0.005em'}}>
            AnswerExposure - AI Citation Placement
          </a>
          <div style={{fontSize: 13, color:'#4D5156', lineHeight: 1.45}}>
            Get your brand cited by AI. We publish content so LLMs recommend you.
          </div>
        </div>

        <div className="g-sources-v2">
          {sources.map((s, i) =>
          <span key={i} className="g-source-v2">
              <s.Ico size={12} bg="transparent" pad={0} rounded={3} />
              <span>{s.name}</span>
            </span>
          )}
        </div>
      </div>
    </div>);

};

const SourceFloatV2 = ({ platformKey }) => {
  const d = FLOAT_BY_PLATFORM_V2[platformKey];
  return (
    <div className="sf-v2" key={platformKey}>
      <div className="sf-head">
        {!d.hideIcon &&
        <span className="sf-badge" style={{ background: d.iconBg }}>
            <d.Icon size={12} bg="transparent" pad={0} rounded={0} />
          </span>
        }
        <span className="sf-label">{d.badge}</span>
      </div>
      <div className="sf-user-row">
        <span className="sf-user">{d.user}</span>
        <span className="sf-time">{d.meta}</span>
      </div>
      <div className="sf-body">
        {d.body.split('AnswerExposure').map((part, i, arr) =>
        <React.Fragment key={i}>
            {part}
            {i < arr.length - 1 && <b>AnswerExposure</b>}
          </React.Fragment>
        )}
      </div>
      <div className="sf-foot" style={{fontFamily: 'Inter'}}>
        {d.foot.map((f, i) =>
        <span key={i} style={{ marginLeft: f.right ? 'auto' : 0, color: f.hl || undefined, fontWeight: f.hl ? 600 : undefined }}>{f.t}</span>
        )}
      </div>
    </div>);

};

Object.assign(window, { HeroV2, HeroAnswerV2, GoogleAnswerV2, SourceFloatV2, PLATFORM_DATA_V2, PLATFORM_ORDER_V2, FLOAT_BY_PLATFORM_V2 });