import { ServiceHeroImage } from '@/components/ui/service-hero-image'
import { Header } from '@/components/layout/header'
import { Footer } from '@/components/layout/footer'
import { ScrollReveal } from '@/components/ui/scroll-reveal'
import Link from 'next/link'
import { ShieldAlert, ArrowRight, CheckCircle2, Shield, Code, Globe, Layers, Zap, Target, Lock, AlertTriangle, Database, Server, BarChart3, RefreshCw, Users, Activity, ChevronRight, TrendingUp, Clock, Ban, Building2, ShieldCheck } from 'lucide-react'

export const metadata = { title: 'Web Application Security - Drish Infra', description: 'Comprehensive web application security testing, protection, and monitoring. OWASP Top 10, API security, and real-time WAF protection.' }

export default function WebApplicationSecurityPage() {
  return (
    <main className="min-h-screen bg-[#f8fafc] text-slate-900">
      <Header />

      {/* ─── SECTION 1 · Hero (unchanged) ──────────────── */}
      <section className="relative overflow-hidden bg-gradient-to-br from-slate-950 via-blue-950 to-blue-900 text-white pt-14 pb-20 lg:pt-16 lg:pb-28">
        <div className="absolute inset-0 opacity-[0.04]" style={{ backgroundImage: 'radial-gradient(circle at 1px 1px, #2563eb 1px, transparent 0)', backgroundSize: '24px 24px' }} />
        <div className="relative max-w-7xl mx-auto px-6 lg:px-8">
          <div className="grid lg:grid-cols-2 gap-12 items-center">
            <div className="max-w-3xl mx-auto text-center lg:max-w-none">
            <div className="w-16 h-16 rounded-2xl bg-gradient-to-br from-blue-400 to-blue-500 flex items-center justify-center mx-auto mb-6 shadow-lg shadow-blue-500/30"><ShieldAlert className="w-8 h-8 text-white" /></div>
            <h1 className="text-4xl lg:text-5xl xl:text-6xl font-extrabold leading-[1.1] mb-6">Web Application <span className="bg-gradient-to-r from-blue-400 to-blue-500 bg-clip-text text-transparent">Security</span></h1>
            <p className="text-lg text-slate-300 leading-relaxed mb-8 max-w-2xl mx-auto">Protect your web applications from the inside out. From secure coding to WAF protection — we secure your applications across the entire lifecycle.</p>
            <div className="flex flex-wrap justify-center gap-4">
              <Link href="/contact" className="inline-flex items-center gap-2 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-400 hover:to-blue-500 text-white font-bold text-sm px-6 py-3 rounded-xl shadow-lg shadow-blue-500/25 transition-all duration-300 hover:scale-105">Get App Security Assessment <ArrowRight className="w-4 h-4" /></Link>
            </div>
            </div>
            <div className="block order-first lg:order-last">
              <ServiceHeroImage label="Web Application Security" stats={[{ value: 'OWASP', label: 'Top 10' }, { value: '100%', label: 'Coverage' }, { value: '<24h', label: 'Report Delivery' }]}>
              <div className="w-16 h-16 rounded-2xl bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center shadow-lg shadow-blue-500/20">
                <ShieldAlert className="w-8 h-8 text-white" />
              </div>
            </ServiceHeroImage>
            </div>
          </div>
        </div>
      </section>

      {/* ─── SECTION 2 · Stats Bar ─────────────────────── */}
      <ScrollReveal>
      <section className="py-16 bg-gradient-to-r from-slate-950 via-blue-950 to-blue-900">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="grid grid-cols-2 md:grid-cols-4 gap-8">
            {[
              { number: '2,000+', label: 'Apps Secured', sub: 'Web and mobile applications' },
              { number: 'OWASP', label: 'Top 10 Coverage', sub: 'Full OWASP coverage' },
              { number: '99.9%', label: 'Uptime Protected', sub: 'With WAF services' },
              { number: '<4 hrs', label: 'Critical Fix Time', sub: 'Average remediation' },
            ].map((m, i) => (
              <div key={i} className="text-center">
                <p className="text-3xl lg:text-4xl font-extrabold text-white mb-1">{m.number}</p>
                <p className="text-sm font-semibold text-blue-300">{m.label}</p>
                <p className="text-xs text-slate-400 mt-1">{m.sub}</p>
              </div>
            ))}
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 3 · Split Image + Text ────────────── */}
      <ScrollReveal delay={100}>
      <section className="py-12 lg:py-16">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="grid lg:grid-cols-2 gap-16 items-center">
            <div className="relative">
              <div className="aspect-[4/3] rounded-3xl overflow-hidden bg-gradient-to-br from-blue-100 to-blue-50 border border-blue-100">
                <img src="/placeholder.jpg" alt="Web Application Security Testing" className="w-full h-full object-cover" />
              </div>
              <div className="absolute -bottom-6 -right-6 bg-white rounded-2xl border border-slate-200 shadow-xl p-5 max-w-[220px]">
                <div className="flex items-center gap-2 mb-2">
                  <div className="w-2 h-2 rounded-full bg-red-500 animate-pulse" />
                  <span className="text-xs font-bold text-red-600 uppercase">Critical Alert</span>
                </div>
                <p className="text-2xl font-extrabold text-slate-900">12</p>
                <p className="text-xs text-slate-500">Critical XSS found today</p>
              </div>
            </div>
            <div>
              <p className="text-xs font-bold text-blue-600 uppercase tracking-wider mb-3">Why Web App Security Matters</p>
              <h2 className="text-3xl lg:text-4xl font-extrabold mb-6">The Cost of Unsecured Applications</h2>
              <p className="text-slate-500 leading-relaxed mb-8">
                Web applications are the <strong className="text-slate-900">#1 attack vector</strong> for data breaches. Without comprehensive security testing and protection, your applications remain exposed to injection attacks, broken authentication, and zero-day exploits.
              </p>
              <div className="space-y-4">
                {[
                  { stat: '43%', label: 'Of data breaches target web applications', icon: Target },
                  { stat: '$4.45M', label: 'Average cost of a data breach in 2023', icon: TrendingUp },
                  { stat: '94%', label: 'Of apps tested had critical vulnerabilities', icon: AlertTriangle },
                ].map((item, i) => {
                  const Icon = item.icon
                  return (
                    <div key={i} className="flex items-start gap-4 bg-slate-50 rounded-xl p-4">
                      <div className="w-10 h-10 rounded-lg bg-blue-50 flex items-center justify-center flex-shrink-0">
                        <Icon className="w-5 h-5 text-blue-600" />
                      </div>
                      <div>
                        <p className="font-bold text-slate-900">{item.stat}</p>
                        <p className="text-sm text-slate-500">{item.label}</p>
                      </div>
                    </div>
                  )
                })}
              </div>
            </div>
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 4 · Service Grid ──────────────────── */}
      <ScrollReveal delay={100}>
      <section className="py-12 lg:py-16 bg-gradient-to-b from-white to-slate-50">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="text-center mb-16">
            <p className="text-xs font-bold text-blue-600 uppercase tracking-wider mb-3">Our Services</p>
            <h2 className="text-3xl lg:text-4xl font-extrabold mb-4">Comprehensive App Security</h2>
            <p className="text-slate-500 max-w-2xl mx-auto">Full-spectrum web application security covering static analysis, dynamic testing, firewall protection, and secure development practices.</p>
          </div>
          <div className="grid sm:grid-cols-2 lg:grid-cols-3 gap-6">
            {[
              { title: 'SAST (Static Analysis)', desc: 'Analyze source code for security vulnerabilities before deployment. Catch flaws early in the development cycle.', icon: Code, highlight: 'Pre-Deploy' },
              { title: 'DAST (Dynamic Analysis)', desc: 'Test running applications for vulnerabilities from the outside — simulating real-world attack scenarios.', icon: Globe, highlight: 'Real-Time' },
              { title: 'WAF Deployment', desc: 'Web Application Firewall setup with custom rule creation, managed protection, and continuous tuning.', icon: Shield, highlight: '24/7 Shield' },
              { title: 'API Security Testing', desc: 'REST, GraphQL, and SOAP API vulnerability assessment with authentication and authorization testing.', icon: Layers, highlight: 'OWASP API' },
              { title: 'Secure Code Review', desc: 'Expert manual code review for security flaws, logic bugs, and compliance violations.', icon: Target, highlight: 'Expert-Led' },
              { title: 'DevSecOps Integration', desc: 'Embed security into your CI/CD pipeline with automated scanning and shift-left practices.', icon: RefreshCw, highlight: 'Shift-Left' },
            ].map((item, i) => {
              const Icon = item.icon
              return (
                <div key={i} className="group bg-white rounded-2xl border border-slate-200 p-6 hover:shadow-xl hover:border-blue-200 transition-all duration-300 hover:-translate-y-1">
                  <div className="flex items-center justify-between mb-4">
                    <div className="w-11 h-11 rounded-xl bg-blue-50 flex items-center justify-center group-hover:bg-blue-100 transition-colors">
                      <Icon className="w-5 h-5 text-blue-600" />
                    </div>
                    <span className="text-[10px] font-bold text-blue-600 bg-blue-50 px-2.5 py-1 rounded-full">{item.highlight}</span>
                  </div>
                  <h3 className="font-bold text-lg mb-2">{item.title}</h3>
                  <p className="text-sm text-slate-500 leading-relaxed">{item.desc}</p>
                  <div className="mt-4 pt-4 border-t border-slate-100">
                    <Link href="/contact" className="text-sm font-semibold text-blue-600 hover:text-blue-700 flex items-center gap-1 transition-colors">
                      Learn more <ChevronRight className="w-3.5 h-3.5" />
                    </Link>
                  </div>
                </div>
              )
            })}
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 5 · OWASP Top 10 Showcase ─────────── */}
      <ScrollReveal delay={100}>
      <section className="py-12 lg:py-16">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="text-center mb-16">
            <p className="text-xs font-bold text-blue-600 uppercase tracking-wider mb-3">OWASP Top 10</p>
            <h2 className="text-3xl lg:text-4xl font-extrabold mb-4">Full OWASP Top 10 Coverage</h2>
            <p className="text-slate-500 max-w-2xl mx-auto">We test, identify, and remediate all OWASP Top 10 vulnerabilities — the industry standard for web application security risks.</p>
          </div>
          <div className="grid sm:grid-cols-2 lg:grid-cols-5 gap-4">
            {[
              { id: 'A01', name: 'Broken Access Control', severity: 'Critical' },
              { id: 'A02', name: 'Cryptographic Failures', severity: 'High' },
              { id: 'A03', name: 'Injection', severity: 'Critical' },
              { id: 'A04', name: 'Insecure Design', severity: 'High' },
              { id: 'A05', name: 'Security Misconfiguration', severity: 'Medium' },
              { id: 'A06', name: 'Vulnerable Components', severity: 'High' },
              { id: 'A07', name: 'Auth Failures', severity: 'Critical' },
              { id: 'A08', name: 'Data Integrity Failures', severity: 'High' },
              { id: 'A09', name: 'Logging Failures', severity: 'Medium' },
              { id: 'A10', name: 'SSRF', severity: 'Critical' },
            ].map((v, i) => (
              <div key={i} className="bg-white rounded-xl border border-slate-200 p-4 hover:shadow-md transition-all duration-200 text-center">
                <p className="text-xs font-bold text-blue-500 mb-1">{v.id}</p>
                <p className="text-sm font-bold text-slate-700 mb-2">{v.name}</p>
                <span className={`text-[10px] font-bold px-2.5 py-1 rounded-full ${v.severity === 'Critical' ? 'text-red-600 bg-red-50' : v.severity === 'High' ? 'text-orange-600 bg-orange-50' : 'text-blue-600 bg-blue-50'}`}>{v.severity}</span>
              </div>
            ))}
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 6 · Comparison Table ──────────────── */}
      <ScrollReveal delay={100}>
      <section className="py-12 lg:py-16 bg-gradient-to-b from-white to-slate-50">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="text-center mb-16">
            <p className="text-xs font-bold text-blue-600 uppercase tracking-wider mb-3">Comparison</p>
            <h2 className="text-3xl lg:text-4xl font-extrabold mb-4">With vs Without AppSec — The Real Difference</h2>
            <p className="text-slate-500 max-w-2xl mx-auto">See what organizations without application security face versus those with comprehensive protection.</p>
          </div>
          <div className="bg-white rounded-3xl border border-slate-200 overflow-hidden shadow-xl">
            <div className="grid grid-cols-3 bg-slate-50 border-b border-slate-200">
              <div className="p-5 font-bold text-sm text-slate-600">Metric</div>
              <div className="p-5 font-bold text-sm text-center text-red-600 bg-red-50/50">Without AppSec</div>
              <div className="p-5 font-bold text-sm text-center text-blue-600 bg-blue-50/50">With Drish AppSec</div>
            </div>
            {[
              { metric: 'Vulnerability Discovery', without: 'Post-deployment / reactive', with: 'Pre-deployment + continuous' },
              { metric: 'OWASP Coverage', without: 'Partial or unknown', with: 'Full Top 10 + API Top 10' },
              { metric: 'Code Quality', without: 'No security review', with: 'SAST + manual code review' },
              { metric: 'Deployment Speed', without: 'Slow (manual QA gates)', with: 'Fast (automated CI/CD scanning)' },
              { metric: 'Incident Response', without: 'Days to weeks', with: '<4 hours critical fix' },
              { metric: 'Compliance', without: 'Audit failures', with: 'Continuous compliance' },
              { metric: 'WAF Protection', without: 'None or basic rules', with: 'Custom rules + managed tuning' },
              { metric: 'Dev Efficiency', without: 'Security bottlenecks', with: 'Shift-left DevSecOps' },
            ].map((row, i) => (
              <div key={i} className={`grid grid-cols-3 border-b border-slate-100 last:border-0 ${i % 2 === 0 ? 'bg-white' : 'bg-slate-50/50'}`}>
                <div className="p-5 font-semibold text-sm text-slate-700">{row.metric}</div>
                <div className="p-5 text-sm text-center text-red-500 font-medium">{row.without}</div>
                <div className="p-5 text-sm text-center text-blue-600 font-bold">{row.with}</div>
              </div>
            ))}
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 7 · Market Growth ─────────────────── */}
      <ScrollReveal delay={100}>
      <section className="py-12 lg:py-16">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="grid lg:grid-cols-2 gap-16 items-center">
            <div>
              <p className="text-xs font-bold text-blue-600 uppercase tracking-wider mb-3">Market Insights</p>
              <h2 className="text-3xl lg:text-4xl font-extrabold mb-6">Application Security Is Growing Fast</h2>
              <p className="text-slate-500 leading-relaxed mb-8">
                The global application security market is projected to reach <strong className="text-slate-900">$9.5 billion by 2028</strong>, growing at 16.4% CAGR. Organizations are shifting left — embedding security earlier in the development lifecycle.
              </p>
              <div className="space-y-4">
                {[
                  { label: 'SAST Adoption Rate', value: '78%', width: '78%' },
                  { label: 'WAF Market Growth', value: '65%', width: '65%' },
                  { label: 'API Security Investment', value: '82%', width: '82%' },
                  { label: 'DevSecOps Maturity', value: '58%', width: '58%' },
                ].map((bar, i) => (
                  <div key={i}>
                    <div className="flex justify-between mb-1">
                      <span className="text-sm font-semibold text-slate-700">{bar.label}</span>
                      <span className="text-sm font-bold text-blue-600">{bar.value}</span>
                    </div>
                    <div className="h-2.5 bg-slate-100 rounded-full overflow-hidden">
                      <div className="h-full bg-gradient-to-r from-blue-500 to-blue-600 rounded-full" style={{ width: bar.width }} />
                    </div>
                  </div>
                ))}
              </div>
            </div>
            <div className="grid grid-cols-2 gap-4">
              <div className="bg-white rounded-2xl border border-slate-200 p-6 text-center hover:shadow-lg transition-all duration-300">
                <div className="w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center mx-auto mb-3"><TrendingUp className="w-6 h-6 text-blue-600" /></div>
                <p className="text-3xl font-extrabold text-slate-900 mb-1">$9.5B</p>
                <p className="text-xs text-slate-500">AppSec Market by 2028</p>
              </div>
              <div className="bg-white rounded-2xl border border-slate-200 p-6 text-center hover:shadow-lg transition-all duration-300">
                <div className="w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center mx-auto mb-3"><Activity className="w-6 h-6 text-blue-600" /></div>
                <p className="text-3xl font-extrabold text-slate-900 mb-1">16.4%</p>
                <p className="text-xs text-slate-500">Annual Growth Rate</p>
              </div>
              <div className="bg-white rounded-2xl border border-slate-200 p-6 text-center hover:shadow-lg transition-all duration-300">
                <div className="w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center mx-auto mb-3"><Building2 className="w-6 h-6 text-blue-600" /></div>
                <p className="text-3xl font-extrabold text-slate-900 mb-1">2,000+</p>
                <p className="text-xs text-slate-500">Apps Secured</p>
              </div>
              <div className="bg-white rounded-2xl border border-slate-200 p-6 text-center hover:shadow-lg transition-all duration-300">
                <div className="w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center mx-auto mb-3"><Users className="w-6 h-6 text-blue-600" /></div>
                <p className="text-3xl font-extrabold text-slate-900 mb-1">99.9%</p>
                <p className="text-xs text-slate-500">Uptime Protected</p>
              </div>
            </div>
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 8 · Client Results ────────────────── */}
      <ScrollReveal delay={100}>
      <section className="py-12 lg:py-16 bg-gradient-to-b from-white to-slate-50">
        <div className="max-w-7xl mx-auto px-6 lg:px-8">
          <div className="text-center mb-16">
            <p className="text-xs font-bold text-blue-600 uppercase tracking-wider mb-3">Client Success</p>
            <h2 className="text-3xl lg:text-4xl font-extrabold mb-4">Real Results from Our AppSec</h2>
          </div>
          <div className="grid md:grid-cols-3 gap-6">
            {[
              { company: 'EComm Platform', industry: 'E-Commerce', result: 'Eliminated all OWASP Top 10 vulnerabilities in 30 days', metric: 'Zero OWASP Findings', roi: '$3.2M saved', detail: 'Comprehensive security assessment and remediation removed all OWASP Top 10 vulnerabilities. WAF deployment blocked 500K+ attack attempts in the first month.' },
              { company: 'FinTech API', industry: 'Fintech', result: 'Secured payment API processing $1M+/day', metric: '$1M+/Day Protected', roi: '$1.8M fraud prevented', detail: 'API security testing and WAF deployment protected payment endpoints from injection, fraud, and abuse. Real-time monitoring reduced false positives by 92%.' },
              { company: 'HealthSaaS', industry: 'Healthcare', result: 'Achieved HIPAA compliance with secure SDLC', metric: '100% Compliance', roi: '$600K audit savings', detail: 'DevSecOps integration embedded security into every sprint. Automated SAST/DAST scanning caught 340+ vulnerabilities pre-production with zero production incidents.' },
            ].map((story, i) => (
              <div key={i} className="bg-white rounded-2xl border border-slate-200 p-8 hover:shadow-xl transition-all duration-300">
                <div className="flex items-center justify-between mb-4">
                  <h3 className="font-bold text-lg">{story.company}</h3>
                  <span className="text-[10px] font-bold text-blue-600 bg-blue-50 px-2.5 py-1 rounded-full">{story.industry}</span>
                </div>
                <p className="text-sm font-semibold text-blue-600 mb-2">{story.result}</p>
                <p className="text-sm text-slate-500 mb-4 leading-relaxed">{story.detail}</p>
                <div className="flex items-center justify-between pt-4 border-t border-slate-100">
                  <p className="text-sm font-extrabold text-blue-600">{story.metric}</p>
                  <span className="text-xs font-bold text-green-600 bg-green-50 px-2.5 py-1 rounded-full">{story.roi}</span>
                </div>
              </div>
            ))}
          </div>
        </div>
      </section>
      </ScrollReveal>

      {/* ─── SECTION 9 · CTA ───────────────────────────── */}
      <ScrollReveal>
      <section className="py-12 lg:py-16 bg-gradient-to-br from-slate-950 via-blue-950 to-blue-900">
        <div className="max-w-4xl mx-auto px-6 lg:px-8 text-center">
          <div className="inline-flex items-center gap-2 bg-blue-500/10 border border-blue-500/20 rounded-full px-4 py-1.5 mb-6">
            <ShieldAlert className="w-3.5 h-3.5 text-blue-400" />
            <span className="text-xs font-semibold text-blue-300 uppercase tracking-wider">AppSec Experts</span>
          </div>
          <h2 className="text-3xl lg:text-5xl font-extrabold text-white mb-6">
            Secure Your Applications Before Attackers Do
          </h2>
          <p className="text-lg text-slate-300 mb-10 max-w-2xl mx-auto">
            Get a free web application security assessment — including OWASP Top 10 scan and architecture review.
          </p>
          <div className="flex flex-wrap justify-center gap-4">
            <Link href="/contact" className="inline-flex items-center gap-2 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-400 hover:to-blue-500 text-white font-bold px-8 py-4 rounded-xl shadow-lg shadow-blue-500/25 hover:shadow-blue-400/40 transition-all duration-300 hover:scale-105">
              Free App Security Assessment <ArrowRight className="w-4 h-4" />
            </Link>
            <Link href="/contact" className="inline-flex items-center gap-2 border border-white/20 hover:border-blue-400/40 text-white/80 hover:text-white font-semibold px-8 py-4 rounded-xl transition-all duration-300">
              Talk to an AppSec Engineer
            </Link>
          </div>
          <p className="text-xs text-slate-400 mt-8">No commitment · Assessment in 5 days · NDA available</p>
        </div>
      </section>
      </ScrollReveal>

      <Footer />
    </main>
  )
}
