new page

import React, { useState } from 'react';
import { Card, CardContent } from '@/components/ui/card';
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from '@/components/ui/carousel';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';

// Resource Stats Section
const ResourceStats = () => {
  const stats = [
    { icon: '🔷', value: '10/200', label: '芯片/元素', color: 'from-blue-500 to-blue-600' },
    { icon: '📊', value: '10000', label: '热负荷', color: 'from-orange-500 to-orange-600' },
    { icon: '📋', value: '2000', label: '基础用例', color: 'from-green-500 to-green-600' },
    { icon: '💾', value: '300', label: 'DTS问题单', color: 'from-purple-500 to-purple-600' }
  ];

  return (
    <div className="bg-gradient-to-b from-white to-gray-50/50 border-b border-gray-100">
      <div className="max-w-[1200px] mx-auto px-8 py-12">
        <div className="grid grid-cols-4 gap-8">
          {stats.map((stat, index) => (
            <Card key={index} className="hover:shadow-lg transition-all duration-300 border-gray-100 bg-white hover:border-gray-200 group">
              <CardContent className="p-8 flex items-center gap-5">
                <div className="text-5xl flex-shrink-0 group-hover:scale-110 transition-transform duration-300">{stat.icon}</div>
                <div className="flex-1">
                  <div className="text-3xl font-bold text-gray-900 mb-1">{stat.value}</div>
                  <div className="text-sm text-gray-500 font-medium">{stat.label}</div>
                </div>
              </CardContent>
            </Card>
          ))}
        </div>
      </div>
    </div>
  );
};

// Projects Carousel Section
const ProjectsCarousel = () => {
  const [currentIndex, setCurrentIndex] = useState(0);
  
  const projects = [
    { 
      year: '2025', 
      subtitle: '芯片系统上市 已形成文档',
      image: '🎨',
      title: '已发布Changsha、Xian、Atherton',
      description: '2025年度重要发布',
      gradient: 'from-blue-50 via-cyan-50 to-blue-50'
    },
    { 
      year: '2024', 
      subtitle: '系统验证 CFRO架构',
      image: '🎯',
      title: '已发布HBtv、CFRO',
      description: '2024年度核心项目',
      gradient: 'from-purple-50 via-pink-50 to-purple-50'
    },
    { 
      year: '2023', 
      subtitle: '云端测试 测试框架',
      image: '☁️',
      title: '已发布C2T',
      description: '2023年度突破性进展',
      gradient: 'from-green-50 via-emerald-50 to-green-50'
    },
    { 
      year: '2022', 
      subtitle: '平台建设 基础架构',
      image: '🏗️',
      title: '已发布基础平台',
      description: '2022年度平台搭建',
      gradient: 'from-orange-50 via-amber-50 to-orange-50'
    },
    { 
      year: '2021', 
      subtitle: '初期探索 技术验证',
      image: '🔬',
      title: '已发布初版系统',
      description: '2021年度技术探索',
      gradient: 'from-red-50 via-rose-50 to-red-50'
    }
  ];

  const handlePrevious = () => {
    setCurrentIndex((prev) => Math.max(0, prev - 1));
  };

  const handleNext = () => {
    setCurrentIndex((prev) => Math.min(projects.length - 3, prev + 1));
  };

  const visibleProjects = projects.slice(currentIndex, currentIndex + 3);

  return (
    <div className="bg-white py-20 border-b border-gray-100">
      <div className="max-w-[1200px] mx-auto px-8">
        <div className="relative">
          {/* Previous Button */}
          <button
            onClick={handlePrevious}
            disabled={currentIndex === 0}
            className="absolute left-0 top-1/2 -translate-y-1/2 -translate-x-16 z-10 w-12 h-12 rounded-full bg-white shadow-lg border border-gray-200 hover:bg-gray-50 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-300 hover:shadow-xl hover:scale-110 flex items-center justify-center"
          >
            <svg className="w-6 h-6 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
            </svg>
          </button>

          {/* Grid of 3 items */}
          <div className="grid grid-cols-3 gap-8">
            {visibleProjects.map((project, index) => (
              <Card key={currentIndex + index} className="hover:shadow-xl transition-all duration-300 hover:-translate-y-2 border-gray-200 bg-white group">
                <CardContent className="p-0">
                  <div className="p-8 pb-6 text-center">
                    <div className="text-5xl font-bold bg-gradient-to-r from-gray-900 to-gray-700 bg-clip-text text-transparent mb-2">
                      {project.year}
                    </div>
                    <div className="text-sm text-gray-500">{project.subtitle}</div>
                  </div>
                  
                  <div className={`bg-gradient-to-br ${project.gradient} h-56 flex items-center justify-center text-7xl mx-8 mb-6 rounded-xl shadow-inner group-hover:shadow-lg transition-all duration-300`}>
                    <span className="group-hover:scale-110 transition-transform duration-300">{project.image}</span>
                  </div>
                  
                  <div className="px-8 pb-8 text-center">
                    <div className="text-lg font-semibold text-gray-900 mb-2">{project.title}</div>
                    <div className="text-sm text-gray-500">{project.description}</div>
                  </div>
                </CardContent>
              </Card>
            ))}
          </div>

          {/* Next Button */}
          <button
            onClick={handleNext}
            disabled={currentIndex >= projects.length - 3}
            className="absolute right-0 top-1/2 -translate-y-1/2 translate-x-16 z-10 w-12 h-12 rounded-full bg-white shadow-lg border border-gray-200 hover:bg-gray-50 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-300 hover:shadow-xl hover:scale-110 flex items-center justify-center"
          >
            <svg className="w-6 h-6 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
            </svg>
          </button>
        </div>
      </div>
    </div>
  );
};

