import { useState, useEffect } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { motion, AnimatePresence } from "framer-motion"; import { Mail, Lock, Sun, Moon, Eye, EyeOff, CheckCircle } from "lucide-react"; export default function AuthPanel() { const [mode, setMode] = useState("login"); // login | register | reset const [theme, setTheme] = useState("dark"); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [loading, setLoading] = useState(false); const [success, setSuccess] = useState(false); const [error, setError] = useState(""); useEffect(() => { document.documentElement.classList.toggle("dark", theme === "dark"); }, [theme]); const passwordStrength = () => { let score = 0; if (password.length >= 8) score++; if (/[A-Z]/.test(password)) score++; if (/[0-9]/.test(password)) score++; if (/[^A-Za-z0-9]/.test(password)) score++; return score; }; const strengthColors = ["bg-red-500", "bg-orange-500", "bg-yellow-500", "bg-green-500"]; const handleSubmit = async (e) => { e.preventDefault(); setError(""); if (!email.includes("@")) { setError("Niepoprawny email"); return; } if (mode !== "reset" && passwordStrength() < 2) { setError("Hasło jest zbyt słabe"); return; } setLoading(true); setTimeout(() => { setLoading(false); setSuccess(true); }, 1500); }; return (