import { useAuth } from '@/contexts/AuthContext';
import { Clock, Mail } from 'lucide-react';

export function PendingApproval() {
  const { user, logout } = useAuth();

  return (
    <div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 via-background to-primary/10">
      <div className="max-w-md w-full bg-card border border-border rounded-lg shadow-xl p-8">
        <div className="text-center">
          <div className="inline-block p-3 bg-yellow-500/10 dark:bg-yellow-500/20 rounded-full mb-4">
            <Clock className="h-12 w-12 text-yellow-600 dark:text-yellow-500" />
          </div>

          <h1 className="text-3xl font-bold text-foreground mb-2">
            Account Pending Approval
          </h1>

          <p className="text-muted-foreground mb-6">
            Your account is awaiting administrator approval. You will be able to access the system once your account has been approved.
          </p>

          {user?.email && (
            <div className="bg-muted/30 rounded-lg p-4 mb-6">
              <div className="flex items-center justify-center text-sm text-foreground">
                <Mail className="h-4 w-4 mr-2" />
                <span>{user.email}</span>
              </div>
            </div>
          )}

          <div className="text-sm text-muted-foreground mb-6">
            <p>Please contact your administrator if you have any questions.</p>
            <p className="mt-2">
              <strong>Note:</strong> The first user is automatically approved as Administrator.
            </p>
          </div>

          <button
            onClick={() => logout()}
            className="w-full bg-secondary text-secondary-foreground py-3 px-4 rounded-lg font-medium hover:bg-secondary/80 transition-colors"
          >
            Sign Out
          </button>
        </div>
      </div>
    </div>
  );
}
