'use client'; import { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { useAuthStore } from '@/lib/auth-store'; import { useTheme } from '@/lib/theme-store'; import { Eye, EyeOff, Sun, Moon, ArrowRight, Loader2, TicketCheck, Users, TrendingUp, ShieldCheck, } from 'lucide-react'; const EDR_GREEN = 'rgb(20, 113, 76)'; const features = [ { icon: TicketCheck, label: 'Booking Management', desc: 'Full lifecycle booking operations' }, { icon: Users, label: 'Passenger Services', desc: 'Profiles, loyalty & wallet' }, { icon: TrendingUp, label: 'Revenue Analytics', desc: 'Real-time reports & insights' }, { icon: ShieldCheck, label: 'Fraud Detection', desc: 'Automated risk monitoring' }, ]; export default function LoginPage() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const [showPassword, setShowPassword] = useState(false); const [isMounted, setIsMounted] = useState(false); const [emailFocused, setEmailFocused] = useState(false); const [passwordFocused, setPasswordFocused] = useState(false); const router = useRouter(); const { login } = useAuthStore(); const { isDark, toggleTheme } = useTheme(); useEffect(() => { setIsMounted(true); }, []); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { await login(email, password); router.push('/dashboard'); } catch (err: any) { setError(err.response?.data?.message || err.message || 'Invalid credentials. Please try again.'); } finally { setLoading(false); } }; if (!isMounted) return null; return (
{/* ── LEFT PANEL — form ── */}
{/* Top bar */}
{/* Logo — always visible on the form panel */}
ETHIO-DJIBOUTI
Railway
{/* Form area */}
{/* Heading */}

Sign in to continue

Enter your credentials to access the back-office.

{/* Error */} {error && (
!

{error}

)}
{/* Email field */}
{ setEmail(e.target.value); setError(''); }} onFocus={() => setEmailFocused(true)} onBlur={() => setEmailFocused(false)} className="w-full px-4 py-3 rounded-xl bg-white dark:bg-gray-900 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-600 text-sm focus:outline-none" placeholder="name@edr.com" required autoComplete="email" />
{/* Password field */}
{ setPassword(e.target.value); setError(''); }} onFocus={() => setPasswordFocused(true)} onBlur={() => setPasswordFocused(false)} className="w-full px-4 py-3 pr-11 rounded-xl bg-white dark:bg-gray-900 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-600 text-sm focus:outline-none" placeholder="••••••••••" required autoComplete="current-password" />
{/* Submit */}
{/* Divider */}

Access is restricted to authorised EDR staff only. All sessions are logged and audited.

{/* Bottom bar */}
Back-office · v1.0 Need help? support@edr.com
{/* ── RIGHT PANEL — photo ── */}
{/* Layer 1 — base photo, desaturated */}
{/* Layer 2 — brand green color wash */}
{/* Content */}
{/* Badge */}
Back-office Portal v1.0
{/* Hero text */}

Passenger
Management
System

Unified platform for booking operations, passenger services, revenue analytics, and real-time train management.

{/* Feature grid */}
{features.map(({ icon: Icon, label, desc }) => (
{label}
{desc}
))}
{/* Bottom rule */}
© 2026 Ethio-Djibouti Railway S.C. — Secure · Encrypted · Monitored
); }