// Digital Lab Section
const DigitalLab = () => {
  const [activeTab, setActiveTab] = useState('device');

  const labStats = [
    { icon: '⛔', value: '20', label: '单元', color: 'text-red-500' },
    { icon: '🔵', value: '1000', label: '数量', color: 'text-blue-500' },
    { icon: '🏢', value: '619', label: '工作站', color: 'text-green-500' },
    { icon: '🟣', value: '80%', label: '覆盖率', color: 'text-purple-500' }
  ];

  const tabData = {
    device: [
      { label: '在线设备', value: '400台', icon: '💻' },
      { label: '离线设备', value: '100台', icon: '💻' },
      { label: 'CPU利用率', value: '78%', icon: '💻' },
      { label: '运维模式', value: '24/7', icon: '💻' }
    ],
    test: [
      { label: '累计测试', value: '100台', icon: '🧪' },
      { label: '测试中', value: '50台', icon: '🧪' },
      { label: '成功率', value: '95%', icon: '🧪' },
      { label: '测试时长', value: '24h', icon: '🧪' }
    ],
    system: [
      { label: '系统数量', value: '200个', icon: '⚙️' },
      { label: '运行中', value: '180个', icon: '⚙️' },
      { label: '维护中', value: '20个', icon: '⚙️' },
      { label: '可用率', value: '90%', icon: '⚙️' }
    ]
  };

  return (
    <div className="bg-gradient-to-b from-gray-50 via-blue-50/30 to-white py-20 border-b border-gray-100">
      <div className="max-w-[1200px] mx-auto px-8">
        <h2 className="text-4xl font-bold text-gray-900 mb-12 text-center tracking-tight">数字化实验室</h2>
        
        <div className="grid grid-cols-4 gap-8 mb-12">
          {labStats.map((stat, index) => (
            <Card key={index} className="hover:shadow-lg transition-all duration-300 bg-white border-gray-100 hover:border-gray-200 group">
              <CardContent className="p-8 text-center">
                <div className={`text-6xl mb-5 group-hover:scale-110 transition-transform duration-300 ${stat.color}`}>
                  {stat.icon}
                </div>
                <div className="text-4xl font-bold text-gray-900 mb-2">{stat.value}</div>
                <div className="text-sm text-gray-500 font-medium">{stat.label}</div>
              </CardContent>
            </Card>
          ))}
        </div>

        <div className="flex justify-center mb-8">
          <Tabs value={activeTab} onValueChange={setActiveTab} className="w-auto">
            <TabsList className="bg-white shadow-md border border-gray-200 p-1.5 rounded-lg">
              <TabsTrigger 
                value="device" 
                className="px-10 py-3.5 rounded-md font-medium transition-all data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-cyan-500 data-[state=active]:text-white data-[state=active]:shadow-md"
              >
                在线设备
              </TabsTrigger>
              <TabsTrigger 
                value="test" 
                className="px-10 py-3.5 rounded-md font-medium transition-all data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-cyan-500 data-[state=active]:text-white data-[state=active]:shadow-md"
              >
                累计测试
              </TabsTrigger>
              <TabsTrigger 
                value="system" 
                className="px-10 py-3.5 rounded-md font-medium transition-all data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-cyan-500 data-[state=active]:text-white data-[state=active]:shadow-md"
              >
                系统运维
              </TabsTrigger>
            </TabsList>
          </Tabs>
        </div>

        <Card className="bg-white border-gray-100 shadow-md">
          <CardContent className="p-12">
            <div className="grid grid-cols-4 gap-12 text-center">
              {tabData[activeTab].map((stat, index) => (
                <div key={index} className="space-y-4 group cursor-pointer">
                  <div className="text-5xl group-hover:scale-110 transition-transform duration-300">{stat.icon}</div>
                  <div className="text-sm text-gray-500 font-medium">{stat.label}</div>
                  <div className="text-3xl font-bold bg-gradient-to-r from-blue-600 to-cyan-600 bg-clip-text text-transparent">
                    {stat.value}
                  </div>
                </div>
              ))}
            </div>
          </CardContent>
        </Card>
      </div>
    </div>
  );
};

