'use client'

import { Language } from '@/lib/types'
import GradientText from '../ui/GradientText'
import FadeInView from '../ui/FadeInView'
import GlassCard from '../ui/GlassCard'
import {
  FileCheck,
  Code,
  ArrowLeftRight,
  Zap,
  Shield,
  GitPullRequest,
} from 'lucide-react'

interface USPSlideProps {
  lang: Language
}

export default function USPSlide({ lang }: USPSlideProps) {
  const de = lang === 'de'

  const title = de ? 'Unser USP' : 'Our USP'
  const subtitle = de
    ? 'Die erste Plattform, die Compliance-Dokumente und tatsächliche Code-Umsetzung verbindet'
    : 'The first platform that connects compliance documents with actual code implementation'

  const bridgeLeft = {
    icon: FileCheck,
    label: de ? 'Compliance & Audits' : 'Compliance & Audits',
    items: de
      ? ['DSGVO-Dokumente (VVT, DSFA, TOMs)', 'Audit-Management & Nachweise', 'Kunden-Anforderungen (RFQ)', 'CE-Risikobeurteilungen']
      : ['GDPR documents (RoPA, DPIA, TOMs)', 'Audit management & evidence', 'Customer requirements (RFQ)', 'CE risk assessments'],
  }

  const bridgeRight = {
    icon: Code,
    label: de ? 'Code & Security' : 'Code & Security',
    items: de
      ? ['SAST / DAST / SBOM-Analyse', 'Kontinuierliches Pentesting', 'Issue-Tracker-Integration', 'Automatische Code-Aenderungen']
      : ['SAST / DAST / SBOM analysis', 'Continuous pentesting', 'Issue tracker integration', 'Automatic code changes'],
  }

  const capabilities = [
    {
      icon: GitPullRequest,
      color: 'text-indigo-400',
      bg: 'bg-indigo-500/10 border-indigo-500/20',
      title: de ? 'RFQ-gegen-Code Prüfung' : 'RFQ-to-Code Verification',
      desc: de
        ? 'Kunden-Anforderungsdokumente werden automatisiert gegen die aktuelle Source-Code-Umsetzung geprüft. Abweichungen werden erkannt, Änderungen vorgeschlagen und auf Wunsch automatisiert umgesetzt.'
        : 'Customer requirement documents are automatically verified against current source code implementation. Deviations are detected, changes proposed and automatically implemented on request.',
    },
    {
      icon: ArrowLeftRight,
      color: 'text-purple-400',
      bg: 'bg-purple-500/10 border-purple-500/20',
      title: de ? 'Bidirektionale Synchronisation' : 'Bidirectional Synchronization',
      desc: de
        ? 'Compliance-Anforderungen fliessen direkt in den Code — und Code-Aenderungen aktualisieren automatisch die Compliance-Dokumentation. Kein manuelles Nacharbeiten.'
        : 'Compliance requirements flow directly into code — and code changes automatically update compliance documentation. No manual rework.',
    },
    {
      icon: Zap,
      color: 'text-amber-400',
      bg: 'bg-amber-500/10 border-amber-500/20',
      title: de ? 'Automatisierte Prozess-Compliance' : 'Automated Process Compliance',
      desc: de
        ? 'Vom Audit-Finding über das Ticket bis zur Code-Aenderung — der gesamte Prozess laeuft automatisiert durch. Rollen, Fristen, Eskalation und Nachweise werden End-to-End verwaltet.'
        : 'From audit finding to ticket to code change — the entire process runs automatically. Roles, deadlines, escalation and evidence are managed end-to-end.',
    },
    {
      icon: Shield,
      color: 'text-emerald-400',
      bg: 'bg-emerald-500/10 border-emerald-500/20',
      title: de ? 'Kontinuierlich statt jährlich' : 'Continuous Instead of Annual',
      desc: de
        ? 'Klassische Compliance prüft einmal im Jahr und hofft auf das Beste. Unsere Plattform prüft bei jeder Code-Aenderung — Findings werden sofort zu Tickets mit konkreten Implementierungsvorschlaegen.'
        : 'Traditional compliance checks once a year and hopes for the best. Our platform checks on every code change — findings immediately become tickets with concrete implementation proposals.',
    },
  ]

  return (
    <div>
      <FadeInView className="text-center mb-8">
        <h2 className="text-4xl md:text-5xl font-bold mb-3">
          <GradientText>{title}</GradientText>
        </h2>
        <p className="text-lg text-white/50 max-w-3xl mx-auto">{subtitle}</p>
      </FadeInView>

      {/* Bridge Visualization */}
      <FadeInView delay={0.2}>
        <div className="grid grid-cols-5 gap-3 items-center mb-8 max-w-4xl mx-auto">
          {/* Left: Compliance */}
          <div className="col-span-2">
            <GlassCard hover={false} className="p-4">
              <div className="flex items-center gap-2 mb-3">
                <div className="w-8 h-8 rounded-lg bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center">
                  <bridgeLeft.icon className="w-4 h-4 text-indigo-400" />
                </div>
                <p className="text-sm font-bold text-white">{bridgeLeft.label}</p>
              </div>
              <ul className="space-y-1.5">
                {bridgeLeft.items.map((item, idx) => (
                  <li key={idx} className="flex items-center gap-2 text-xs text-white/50">
                    <span className="w-1.5 h-1.5 rounded-full bg-indigo-400 shrink-0" />
                    {item}
                  </li>
                ))}
              </ul>
            </GlassCard>
          </div>

          {/* Center: Bridge */}
          <div className="col-span-1 flex flex-col items-center justify-center">
            <div className="w-14 h-14 rounded-full bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg shadow-indigo-500/30 mb-2">
              <ArrowLeftRight className="w-6 h-6 text-white" />
            </div>
            <p className="text-[10px] font-bold text-white/40 uppercase tracking-wider text-center">
              {de ? 'Brücke' : 'Bridge'}
            </p>
          </div>

          {/* Right: Code */}
          <div className="col-span-2">
            <GlassCard hover={false} className="p-4">
              <div className="flex items-center gap-2 mb-3">
                <div className="w-8 h-8 rounded-lg bg-purple-500/10 border border-purple-500/20 flex items-center justify-center">
                  <bridgeRight.icon className="w-4 h-4 text-purple-400" />
                </div>
                <p className="text-sm font-bold text-white">{bridgeRight.label}</p>
              </div>
              <ul className="space-y-1.5">
                {bridgeRight.items.map((item, idx) => (
                  <li key={idx} className="flex items-center gap-2 text-xs text-white/50">
                    <span className="w-1.5 h-1.5 rounded-full bg-purple-400 shrink-0" />
                    {item}
                  </li>
                ))}
              </ul>
            </GlassCard>
          </div>
        </div>
      </FadeInView>

      {/* Capability Cards */}
      <FadeInView delay={0.4}>
        <div className="grid md:grid-cols-2 gap-3 max-w-4xl mx-auto">
          {capabilities.map((cap, idx) => {
            const Icon = cap.icon
            return (
              <div key={idx} className={`border rounded-xl p-4 ${cap.bg}`}>
                <div className="flex items-center gap-2 mb-2">
                  <Icon className={`w-4 h-4 ${cap.color}`} />
                  <h3 className="text-sm font-bold text-white">{cap.title}</h3>
                </div>
                <p className="text-xs text-white/50 leading-relaxed">{cap.desc}</p>
              </div>
            )
          })}
        </div>
      </FadeInView>
    </div>
  )
}
