import type { LucideIcon } from "lucide-react";
import {
  ArrowRight,
  BarChart3,
  BookOpenCheck,
  Check,
  Database,
  FileDown,
  LayoutDashboard,
  Lightbulb,
  LockKeyhole,
  MessageSquareText,
  MonitorSmartphone,
  Network,
  Search,
  ShieldCheck,
  TrendingUp,
} from "lucide-react";
import { Link } from "react-router-dom";
import { Layout } from "@/components/layout/Layout";
import { SEOHead } from "@/components/SEOHead";
import { Section, SectionHeader } from "@/components/ui/Section";
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion";
import { useForceLanguage } from "@/hooks/useForceLanguage";

type Language = "sv" | "en";

interface SaiLandingProps {
  lang?: Language;
}

interface Capability {
  icon: LucideIcon;
  title: string;
  description: string;
}

const content = {
  sv: {
    seoTitle: "SUTEKI Agent Intelligence | Suteki Studios",
    seoDescription:
      "SAI för B2B: analysera AI-agenters kunddialoger, svarskvalitet och produktintresse. Se en syntetisk demo för e-handel, industri och tjänsteföretag.",
    heroEyebrow: "SUTEKI STUDIOS / AGENT INTELLIGENCE",
    heroTitle: "SUTEKI Agent Intelligence",
    heroTagline: "Bättre svar. Tydligare kundinsikter.",
    heroLead:
      "För B2B-företag inom e-handel, industri och tjänster. SAI Analytics utvecklas för att analysera era AI-agenter och kunddialoger: förstå produktintresse, hitta obesvarade frågor och förbättra svar och informationskällor.",
    developmentStatus: "Under utveckling · begränsad pilot under förberedelse",
    cta: "Boka demo",
    demoNote:
      "DEMO med syntetiska data. Ingen skarp tjänst erbjuds ännu; kundkonton och liveintegrationer är inte tillgängliga.",
    workflowLabel: "PLATTFORMENS AVSEDDA ARBETSFLÖDE",
    workflow: [
      {
        title: "Fånga frågan",
        text: "Förstå vad besökaren egentligen vill veta.",
      },
      {
        title: "Granska svaret",
        text: "Se kvalitet, risk och källstöd i samma perspektiv.",
      },
      {
        title: "Förbättra verksamheten",
        text: "Prioritera kunskap, innehåll och nästa affärsåtgärd.",
      },
    ],
    valueEyebrow: "FRÅN SAMTAL TILL BESLUT",
    valueTitle: "Se det som annars fastnar i enskilda konversationer.",
    values: [
      {
        title: "Förstå kundbehov",
        text: "Se vilka produkter och tjänster kunder frågar om, vad de behöver veta och vilka frågor som lämnas obesvarade.",
      },
      {
        title: "Stärk kunskapskvaliteten",
        text: "Upptäck kunskapsluckor och få underlag för att förbättra godkända informationskällor.",
      },
      {
        title: "Agera på affärsinsikter",
        text: "Identifiera friktion i kunddialogen, prioritera förbättringar och följ upp svarskvalitet och frågemönster över tid – utan utlovade affärsresultat.",
      },
    ],
    segmentsEyebrow: "FÖR B2B-FÖRETAG",
    segmentsTitle: "Utgå från frågorna som driver er affär.",
    segmentsSubtitle: "Exempel på framtida användningsområden – inte verifierade kundintegrationer eller uppnådda resultat.",
    segments: [
      { title: "E-handel", text: "Produkt-, leverans- och returfrågor: förstå vad kunder söker, var svaren brister och vilken information som behöver förbättras." },
      { title: "Industri", text: "Tekniska specifikationer, dokumentation och återförsäljarfrågor: hitta kunskapsluckor och prioritera rätt källor." },
      { title: "B2B-tjänster", text: "Support och förfrågningar: se återkommande behov, identifiera friktion och ge teamet ett tydligare underlag för uppföljning." },
    ],
    regulatedTitle: "För offentlig sektor och reglerade verksamheter",
    regulatedText: "Kommuner, regioner och reglerade finansföretag är ett särskilt kundsegment. Kundkontrollerad Private Cloud eller On-Prem är planerade, valfria enterprise-alternativ – inte ett krav för e-handel eller industri.",
    regulatedTrack: "För kommuner planeras ett separat spår med dataminimerade, källbaserade frågetjänster. Krav på åtkomst, dokumentgodkännande och drift ska prövas i varje uppdrag; ingen sådan tjänst erbjuds ännu.",
    demoEyebrow: "PRODUKTDEMONSTRATION",
    demoTitle: "SAI Analytics: kundanpassningsbara dashboards",
    demoSubtitle:
      "Den separata syntetiska demon visar Dashboard Builder, sparade vyer, mobilanpassning, diagram och export till CSV, XLSX och PDF. Skissen nedan illustrerar analysytan. SAI Analytics är inte en kundchatt; en framtida agentmodul är ett separat utvecklingsspår.",
    previewLabel: "Illustrativ produktskiss",
    previewBadge: "DEMO",
    previewView: "Sparad vy: Agentöversikt",
    previewPeriod: "Demonstrationsvy",
    chartTitle: "Ämnen över tid",
    chartNote: "Syntetiska demonstrationsdata",
    chartDescription: "Illustrativt linjediagram utan verkliga kunddata eller mätresultat",
    qualityTitle: "Kvalitet och källor",
    qualityItems: ["Ämnestrender", "Obesvarade frågor", "Riskindikatorer"],
    exportLabel: "Exportformat i demon",
    capabilitiesEyebrow: "KAPABILITETER",
    capabilitiesTitle: "Från överblick till detalj – utan att förlora sammanhanget.",
    capabilitiesSubtitle:
      "Demonstrerade gränssnittsfunktioner är tydligt skilda från de plattformsfunktioner som byggs för kommande pilotfaser.",
    demoCapability: "I produktdemon",
    plannedCapability: "Planerad plattformsfunktion",
    capabilities: [
      {
        icon: LayoutDashboard,
        title: "Dashboard Builder",
        description:
          "Kombinera relevanta vyer och spara upplägg för olika frågeställningar, team eller uppföljningsbehov.",
      },
      {
        icon: BarChart3,
        title: "Dynamisk rapportering",
        description:
          "Växla mellan diagramformat och anpassa presentationen efter det mönster eller den trend du vill undersöka.",
      },
      {
        icon: ShieldCheck,
        title: "Kvalitet och risk",
        description:
          "Följ indikatorer för svarskvalitet, eskalationsbehov och risker som bör granskas av ett ansvarigt team.",
      },
      {
        icon: Search,
        title: "Ämnen och kunskapsluckor",
        description:
          "Se vilka frågor som återkommer, var svaren inte räcker och vilket innehåll som behöver prioriteras.",
      },
      {
        icon: Lightbulb,
        title: "Källor och affärsinsikter",
        description:
          "Koppla dialogmönster till informationskällor och samla underlag för innehålls- och affärsbeslut.",
      },
      {
        icon: MonitorSmartphone,
        title: "Mobilt arbete och export",
        description:
          "Använd ett mobiloptimerat gränssnitt och exportera rapporter som CSV, XLSX eller PDF i demonstrationsmiljön.",
      },
    ],
    howEyebrow: "SÅ FUNGERAR DET",
    howTitle: "En enkel start, med tydligt fokus.",
    howSubtitle:
      "Arbetsflödet beskriver målbilden. Demonstrationen visar gränssnitt och rapportering, inte skarp datainhämtning.",
    how: [
      {
        title: "Välj vad ni vill förbättra",
        text: "Onboarding planeras kring era mål, utvalda dialoger och kundgodkänd dokumentation – med en tydligt avgränsad konsultroll.",
      },
      {
        title: "Mät kunddialoger",
        text: "Liveintegrationer och hantering av kunddata planeras för kommande faser efter separat teknisk och säkerhetsmässig granskning.",
      },
      {
        title: "Analysera mönster",
        text: "Plattformen är avsedd att synliggöra ämnen, kvalitetsindikatorer, risker och frågor som saknar tillräckliga svar.",
      },
      {
        title: "Dela rapporter",
        text: "Sparade vyer och exporter ska göra det enklare att fördela insikter till verksamhet, innehållsansvariga och ledning.",
      },
    ],
    securityEyebrow: "INFORMATIONSSÄKERHET",
    securityTitle: "Kontroll och integritet som designprinciper.",
    securitySubtitle:
      "Planerad moln-SaaS är standard för B2B. Vi utgår från kundgodkända dokument, begränsad åtkomst och målet att minimera identifierande information. Säkerheten ska granskas före drift; detta är inga ISO-certifieringspåståenden eller GDPR-garantier.",
    security: [
      {
        icon: LockKeyhole,
        title: "Minsta nödvändiga åtkomst",
        text: "Behörigheter ska begränsas till den information och de funktioner varje roll behöver.",
      },
      {
        icon: Database,
        title: "Separata kundmiljöer",
        text: "Dataseparation per kund är en planerad arkitekturprincip och ska verifieras före pilotdrift.",
      },
      {
        icon: BookOpenCheck,
        title: "Godkända informationskällor",
        text: "Källor ska ha dokumenterat godkännande, versionskontroll och möjlighet till återkallelse.",
      },
      {
        icon: Network,
        title: "Minimera identifierande information",
        text: "Onboarding ska avgränsa vilka uppgifter analysen behöver och hur identifierande information kan minimeras. Det innebär inte att all personuppgiftsbehandling är utesluten.",
      },
    ],
    plannedNoteTitle: "Tydlig gräns mellan demonstration och drift",
    plannedNote:
      "Demon visar analysgränssnitt med syntetiska data. Kundkonton, liveintegrationer, kontinuerlig mätning och kunddrift är planerade, inte tillgängliga tjänster. Den framtida agentmodulen ska godkännas och verifieras separat.",
    roadmapEyebrow: "UTVECKLINGSVÄG",
    roadmapTitle: "Analys först. Kunddrift efter verifierad pilot.",
    roadmap: [
      {
        stage: "01 / DEMONSTRATION",
        title: "Produktskiss och rapportupplevelse",
        text: "Dashboard Builder, sparade vyer, dynamiska diagram, mobilanpassning och export visas med syntetiska data.",
      },
      {
        stage: "02 / BEGRÄNSAD PILOT",
        title: "Kontrollerad webbpilot",
        text: "Inloggning, kundspecifik data och utvalda integrationer förbereds för en separat godkänd pilot – inte öppen lansering.",
      },
      {
        stage: "03 / SENARE FASER",
        title: "Utökad analys och separat agentmodul",
        text: "Fler dialogkanaler och en källbaserad agentmodul kan utvärderas senare. Analysdemon är inte bevis för fungerande kundchatt eller färdiga integrationer.",
      },
    ],
    faqEyebrow: "VANLIGA FRÅGOR",
    faqTitle: "Vad gäller i det här skedet?",
    faq: [
      {
        question: "Är SUTEKI Agent Intelligence en aktiv tjänst?",
        answer:
          "Plattformen är under utveckling och en begränsad pilot förbereds. Just nu kan vi visa en separat produktdemonstration. Sidan ger inte tillgång till en aktiv kundmiljö.",
      },
      {
        question: "Kan jag logga in eller ansluta våra AI-agenter?",
        answer:
          "Inte via den här sidan. Inloggning och liveintegrationer är planerade för senare faser. En demonstration är första steget för att diskutera behov, förutsättningar och ett eventuellt framtida pilotupplägg.",
      },
      {
        question: "Vilka data används i demonstrationen?",
        answer:
          "Demon använder syntetiska demonstrationsdata, inte verkliga kunddialoger. Den visar gränssnitt, sparade vyer, diagramformat och export utan att kräva ett kundkonto.",
      },
      {
        question: "Finns kontinuerlig mätning och historiska intervall?",
        answer:
          "Livemätning och historiska intervall på 60, 90 och 365 dagar är planerade plattformsfunktioner. De ska inte förväxlas med funktionerna i den nuvarande demonstrationsmiljön.",
      },
      {
        question: "Vilka kanaler ingår i utvecklingsplanen?",
        answer:
          "Webb är första fokus. Voice, e-post, sociala kanaler och kiosk är möjliga senare tillägg efter utvärdering av pilot, säkerhet och kundbehov.",
      },
    ],
    finalTitle: "Se vad era agentdialoger kan berätta.",
    finalText:
      "Boka en personlig genomgång av produktdemon och diskutera vilka insikter som skulle vara mest värdefulla för er verksamhet.",
    provider:
      "SUTEKI Agent Intelligence utvecklas av Suteki Studios Inc.",
  },
  en: {
    seoTitle: "SUTEKI Agent Intelligence | Suteki Studios",
    seoDescription:
      "SAI for B2B: analyse AI agent conversations, answer quality and product interest. Explore a synthetic demo for e-commerce, industry and business services.",
    heroEyebrow: "SUTEKI STUDIOS / AGENT INTELLIGENCE",
    heroTitle: "SUTEKI Agent Intelligence",
    heroTagline: "Better answers. Clearer customer insight.",
    heroLead:
      "For B2B businesses in e-commerce, industry and services. SAI Analytics is being developed to analyse your AI agents and customer conversations: understand product interest, find unanswered questions and improve answers and information sources.",
    developmentStatus: "In development · limited pilot in preparation",
    cta: "Request demo",
    demoNote:
      "DEMO using synthetic data. No live service is offered yet; customer accounts and live integrations are not available.",
    workflowLabel: "THE PLATFORM'S INTENDED WORKFLOW",
    workflow: [
      {
        title: "Capture the question",
        text: "Understand what the visitor really needs to know.",
      },
      {
        title: "Review the answer",
        text: "Assess quality, risk and source support in one view.",
      },
      {
        title: "Improve the business",
        text: "Prioritise knowledge, content and the next commercial action.",
      },
    ],
    valueEyebrow: "FROM CONVERSATIONS TO DECISIONS",
    valueTitle: "See what would otherwise remain buried in individual conversations.",
    values: [
      {
        title: "Understand customer needs",
        text: "See which products and services customers ask about, what they need to know and which questions go unanswered.",
      },
      {
        title: "Strengthen knowledge quality",
        text: "Find knowledge gaps and gain a clearer basis for improving approved information sources.",
      },
      {
        title: "Act on business insight",
        text: "Identify friction in customer conversations, prioritise improvements and track answer quality and question patterns over time — without promised business outcomes.",
      },
    ],
    segmentsEyebrow: "FOR B2B BUSINESSES",
    segmentsTitle: "Start with the questions that matter to your business.",
    segmentsSubtitle: "Examples of future use cases — not verified customer integrations or achieved results.",
    segments: [
      { title: "E-commerce", text: "Product, delivery and return questions: understand what customers look for, where answers fall short and which information needs improvement." },
      { title: "Industry", text: "Technical specifications, documentation and dealer enquiries: identify knowledge gaps and prioritise the right sources." },
      { title: "B2B services", text: "Support and enquiries: reveal recurring needs, identify friction and give your team a clearer basis for follow-up." },
    ],
    regulatedTitle: "For the public sector and regulated organisations",
    regulatedText: "Municipalities, regions and regulated financial firms are a specific customer segment. Customer-controlled Private Cloud or On-Prem are planned, optional enterprise choices — not requirements for e-commerce or industry.",
    regulatedTrack: "A separate track of data-minimised, source-based question services is planned for municipalities. Access, document approval and operating requirements must be assessed for each engagement; no such service is offered yet.",
    demoEyebrow: "PRODUCT DEMONSTRATION",
    demoTitle: "SAI Analytics: customisable dashboards",
    demoSubtitle:
      "The separate synthetic demo shows Dashboard Builder, saved views, mobile layouts, charts and CSV, XLSX and PDF exports. The concept below illustrates the analytics workspace. SAI Analytics is not a customer chat service; a future agent module is a separate development track.",
    previewLabel: "Illustrative product concept",
    previewBadge: "DEMO",
    previewView: "Saved view: Agent overview",
    previewPeriod: "Demonstration view",
    chartTitle: "Topics over time",
    chartNote: "Synthetic demonstration data",
    chartDescription: "Illustrative line chart with no real customer data or measured results",
    qualityTitle: "Quality and sources",
    qualityItems: ["Topic trends", "Unanswered questions", "Risk indicators"],
    exportLabel: "Export formats in the demonstration",
    capabilitiesEyebrow: "CAPABILITIES",
    capabilitiesTitle: "From overview to detail – without losing the context.",
    capabilitiesSubtitle:
      "Demonstrated interface features are clearly separated from the platform capabilities being built for future pilot phases.",
    demoCapability: "In the product demonstration",
    plannedCapability: "Planned platform capability",
    capabilities: [
      {
        icon: LayoutDashboard,
        title: "Dashboard Builder",
        description:
          "Combine relevant views and save layouts for different questions, teams or reporting needs.",
      },
      {
        icon: BarChart3,
        title: "Dynamic reporting",
        description:
          "Switch between chart formats and adapt the presentation to the pattern or trend you want to examine.",
      },
      {
        icon: ShieldCheck,
        title: "Quality and risk",
        description:
          "Monitor indicators for answer quality, escalation needs and risks that should be reviewed by a responsible team.",
      },
      {
        icon: Search,
        title: "Topics and knowledge gaps",
        description:
          "See which questions recur, where answers fall short and which content should be prioritised.",
      },
      {
        icon: Lightbulb,
        title: "Source and business insight",
        description:
          "Connect conversation patterns to information sources and gather evidence for content and business decisions.",
      },
      {
        icon: MonitorSmartphone,
        title: "Mobile workspace and export",
        description:
          "Use a mobile-optimised interface and export reports as CSV, XLSX or PDF in the demonstration environment.",
      },
    ],
    howEyebrow: "HOW IT WORKS",
    howTitle: "A simple start, with a clear focus.",
    howSubtitle:
      "This workflow describes the intended platform. The demonstration shows interface and reporting concepts, not live data collection.",
    how: [
      {
        title: "Choose what to improve",
        text: "Planned onboarding starts with your goals, selected conversations and customer-approved documentation — with a clearly defined consulting role.",
      },
      {
        title: "Measure customer conversations",
        text: "Live integrations and customer data processing are planned for later phases following separate technical and security reviews.",
      },
      {
        title: "Analyse patterns",
        text: "The platform is intended to reveal topics, quality indicators, risks and questions without adequate answers.",
      },
      {
        title: "Share reports",
        text: "Saved views and exports are designed to make insights easier to distribute to operational teams, content owners and leadership.",
      },
    ],
    securityEyebrow: "INFORMATION SECURITY",
    securityTitle: "Control and integrity as design principles.",
    securitySubtitle:
      "Planned cloud SaaS is the B2B standard. The approach uses customer-approved documents, limited access and the aim of minimising identifying information. Security must be reviewed before operation; these are not ISO certification claims or GDPR guarantees.",
    security: [
      {
        icon: LockKeyhole,
        title: "Least-privilege access",
        text: "Permissions are intended to be limited to the information and functions each role requires.",
      },
      {
        icon: Database,
        title: "Separate customer environments",
        text: "Per-customer data separation is a planned architectural principle and must be verified before pilot operation.",
      },
      {
        icon: BookOpenCheck,
        title: "Approved information sources",
        text: "Sources are intended to have documented approval, version control and a clear revocation process.",
      },
      {
        icon: Network,
        title: "Minimise identifying information",
        text: "Onboarding will define what information the analysis needs and how identifying information can be minimised. This does not mean all personal data processing is excluded.",
      },
    ],
    plannedNoteTitle: "A clear boundary between demonstration and operation",
    plannedNote:
      "The demo shows an analytics interface with synthetic data. Customer accounts, live integrations, continuous measurement and customer operation are planned, not available services. The future agent module requires separate approval and verification.",
    roadmapEyebrow: "DEVELOPMENT PATH",
    roadmapTitle: "Analytics first. Customer operation after a verified pilot.",
    roadmap: [
      {
        stage: "01 / DEMONSTRATION",
        title: "Product concept and reporting experience",
        text: "Dashboard Builder, saved views, dynamic charts, mobile optimisation and export are shown with synthetic data.",
      },
      {
        stage: "02 / LIMITED PILOT",
        title: "Controlled web pilot",
        text: "Sign-in, customer-specific data and selected integrations are being prepared for a separately approved pilot – not an open launch.",
      },
      {
        stage: "03 / LATER PHASES",
        title: "Extended analytics and a separate agent module",
        text: "More conversation channels and a source-based agent module may be evaluated later. The analytics demo is not evidence of a working customer chat or completed integrations.",
      },
    ],
    faqEyebrow: "FREQUENTLY ASKED QUESTIONS",
    faqTitle: "What applies at this stage?",
    faq: [
      {
        question: "Is SUTEKI Agent Intelligence an active service?",
        answer:
          "The platform is in development and a limited pilot is being prepared. We can currently provide a separate product demonstration. This page does not provide access to an active customer environment.",
      },
      {
        question: "Can I sign in or connect our AI agents?",
        answer:
          "Not through this page. Sign-in and live integrations are planned for later phases. A demonstration is the first step to discuss requirements, prerequisites and a possible future pilot.",
      },
      {
        question: "What data is used in the demonstration?",
        answer:
          "The demonstration uses synthetic demonstration data, not real customer conversations. It presents the interface, saved views, chart formats and exports without requiring a customer account.",
      },
      {
        question: "Are continuous measurement and historical ranges available?",
        answer:
          "Live measurement and 60, 90 and 365-day historical ranges are planned platform capabilities. They should not be confused with the features in the current demonstration environment.",
      },
      {
        question: "Which channels are included in the development plan?",
        answer:
          "The web is the initial focus. Voice, email, social channels and kiosk are possible later additions following evaluation of the pilot, security and customer needs.",
      },
    ],
    finalTitle: "See what your agent conversations can reveal.",
    finalText:
      "Request a personal walkthrough of the product demonstration and discuss which insights would be most valuable to your organisation.",
    provider:
      "SUTEKI Agent Intelligence is being developed by Suteki Studios Inc.",
  },
} as const;

