<?php
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
$error = $_SESSION['error'] ?? null;
unset($_SESSION['error']);
$old_email = $_SESSION['old']['email'] ?? '';
unset($_SESSION['old']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login — Employee System</title>
<style>
    body {
        margin: 0;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: Poppins, sans-serif;
        background: linear-gradient(135deg, #ffe6e6, #e0f7fa, #fff3e0);
        background-size: 300% 300%;
        animation: gradientShift 10s ease infinite;
    }
    @keyframes gradientShift {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }
    .login-box {
        width: 380px;
        background: rgba(255,255,255,0.85);
        padding: 35px;
        border-radius: 15px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        backdrop-filter: blur(10px);
        animation: fadeIn .6s ease-out;
    }
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    h2 { text-align: center; color: #333; margin-bottom: 25px; }
    input {
        width: 100%; padding: 12px; margin-bottom: 14px; border-radius: 8px;
        font-size: 14px; border: 1px solid #ccc; background: #fff;
    }
    .btn {
        width: 100%; padding: 12px; margin-top: 10px; border: none; font-size: 15px;
        cursor: pointer; border-radius: 8px; background: linear-gradient(135deg, #ff9a9e, #fad0c4);
        color: #333; font-weight: bold; transition: .2s;
    }
    .btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
    .link { text-align: center; margin-top: 15px; font-size: 14px; }
    .link a { color: #ff758c; text-decoration: none; font-weight: bold; }

    /* small message box, unobtrusive */
    .msg { margin-bottom: 12px; padding:10px 12px; border-radius:8px; background:#ffecec; color:#8a1f1f; font-weight:600; }

</style>
</head>
<body>

<div class="login-box">
    <h2>Welcome Back</h2>

    <?php if (!empty($error)): ?>
        <div class="msg"><?php echo htmlspecialchars($error); ?></div>
    <?php endif; ?>

    <form action="/login/auth" method="post">
        <input type="email" name="email" placeholder="Email" value="<?php echo htmlspecialchars($old_email); ?>" required>
        <input type="password" name="password" placeholder="Password" required>

        <button class="btn" type="submit">Login</button>
    </form>

    <div class="link">
        Don't have an account? <a href="/signup">Sign up</a>
    </div>
</div>

</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login — Employee System</title>
<style>

    body {
        margin: 0;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: Poppins, sans-serif;
        background: linear-gradient(135deg, #ffe6e6, #e0f7fa, #fff3e0);
        background-size: 300% 300%;
        animation: gradientShift 10s ease infinite;
    }

    @keyframes gradientShift {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }

    .login-box {
        width: 380px;
        background: rgba(255,255,255,0.85);
        padding: 35px;
        border-radius: 15px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        backdrop-filter: blur(10px);
        animation: fadeIn .6s ease-out;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }

    h2 {
        text-align: center;
        color: #333;
        margin-bottom: 25px;
    }

    input {
        width: 100%;
        padding: 12px;
        margin-bottom: 14px;
        border-radius: 8px;
        font-size: 14px;
        border: 1px solid #ccc;
        background: #fff;
    }

    .btn {
        width: 100%;
        padding: 12px;
        margin-top: 10px;
        border: none;
        font-size: 15px;
        cursor: pointer;
        border-radius: 8px;
        background: linear-gradient(135deg, #ff9a9e, #fad0c4);
        color: #333;
        font-weight: bold;
        transition: .2s;
    }

    .btn:hover {
        transform: translateY(-2px);
        filter: brightness(1.05);
    }

    .link {
        text-align: center;
        margin-top: 15px;
        font-size: 14px;
    }

    .link a {
        color: #ff758c;
        text-decoration: none;
        font-weight: bold;
    }

</style>
</head>
<body>

<div class="login-box">
    <h2>Welcome Back</h2>

    <form>
        <input type="email" placeholder="Email">
        <input type="password" placeholder="Password">

        <button class="btn">Login</button>
    </form>

    <div class="link">
        Don't have an account? <a href="signup.html">Sign up</a>
    </div>
</div>

</body>
</html>
