import { useState } from 'react';
import { 
  
  AlertTriangle, 
 
  Plus, 
  GraduationCap,
  Star,
  Activity,
  LayoutGrid
} from "lucide-react";
import Button from "@/components/common/button";
import StatCard from "@/components/common/dashStatCard";
import Table from '@/components/common/dataTable';
import NavigationTabs from '@/components/common/tabs';
import { trainingtabs } from '@/constants/tabConstant';
import InfoBanner from '@/components/common/infoBanner';
import { trainingheaders, trainingrows } from '@/constants/tabledata';



export default function TrainingPortal() {
      const [activeTab, setActiveTab] = useState<string>('Courses');
  return (
    <div className="my-15 text-slate-100 font-sans">
      {/* --- HEADER SECTION --- */}
      <div className="flex flex-col md:flex-row md:items-start md:justify-between gap-4 mb-6">
        <div>
          <div className="flex items-center gap-2 text-[12px] font-bold tracking-widest uppercase font-mono">
            <span className="text-teal-400">Apple One — HQ Tower</span>
            <span className="text-slate-600">•</span>
            <span className="text-slate-400">COMPLIANCE</span>
            <span className="text-slate-600">•</span>
            <span className="text-slate-400">TRAINING</span>
          </div>
          <h1 className="text-2xl font-bold text-white tracking-tight mt-2">
            Training & onboarding
          </h1>
          <p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
            Onboarding checklists, course management, mandatory compliance training and certification tracking with expiry alerts.
          </p>
        </div>

        {/* --- HEADER BUTTONS --- */}
      <div className="flex items-center gap-3 self-start md:mt-10">
          <Button className="bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 text-xs px-4 py-2 rounded-lg flex items-center gap-2 font-semibold transition-colors">
            <LayoutGrid className="w-4 h-4 text-slate-300" />
            <span>LMS sync</span>
          </Button>

          <Button className="bg-[#2dd4bf] hover:bg-teal-300 text-slate-950 font-bold text-xs px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
            <Plus className="w-4 h-4 stroke-[3]" />
            <span>Assign course</span>
          </Button>
        </div>
      </div>
      

      {/* --- STAT CARDS --- */}
     <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
        {/* Card 1: Active courses */}
        <StatCard
          variant="icon"
          title="Active courses"
          value="6"
          icon={GraduationCap}
          badgeText="132 enrolments"
          badgeClassName="text-slate-400 lowercase font-mono"
          iconContainerClassName="bg-blue-950/60 border-blue-800/40 text-blue-400"
        />

        {/* Card 2: Completion rate */}
        <StatCard
          variant="icon"
          title="Completion rate"
          value="78%"
          icon={Activity}
          badgeText="overall"
          badgeClassName="text-teal-400 lowercase font-mono"
          iconContainerClassName="bg-teal-950/60 border-teal-800/40 text-teal-400"
        />

        {/* Card 3: Mandatory pending */}
        <StatCard
          variant="icon"
          title="Mandatory pending"
          value="2"
          icon={AlertTriangle}
          badgeText="chase up"
          badgeClassName="text-rose-400 lowercase font-mono"
          iconContainerClassName="bg-rose-950/50 border-rose-800/30 text-rose-400"
        />

        {/* Card 4: Certs expiring */}
        <StatCard
          variant="icon"
          title="Certs expiring"
          value="3"
          icon={Star}
          badgeText="≤ 60 days"
          badgeClassName="text-amber-400 lowercase font-mono"
          iconContainerClassName="bg-amber-950/50 border-amber-800/30 text-amber-400"
        />
      </div>
      <NavigationTabs
                tabs={trainingtabs}
                activeTab={activeTab}
                onTabChange={setActiveTab}
                className="mb-4"
              />
<Table headers={trainingheaders} rows={trainingrows}/>
<div className="mb-5 mt-5">
        <InfoBanner 
          boldText="Compliance:  " 
          normalText="mandatory safety courses (fire, height, LOTO) carry renewal cycles — the platform auto-reminds before certification lapses and blocks permit issuance for un-certified staff." 
        />
      </div>
    
    </div>
  );
}