import { useState } from 'react';
import { 
  Zap, 
  AlertTriangle, 
  Activity, 
  Plus, 
  Sparkles,
  ShieldAlert,
  IndianRupee,
  Clock,
  ShieldCheck
} from "lucide-react";
import Button from "@/components/common/button";
import StatCard from "@/components/common/dashStatCard";
import InfoBanner from '@/components/common/infoBanner';
import {Card} from '@/components/common/cardWrapper'; // Assuming Card wrapper location
import { CardHeader } from '@/components/common/cardHeader'; // Assuming CardHeader location

export default function AssetHealthPortal() {
  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-[10px] font-bold tracking-widest uppercase font-mono">
          <span className="text-teal-400">Apple One — HQ Tower</span>
            <span className="text-slate-500">•</span>
            <span className="text-slate-500">INTELLIGENCE</span>
            <span className="text-slate-500">•</span>
            <span className="text-slate-500">ASSET HEALTH</span>
          </div>
         <h1 className="text-2xl font-bold text-white tracking-tight mt-2">
            Asset health & reliability
          </h1>
          <p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
            A live health index per asset from reliability signals — MTBF, MTTR and criticality drive condition-based PM instead of fixed calendars.
          </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">
            <Activity className="w-4 h-4 text-slate-300" />
            <span>Model insights</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>Raise PM</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: Predicted failures */}
      <StatCard
          variant="icon"
          title="Fleet health index"
          value="69"
          icon={ShieldCheck}
          badgeText="weighted"
          badgeClassName="text-amber-400 lowercase font-mono"
          iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-400"
        />

        <StatCard
          variant="icon"
          title="Assets at risk"
          value="1"
          icon={AlertTriangle}
          badgeText="health < 58"
          badgeClassName="text-rose-400 lowercase font-mono"
          iconContainerClassName="bg-rose-950/40 border-rose-800/30 text-rose-400"
        />

        <StatCard
          variant="icon"
          title="Mean time between failures"
          value="204d"
          icon={Clock}
          badgeText="avg"
          badgeClassName="text-blue-400 lowercase font-mono"
          iconContainerClassName="bg-blue-950/50 border-blue-800/30 text-blue-400"
        />

        <StatCard
          variant="icon"
          title="Mean time to repair"
          value="6.3h"
          icon={Activity}
          badgeText="avg"
          badgeClassName="text-emerald-400 lowercase font-mono"
          iconContainerClassName="bg-emerald-950/40 border-emerald-800/30 text-emerald-400"
        />
      </div>

     

      <div className="mt-5">
      <InfoBanner 
          boldText="How it works:" 
          normalText="reliability signals (runtime, faults, vibration, PPM history) roll into a 0–100 health index. Assets that drop below threshold auto-surface here and can raise a condition-based PM in one click — replacing fixed-calendar servicing on healthy assets."
        />
      </div>
    </div>
  );
}