
import React from 'react';
import { MOCK_EMPLOYEES } from '../../constants';
import { ShieldCheck, AlertTriangle, CheckCircle2, ClipboardList, HardHat, Zap, Clock } from 'lucide-react';

export const SafetyBriefing: React.FC = () => {
    return (
        <div className="space-y-6 animate-fade-in">
            {/* Status Grid */}
            <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
                <div className="bg-white p-6 rounded-[2rem] border border-slate-200 shadow-sm flex items-center gap-5">
                    <div className="w-16 h-16 rounded-3xl bg-emerald-50 flex items-center justify-center text-emerald-600">
                        <ShieldCheck className="w-8 h-8"/>
                    </div>
                    <div>
                        <h4 className="text-2xl font-black text-slate-800 leading-none">22</h4>
                        <p className="text-[10px] text-slate-400 font-bold uppercase mt-1.5 tracking-wider">Инструктаж пройден</p>
                    </div>
                </div>
                <div className="bg-white p-6 rounded-[2rem] border border-red-100 shadow-sm flex items-center gap-5 relative overflow-hidden">
                    <div className="absolute right-0 top-0 p-4 opacity-5"><AlertTriangle className="w-20 h-20 text-red-600"/></div>
                    <div className="w-16 h-16 rounded-3xl bg-red-50 flex items-center justify-center text-red-600">
                        <AlertTriangle className="w-8 h-8 animate-pulse"/>
                    </div>
                    <div>
                        <h4 className="text-2xl font-black text-red-600 leading-none">2</h4>
                        <p className="text-[10px] text-red-400 font-bold uppercase mt-1.5 tracking-wider">Просрочено</p>
                    </div>
                </div>
            </div>

            {/* Safety List */}
            <div className="space-y-4">
                <h3 className="font-black text-slate-500 text-[10px] uppercase tracking-[0.2em] px-1">Журнал по технике безопасности</h3>
                <div className="space-y-3">
                    {MOCK_EMPLOYEES.map(emp => {
                        const isOverdue = emp.id === 'e2' || emp.id === 'e5'; // Mock logic for demo
                        return (
                            <div key={emp.id} className={`bg-white p-4 rounded-2xl border transition-all ${isOverdue ? 'border-red-200 bg-red-50/5' : 'border-slate-100'}`}>
                                <div className="flex justify-between items-center mb-3">
                                    <div className="flex items-center gap-3">
                                        <div className={`p-2.5 rounded-xl ${isOverdue ? 'bg-red-100 text-red-600' : 'bg-slate-50 text-slate-400'}`}>
                                            <HardHat className="w-5 h-5"/>
                                        </div>
                                        <div>
                                            <p className="text-sm font-black text-slate-800 leading-tight">{emp.name}</p>
                                            <p className="text-[9px] text-slate-400 font-bold uppercase">{emp.position}</p>
                                        </div>
                                    </div>
                                    {isOverdue ? (
                                        <span className="text-[8px] font-black bg-red-500 text-white px-2 py-0.5 rounded-full uppercase animate-pulse">Пересдать!</span>
                                    ) : (
                                        <div className="flex items-center gap-1 text-[9px] font-black text-emerald-500 uppercase">
                                            <CheckCircle2 className="w-3 h-3"/> Норма
                                        </div>
                                    )}
                                </div>

                                <div className="grid grid-cols-2 gap-4 border-t border-slate-100 pt-3">
                                    <div className="flex items-center gap-2">
                                        <Zap className="w-3.5 h-3.5 text-amber-500"/>
                                        <span className="text-[9px] font-bold text-slate-500 uppercase">Эл. безоп.: 3 группа</span>
                                    </div>
                                    <div className="flex items-center gap-2 text-right justify-end">
                                        <Clock className="w-3.5 h-3.5 text-slate-300"/>
                                        <span className="text-[9px] font-bold text-slate-500 uppercase">До: 01.12.2024</span>
                                    </div>
                                </div>
                            </div>
                        )
                    })}
                </div>
            </div>
            
            <button className="w-full py-4 bg-slate-900 text-white rounded-2xl text-[10px] font-black uppercase tracking-[0.2em] shadow-xl active:scale-95 transition-all flex items-center justify-center gap-3">
                <ClipboardList className="w-5 h-5"/> Сформировать приказ об инструктаже
            </button>
        </div>
    );
};
