import { useTranslation } from "react-i18next";
import { ArrowRight, CheckCircle2 } from "lucide-react";
import { Layout } from "@/components/layout/Layout";
import { Section, SectionHeader } from "@/components/ui/Section";
import { RelatedCases } from "@/components/RelatedCases";
import { SEO } from "@/components/SEO";
import { useForceLanguage } from "@/hooks/useForceLanguage";
import holoboxAvatarTradeshow from "@/assets/solutions/holobox-avatar-tradeshow.png";
import holoboxAvatarsStudio from "@/assets/solutions/holobox-avatars-studio.png";
import holoboxCaiaImage from "@/assets/solutions/holobox-caia.png";

interface SolutionHoloboxProps { forceLang?: "sv" | "en"; seoOverride?: React.ReactNode; }

export default function SolutionHolobox({ forceLang, seoOverride }: SolutionHoloboxProps) {
  const { t } = useTranslation();
  useForceLanguage(forceLang);

  const quickFacts = [
    t("holobox.quickFacts.displayHeight"),
    t("holobox.quickFacts.contentModes"),
    t("holobox.quickFacts.interaction"),
    t("holobox.quickFacts.speakers"),
    t("holobox.quickFacts.operation"),
    t("holobox.quickFacts.modular"),
  ];

  const useCases = [
    { environment: t("holobox.useCases.healthcare.title"), description: t("holobox.useCases.healthcare.description") },
    { environment: t("holobox.useCases.corporate.title"), description: t("holobox.useCases.corporate.description") },
    { environment: t("holobox.useCases.tradeShows.title"), description: t("holobox.useCases.tradeShows.description") },
    { environment: t("holobox.useCases.museums.title"), description: t("holobox.useCases.museums.description") },
    { environment: t("holobox.useCases.retail.title"), description: t("holobox.useCases.retail.description") },
    { environment: t("holobox.useCases.public.title"), description: t("holobox.useCases.public.description") },
  ];

  const benefits = [
    { title: t("holobox.benefits.consistency.title"), description: t("holobox.benefits.consistency.description") },
    { title: t("holobox.benefits.attention.title"), description: t("holobox.benefits.attention.description") },
    { title: t("holobox.benefits.reliability.title"), description: t("holobox.benefits.reliability.description") },
    { title: t("holobox.benefits.measurable.title"), description: t("holobox.benefits.measurable.description") },
  ];

  const pageTitle = `${t("holobox.title")} | Suteki Studios`;
  const pageDescription = t("holobox.intro");

  return (
    <Layout>
      {seoOverride || (
        <SEO
          title="Holobox – AI-hologram för event och reception | Suteki Studios"
          description="Holobox är en interaktiv hologramdisplay som projicerar AI-avatarer och presentationer i naturlig storlek. Perfekt för event, mässor och reception."
          lang="sv"
          canonicalUrl="https://sutekistudios.com/holobox"
          alternateSv="https://sutekistudios.com/holobox"
          alternateEn="https://sutekistudios.com/en/holobox"
        />
      )}

      {/* ═══ HERO ═══ */}
      <section className="min-h-[85vh] flex items-end relative overflow-hidden" data-hero="true">
        <div className="absolute inset-0 overflow-hidden">
          <iframe
            src="https://www.youtube.com/embed/Pj7o_SVWLpg?autoplay=1&mute=1&loop=1&playlist=Pj7o_SVWLpg&controls=0&rel=0&modestbranding=1&playsinline=1"
            className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[177.78vh] min-w-full min-h-full"
            style={{ aspectRatio: '16/9' }}
            allow="autoplay; fullscreen; encrypted-media"
            title="Holobox background video"
          />
        </div>
        <div className="absolute inset-0" style={{ background: 'linear-gradient(to top, rgba(8,12,20,0.95) 0%, rgba(8,12,20,0.50) 40%, rgba(8,12,20,0.25) 100%)' }} />
        <div className="container mx-auto px-6 lg:px-8 relative z-10 pb-20 pt-40">
          <div className="max-w-3xl">
            <p className="hero-eyebrow mb-5 animate-fade-up">{t("holobox.eyebrow")}</p>
            <h1 className="display mb-6 animate-fade-up" style={{ color: '#FFFFFF' }}>{t("holobox.title")}</h1>
            <p className="text-lg md:text-xl mb-10 leading-relaxed animate-fade-up-delay-1" style={{ color: '#CBD5E1' }}>{t("holobox.intro")}</p>
            <a href="https://calendly.com/sutekistudios/strategic-project-discussion" target="_blank" rel="noopener noreferrer" className="btn-white inline-flex items-center gap-2 animate-fade-up-delay-2">
              {t("holobox.cta")} <ArrowRight className="h-4 w-4" style={{ color: '#0B1220' }} />
            </a>
          </div>
        </div>
      </section>

      {/* ═══ QUICK FACTS ═══ */}
      <Section className="section-white">
        <SectionHeader eyebrow="Specifikationer" title={t("holobox.quickFacts.title")} />
        <ul className="grid md:grid-cols-2 gap-4 max-w-4xl">
          {quickFacts.map((fact, i) => (
            <li key={i} className="enterprise-card p-5 flex items-start gap-3">
              <CheckCircle2 className="h-5 w-5 flex-shrink-0 mt-0.5" style={{ color: '#2563EB' }} />
              <span className="text-muted-foreground leading-relaxed">{fact}</span>
            </li>
          ))}
        </ul>
      </Section>

      {/* ═══ VISUAL PROOF ═══ */}
      <Section className="section-beige">
        <SectionHeader title={t("holobox.experiences.title")} subtitle={t("holobox.experiences.intro")} />
        <div className="grid md:grid-cols-3 gap-6">
          <div className="aspect-video rounded-2xl overflow-hidden image-card">
            <img src={holoboxAvatarTradeshow} alt="Holobox AI avatar at trade show" className="w-full h-full object-cover" loading="lazy" />
          </div>
          <div className="aspect-video rounded-2xl overflow-hidden image-card">
            <img src={holoboxAvatarsStudio} alt="Holobox units with avatars in studio" className="w-full h-full object-cover" loading="lazy" />
          </div>
          <div className="aspect-video rounded-2xl overflow-hidden border border-border/30">
            <iframe src="https://www.youtube.com/embed/OdibKhsAEKg?autoplay=0&loop=1&muted=1&rel=0&modestbranding=1&playsinline=1" className="w-full h-full" allow="autoplay; fullscreen; encrypted-media" title="Holobox deployment video" />
          </div>
          <div className="aspect-video rounded-2xl overflow-hidden border border-border/30">
            <iframe src="https://www.youtube.com/embed/_BRf1tU4DpE?autoplay=0&loop=1&muted=1&rel=0&modestbranding=1&playsinline=1" className="w-full h-full" allow="autoplay; fullscreen; encrypted-media" title="Holobox experience video" />
          </div>
          <div className="aspect-video rounded-2xl overflow-hidden image-card">
            <img src={holoboxCaiaImage} alt="Holobox at retail brand activation" className="w-full h-full object-cover" loading="lazy" />
          </div>
          <div className="aspect-video rounded-2xl overflow-hidden border border-border/30">
            <iframe src="https://www.youtube.com/embed/Pj7o_SVWLpg?autoplay=0&mute=1&loop=1&playlist=Pj7o_SVWLpg&rel=0&modestbranding=1&playsinline=1" className="w-full h-full" allow="autoplay; fullscreen; encrypted-media" title="Holobox product demo" />
          </div>
        </div>
      </Section>

      {/* ═══ USE CASES ═══ */}
      <Section className="section-white">
        <SectionHeader title={t("holobox.useCases.title")} subtitle={t("holobox.useCases.intro")} />
        <div className="grid md:grid-cols-3 gap-5">
          {useCases.map((uc, i) => (
            <div key={i} className="enterprise-card p-7">
              <h3 className="font-semibold mb-2 text-foreground">{uc.environment}</h3>
              <p className="text-muted-foreground text-[15px] leading-relaxed">{uc.description}</p>
            </div>
          ))}
        </div>
      </Section>

      {/* ═══ BENEFITS ═══ */}
      <section className="relative overflow-hidden" data-theme="dark">
        <div className="absolute inset-0" style={{ background: 'hsl(222 57% 10%)' }} />
        <div className="container mx-auto px-6 lg:px-8 relative z-10 py-[var(--space-section)]">
          <SectionHeader title={t("holobox.benefits.title")} subtitle={t("holobox.benefits.intro")} tone="dark" />
          <div className="grid md:grid-cols-2 gap-6">
            {benefits.map((b, i) => (
              <div key={i} className="dark-card p-7">
                <h3 className="font-semibold mb-2">{b.title}</h3>
                <p className="text-[15px] leading-relaxed" style={{ color: 'rgba(226,232,240,0.75)' }}>{b.description}</p>
              </div>
            ))}
          </div>
        </div>
      </section>

      {/* ═══ RELATED CASES ═══ */}
      <RelatedCases category="Hologram" maxCases={3} />

      {/* ═══ CTA ═══ */}
      <Section className="section-beige">
        <div className="max-w-2xl mx-auto text-center">
          <h2 className="mb-4 text-foreground">{t("holobox.ctaSection.title")}</h2>
          <p className="text-muted-foreground mb-4 leading-relaxed">{t("holobox.ctaSection.description")}</p>
          <p className="text-sm text-muted-foreground/70 mb-8">{t("holobox.ctaSection.meetingIntent")}</p>
          <a href="https://calendly.com/sutekistudios/strategic-project-discussion" target="_blank" rel="noopener noreferrer" className="btn-primary inline-flex items-center gap-2">
            {t("holobox.ctaSection.button")}
          </a>
        </div>
      </Section>

      {/* JSON-LD: Service schema */}
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{
          __html: JSON.stringify({
            "@context": "https://schema.org",
            "@type": "Service",
            name: "Holobox – AI-hologram för event och reception",
            description: "Holobox projicerar AI-avatarer och presentationer i naturlig storlek. Hyra och permanent installation för företag.",
            provider: { "@type": "Organization", name: "Suteki Studios", url: "https://sutekistudios.com" },
            areaServed: "SE",
            serviceType: "Hologram Display",
            url: "https://sutekistudios.com/holobox",
          }),
        }}
      />
    </Layout>
  );
}