// Development Timeline Section
const DevelopmentTimeline = () => {
  const milestones = [
    { year: '2008', items: ['黑盒测试', '系统功能验证'], yPosition: 250 },
    { year: '2016', items: ['自动化测试工厂', '测试赋能'], yPosition: 150 },
    { year: '2018', items: ['测试能力量化', 'C2C测试'], yPosition: 100 },
    { year: '2020', items: ['覆盖测试', '失效测试', '虚拟自动化'], yPosition: 60 },
    { year: '2025', items: ['AI测试应用', '更快化验证', '测试工具链'], yPosition: 30 }
  ];

  return (
    <div className="bg-gradient-to-b from-white via-purple-50/20 to-white py-24 border-b border-gray-100">
      <div className="max-w-[1200px] mx-auto px-8">
        <h2 className="text-4xl font-bold text-gray-900 mb-20 text-center tracking-tight">发展路标</h2>
        
        <div className="relative" style={{ height: '380px' }}>
          {/* SVG Path Line - 向上的平滑曲线 */}
          <svg className="absolute inset-0 w-full h-full" style={{ zIndex: 0 }}>
            <defs>
              <linearGradient id="lineGradient" x1="0%" y1="100%" x2="100%" y2="0%">
                <stop offset="0%" stopColor="#06b6d4" stopOpacity="0.7" />
                <stop offset="25%" stopColor="#3b82f6" stopOpacity="0.85" />
                <stop offset="50%" stopColor="#6366f1" stopOpacity="0.9" />
                <stop offset="75%" stopColor="#8b5cf6" stopOpacity="0.85" />
                <stop offset="100%" stopColor="#a855f7" stopOpacity="0.7" />
              </linearGradient>
              <filter id="glow">
                <feGaussianBlur stdDeviation="2.5" result="coloredBlur"/>
                <feMerge>
                  <feMergeNode in="coloredBlur"/>
                  <feMergeNode in="SourceGraphic"/>
                </feMerge>
              </filter>
            </defs>
            {/* 持续向上的平滑贝塞尔曲线 - 从下到上 */}
            <path
              d="M 60 280 Q 150 240 240 180 T 420 120 T 600 80 T 780 50 T 960 40"
              stroke="url(#lineGradient)"
              strokeWidth="4"
              fill="none"
              filter="url(#glow)"
              strokeLinecap="round"
            />
          </svg>

          {/* Milestones */}
          <div className="relative flex justify-between items-start h-full" style={{ zIndex: 1 }}>
            {milestones.map((milestone, index) => (
              <div 
                key={index} 
                className="flex flex-col items-center w-1/5"
                style={{ 
                  marginTop: `${milestone.yPosition}px`
                }}
              >
                {/* Content above */}
                <div className="text-center mb-6 space-y-1.5">
                  {milestone.items.map((item, idx) => (
                    <div key={idx} className="text-sm text-gray-600 font-medium">
                      • {item}
                    </div>
                  ))}
                </div>
                
                {/* Year with gradient background */}
                <div className="relative mb-6">
                  <div className="absolute inset-0 bg-gradient-to-r from-blue-500 to-purple-500 rounded-lg blur-sm opacity-30"></div>
                  <div className="relative text-3xl font-bold text-gray-900 tracking-tight px-4 py-1">
                    {milestone.year}
                  </div>
                </div>
                
                {/* Node with enhanced pulse effect */}
                <div className="relative">
                  <div className="w-6 h-6 bg-gradient-to-br from-cyan-400 via-blue-500 to-purple-500 rounded-full shadow-xl shadow-blue-500/50 relative z-10 ring-4 ring-white">
                  </div>
                  <div className="absolute inset-0 w-6 h-6 bg-cyan-400 rounded-full animate-ping opacity-40"></div>
                  <div className="absolute inset-1 w-4 h-4 left-1 top-1 bg-white rounded-full opacity-40"></div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </div>
  );
};

// Footer Section
const Footer = () => {
  const footerSections = [
    { title: '帮助文档', links: ['平台介绍', '新手指南'] },
    { title: '服务与认证', links: ['服务认证'] },
    { title: '外部站点', links: ['CIDA', 'DBCX', 'HiAPM', 'HiDesk', 'DTS', 'HiALM'] }
  ];

  return (
    <footer className="bg-gradient-to-b from-gray-50 to-gray-100">
      <div className="max-w-[1200px] mx-auto px-8 py-16">
        <div className="grid grid-cols-4 gap-12 mb-12">
          {/* Kirin Logo Section */}
          <div>
            <div className="flex items-center gap-3 mb-2">
              <div className="w-10 h-10 bg-gradient-to-br from-red-500 via-pink-500 to-red-600 rounded-lg shadow-lg"></div>
              <span className="text-xl font-bold text-gray-900">Kirin</span>
            </div>
            <div className="text-sm text-gray-600 ml-13 font-medium">先进测试中心</div>
          </div>

          {/* Footer Links */}
          {footerSections.map((section, index) => (
            <div key={index}>
              <h3 className="font-semibold mb-4 text-gray-900 text-base">{section.title}</h3>
              <ul className="space-y-2.5">
                {section.links.map((link, idx) => (
                  <li key={idx}>
                    <a href="#" className="text-gray-600 hover:text-blue-600 transition-colors text-sm hover:underline">
                      {link}
                    </a>
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>

        <div className="border-t border-gray-300 pt-8 text-center text-sm text-gray-500">
          Copyright © Huawei Technologies Co., Ltd. 2025. All rights reserved.
        </div>
      </div>
    </footer>
  );
};

// Main Page Component
export default function Page() {
  return (
    <div className="min-h-screen bg-white">
      <ResourceStats />
      <ProjectsCarousel />
      <DigitalLab />
      <DevelopmentTimeline />
      <Footer />
    </div>
  );
}