import { useState } from 'react';
import { 
  ClipboardCheck, 
  Clock, 
  AlertTriangle, 
  Activity, 
  CheckSquare, 
  Plus 
} from "lucide-react";
import Button from "@/components/common/button";
import StatCard from "@/components/common/dashStatCard";
import InfoBanner from '@/components/common/infoBanner';
import Table from '@/components/common/dataTable';
import { auditheaders, auditrows } from '@/constants/tabledata';




export default function AuditSurveyPortal() {
  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">AUDIT & SURVEY</span>
          </div>
          <h1 className="text-2xl font-bold text-white tracking-tight mt-2">
            Audit & survey management
          </h1>
          <p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
            Mobile-based paperless audits and surveys with real-time scoring, findings tracking and a corrective-action workflow.
          </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">
            <CheckSquare className="w-4 h-4 text-slate-300" />
            <span>New survey</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>Start audit</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: Audits closed (Emerald/Green Icon) */}
        <StatCard
          variant="icon"
          title="Audits closed"
          value="4"
          icon={ClipboardCheck}
          badgeText="this quarter"
          badgeClassName="text-emerald-400 lowercase font-mono"
          iconContainerClassName="bg-emerald-950/40 border-emerald-800/30 text-emerald-400"
        />

        {/* Card 2: In progress (Amber/Yellow Icon) */}
        <StatCard
          variant="icon"
          title="In progress"
          value="5"
          icon={Clock}
          badgeText="open"
          badgeClassName="text-amber-400 lowercase font-mono"
          iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-400"
        />

        {/* Card 3: Total findings (Rose/Red Icon) */}
        <StatCard
          variant="icon"
          title="Total findings"
          value="29"
          icon={AlertTriangle}
          badgeText="to action"
          badgeClassName="text-rose-400 lowercase font-mono"
          iconContainerClassName="bg-rose-950/40 border-rose-800/30 text-rose-400"
        />

        {/* Card 4: Avg audit score (Blue Icon) */}
        <StatCard
          variant="icon"
          title="Avg audit score"
          value="86%"
          icon={Activity}
          badgeText="portfolio"
          badgeClassName="text-slate-400 lowercase font-mono"
          iconContainerClassName="bg-blue-950/50 border-blue-800/30 text-blue-400"
        />
      </div>
            <Table headers={auditheaders} rows={auditrows}/>
<div className="mt-5">
      <InfoBanner 
        boldText='Paperless:' 
        normalText='auditors capture findings on mobile (photo + geo-tag), scores compute in real time, and each finding spawns a tracked corrective action with an owner and due date.' 
      />

</div>
    
    </div>
  );
}