function ProductPreview({ lang }: { lang: Language }) {
  const c = content[lang];
  const chartFormats = lang === "sv" ? ["Linje", "Stapel", "Yta"] : ["Line", "Bar", "Area"];

  return (
    <div className="overflow-hidden rounded-2xl border border-border bg-card shadow-2xl shadow-foreground/5">
      <div className="flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-4 sm:px-6">
        <div className="flex items-center gap-3">
          <div className="flex h-9 w-9 items-center justify-center rounded-lg bg-accent text-accent-foreground">
            <BarChart3 className="h-4 w-4" aria-hidden="true" />
          </div>
          <div>
            <p className="text-sm font-semibold">SUTEKI Agent Intelligence</p>
            <p className="text-xs text-muted-foreground">{c.previewLabel}</p>
          </div>
        </div>
        <span className="rounded-full border border-accent/30 bg-accent/10 px-3 py-1 text-xs font-semibold tracking-wider text-accent">
          {c.previewBadge}
        </span>
      </div>

      <div className="grid md:grid-cols-[180px_1fr]">
        <div className="hidden border-r border-border bg-muted/40 p-4 md:block">
          <div className="mb-6 flex items-center gap-2 text-sm font-medium text-accent">
            <LayoutDashboard className="h-4 w-4" aria-hidden="true" />
            Dashboard Builder
          </div>
          <div className="space-y-3 text-sm text-muted-foreground">
            <p>{c.qualityItems[0]}</p>
            <p>{c.qualityItems[1]}</p>
            <p>{c.qualityItems[2]}</p>
          </div>
        </div>

        <div className="p-4 sm:p-6">
          <div className="mb-6 flex flex-wrap items-center justify-between gap-3">
            <div className="flex items-center gap-2 text-sm font-medium">
              <Check className="h-4 w-4 text-accent" aria-hidden="true" />
              {c.previewView}
            </div>
            <span className="text-xs text-muted-foreground">{c.previewPeriod}</span>
          </div>

          <div className="mb-5 grid gap-3 sm:grid-cols-3">
            {c.qualityItems.map((item, index) => {
              const icons = [TrendingUp, MessageSquareText, ShieldCheck];
              const Icon = icons[index];
              return (
                <div key={item} className="rounded-xl border border-border bg-background p-4">
                  <Icon className="mb-3 h-4 w-4 text-accent" aria-hidden="true" />
                  <p className="text-sm font-medium leading-snug">{item}</p>
                </div>
              );
            })}
          </div>

          <div className="rounded-xl border border-border p-4 sm:p-5">
            <div className="mb-5 flex flex-wrap items-start justify-between gap-2">
              <div>
                <p className="font-medium">{c.chartTitle}</p>
                <p className="text-xs text-muted-foreground">{c.chartNote}</p>
              </div>
              <div className="flex gap-1 rounded-lg bg-muted p-1 text-xs text-muted-foreground" aria-hidden="true">
                {chartFormats.map((format, index) => (
                  <span key={format} className={index === 0 ? "rounded-md bg-card px-2 py-1 text-foreground shadow-sm" : "px-2 py-1"}>
                    {format}
                  </span>
                ))}
              </div>
            </div>
            <svg
              className="h-48 w-full sm:h-56"
              viewBox="0 0 640 220"
              role="img"
              aria-label={c.chartDescription}
              preserveAspectRatio="none"
            >
              <title>{c.chartDescription}</title>
              {[30, 80, 130, 180].map((y) => (
                <line key={y} x1="0" y1={y} x2="640" y2={y} stroke="hsl(var(--border))" strokeWidth="1" />
              ))}
              <path
                d="M0 174 C65 160, 80 105, 145 125 S245 168, 305 105 S410 35, 465 76 S565 125, 640 40"
                fill="none"
                stroke="hsl(var(--accent))"
                strokeWidth="4"
                strokeLinecap="round"
              />
              <path
                d="M0 174 C65 160, 80 105, 145 125 S245 168, 305 105 S410 35, 465 76 S565 125, 640 40 L640 220 L0 220 Z"
                fill="hsl(var(--accent) / 0.07)"
              />
              {[0, 145, 305, 465, 640].map((x, index) => {
                const y = [174, 125, 105, 76, 40][index];
                return <circle key={x} cx={x} cy={y} r="5" fill="hsl(var(--card))" stroke="hsl(var(--accent))" strokeWidth="3" />;
              })}
            </svg>
          </div>

          <div className="mt-5 flex flex-wrap items-center justify-between gap-3">
            <p className="text-xs text-muted-foreground">{c.exportLabel}</p>
            <div className="flex flex-wrap gap-2">
              {["CSV", "XLSX", "PDF"].map((format) => (
                <span key={format} className="inline-flex items-center gap-1.5 rounded-full border border-border px-3 py-1 text-xs font-medium">
                  <FileDown className="h-3.5 w-3.5 text-accent" aria-hidden="true" />
                  {format}
                </span>
              ))}
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}

export default function SaiLanding({ lang = "sv" }: SaiLandingProps) {
  useForceLanguage(lang);
  const c = content[lang];
  const contactPath = lang === "sv" ? "/kontakt" : "/contact";

  return (
    <Layout>
      <SEOHead
        title={c.seoTitle}
        description={c.seoDescription}
        forceLang={lang}
        noIndex
        ogLocale={lang === "sv" ? "sv_SE" : "en_US"}
        hreflangOverrides={{ sv: "/sai", en: "/en/sai", xDefault: "/sai" }}
      />

      <section className="section-dark relative overflow-hidden" data-hero="true" data-theme="dark">
        <div className="container mx-auto grid min-h-[78vh] items-center gap-14 px-6 pb-20 pt-36 lg:grid-cols-[1.1fr_0.9fr] lg:px-8 lg:pb-24 lg:pt-44">
          <div className="max-w-3xl">
            <p className="hero-eyebrow mb-5">{c.heroEyebrow}</p>
            <h1 className="display mb-6 text-balance">{c.heroTitle}</h1>
            <p className="mb-5 text-2xl font-medium leading-tight text-foreground sm:text-3xl">{c.heroTagline}</p>
            <p className="hero-text-body mb-7 max-w-2xl text-lg leading-relaxed">{c.heroLead}</p>
            <div className="mb-8 inline-flex max-w-full items-center gap-2 rounded-full border border-border px-4 py-2 text-sm">
              <span className="h-2 w-2 shrink-0 rounded-full bg-accent" aria-hidden="true" />
              <span>{c.developmentStatus}</span>
            </div>
            <div>
              <Link to={contactPath} className="btn-white inline-flex items-center gap-2">
                {c.cta}
                <ArrowRight className="h-4 w-4" aria-hidden="true" />
              </Link>
            </div>
            <p className="hero-text-muted mt-5 max-w-xl text-sm">{c.demoNote}</p>
          </div>

          <div className="dark-card p-5 sm:p-7 lg:p-8">
            <p className="eyebrow mb-7">{c.workflowLabel}</p>
            <div className="space-y-3">
              {c.workflow.map((item, index) => (
                <div key={item.title} className="relative flex gap-4 rounded-xl border border-border bg-background p-5">
                  <span className="text-sm font-semibold text-accent">0{index + 1}</span>
                  <div>
                    <h2 className="mb-1 text-lg font-semibold">{item.title}</h2>
                    <p className="text-sm text-muted-foreground">{item.text}</p>
                  </div>
                </div>
              ))}
            </div>
          </div>
        </div>
      </section>

      <Section className="section-white">
        <SectionHeader eyebrow={c.valueEyebrow} title={c.valueTitle} />
        <div className="grid gap-px overflow-hidden rounded-2xl border border-border bg-border md:grid-cols-3">
          {c.values.map((value, index) => (
            <article key={value.title} className="bg-card p-7 sm:p-9">
              <span className="mb-8 block text-sm font-semibold text-accent">0{index + 1}</span>
              <h3 className="mb-4">{value.title}</h3>
              <p className="text-muted-foreground">{value.text}</p>
            </article>
          ))}
        </div>
      </Section>

      <Section className="section-white">
        <SectionHeader eyebrow={c.segmentsEyebrow} title={c.segmentsTitle} subtitle={c.segmentsSubtitle} />
        <div className="grid gap-8 md:grid-cols-3">
          {c.segments.map((segment) => (
            <article key={segment.title} className="border-t-2 border-accent pt-6">
              <h3 className="mb-4">{segment.title}</h3>
              <p className="text-muted-foreground">{segment.text}</p>
            </article>
          ))}
        </div>
      </Section>

      <Section className="section-beige">
        <SectionHeader eyebrow={c.demoEyebrow} title={c.demoTitle} subtitle={c.demoSubtitle} />
        <ProductPreview lang={lang} />
      </Section>

      <Section className="section-white">
        <SectionHeader eyebrow={c.capabilitiesEyebrow} title={c.capabilitiesTitle} subtitle={c.capabilitiesSubtitle} />
        <div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
          {(c.capabilities as readonly Capability[]).map((capability, index) => {
            const Icon = capability.icon;
            const isDemo = index === 0 || index === 1 || index === 5;
            return (
              <article key={capability.title} className="enterprise-card flex h-full flex-col p-7">
                <div className="mb-6 flex h-11 w-11 items-center justify-center rounded-xl bg-accent/10">
                  <Icon className="h-5 w-5 text-accent" aria-hidden="true" />
                </div>
                <h3 className="mb-3">{capability.title}</h3>
                <p className="mb-6 text-muted-foreground">{capability.description}</p>
                <p className={`mt-auto text-xs font-semibold uppercase tracking-wider ${isDemo ? "text-accent" : "text-muted-foreground"}`}>
                  {isDemo ? c.demoCapability : c.plannedCapability}
                </p>
              </article>
            );
          })}
        </div>
      </Section>

      <Section className="section-dark" data-theme="dark">
        <SectionHeader eyebrow={c.howEyebrow} title={c.howTitle} subtitle={c.howSubtitle} tone="dark" />
        <div className="grid gap-5 md:grid-cols-2 lg:grid-cols-4">
          {c.how.map((step, index) => (
            <article key={step.title} className="dark-card relative p-6 sm:p-7">
              <div className="mb-8 flex items-center justify-between">
                <span className="text-sm font-semibold text-accent">0{index + 1}</span>
                {index < c.how.length - 1 && <ArrowRight className="hidden h-4 w-4 text-muted-foreground lg:block" aria-hidden="true" />}
              </div>
              <h3 className="mb-3 text-xl">{step.title}</h3>
              <p className="text-sm text-muted-foreground">{step.text}</p>
            </article>
          ))}
        </div>
      </Section>

      <Section className="section-white">
        <SectionHeader eyebrow={c.securityEyebrow} title={c.securityTitle} subtitle={c.securitySubtitle} />
        <div className="grid gap-10 lg:grid-cols-[1fr_0.8fr] lg:items-start">
          <div className="grid gap-8 sm:grid-cols-2">
            {c.security.map((principle) => {
              const Icon = principle.icon;
              return (
                <article key={principle.title}>
                  <Icon className="mb-4 h-6 w-6 text-accent" aria-hidden="true" />
                  <h3 className="mb-3 text-xl">{principle.title}</h3>
                  <p className="text-sm text-muted-foreground">{principle.text}</p>
                </article>
              );
            })}
          </div>
          <aside className="rounded-2xl border border-accent/20 bg-accent/5 p-7 sm:p-8">
            <ShieldCheck className="mb-5 h-7 w-7 text-accent" aria-hidden="true" />
            <h3 className="mb-4 text-xl">{c.plannedNoteTitle}</h3>
            <p className="text-muted-foreground">{c.plannedNote}</p>
          </aside>
        </div>
      </Section>

      <Section className="section-beige">
        <SectionHeader eyebrow={c.roadmapEyebrow} title={c.roadmapTitle} />
        <div className="grid gap-6 lg:grid-cols-3">
          {c.roadmap.map((phase) => (
            <article key={phase.stage} className="border-t-2 border-accent pt-6">
              <p className="eyebrow-muted mb-4">{phase.stage}</p>
              <h3 className="mb-4">{phase.title}</h3>
              <p className="text-muted-foreground">{phase.text}</p>
            </article>
          ))}
        </div>
      </Section>

      <Section className="section-white" narrow>
        <SectionHeader title={c.regulatedTitle} />
        <div className="space-y-4 text-muted-foreground">
          <p>{c.regulatedText}</p>
          <p>{c.regulatedTrack}</p>
        </div>
      </Section>

      <Section className="section-white" narrow>
        <SectionHeader eyebrow={c.faqEyebrow} title={c.faqTitle} />
        <Accordion type="single" collapsible className="w-full">
          {c.faq.map((item, index) => (
            <AccordionItem key={item.question} value={`item-${index}`}>
              <AccordionTrigger className="text-left text-base sm:text-lg">{item.question}</AccordionTrigger>
              <AccordionContent className="text-base leading-relaxed text-muted-foreground">{item.answer}</AccordionContent>
            </AccordionItem>
          ))}
        </Accordion>
      </Section>

      <Section className="section-dark" data-theme="dark">
        <div className="mx-auto max-w-4xl text-center">
          <h2 className="mb-5 text-balance">{c.finalTitle}</h2>
          <p className="mx-auto mb-8 max-w-2xl text-lg text-muted-foreground">{c.finalText}</p>
          <Link to={contactPath} className="btn-white inline-flex items-center gap-2">
            {c.cta}
            <ArrowRight className="h-4 w-4" aria-hidden="true" />
          </Link>
          <p className="mx-auto mt-12 max-w-2xl border-t border-border pt-6 text-sm text-muted-foreground">{c.provider}</p>
        </div>
      </Section>
    </Layout>
  );
}
