<?php
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
$error = $_SESSION['error'] ?? null;
unset($_SESSION['error']);
$old = $_SESSION['old'] ?? [];
unset($_SESSION['old']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sign Up — 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, #fce4ec, #e1f5fe, #fff9c4);
        background-size: 300% 300%;
        animation: gradientMove 10s ease infinite;
    }
    @keyframes gradientMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
    .signup-box { width: 420px; 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: slideIn .6s ease-out; }
    @keyframes slideIn { from { opacity: 0; transform: translateY(30px); } 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, #a18cd1, #fbc2eb); color: white; 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: #ff6f61; text-decoration: none; font-weight: bold; }
    .msg { margin-bottom: 12px; padding:10px 12px; border-radius:8px; background:#ffecec; color:#8a1f1f; font-weight:600; }
</style>
</head>
<body>

<div class="signup-box">
    <h2>Create Account</h2>

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

    <form action="/signup/create" method="post">
        <input type="text" name="name" placeholder="Full name" value="<?php echo htmlspecialchars($old['name'] ?? ''); ?>" required>
        <input type="email" name="email" placeholder="Email" value="<?php echo htmlspecialchars($old['email'] ?? ''); ?>" required>
        <input type="password" name="password" placeholder="Password" required>
        <input type="password" name="confirm" placeholder="Confirm password" required>

        <button class="btn" type="submit">Sign Up</button>
    </form>

    <div class="link">
        Already have an account? <a href="/login">Login here</a>
    </div>
</div>

</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sign Up — 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, #fce4ec, #e1f5fe, #fff9c4);
        background-size: 300% 300%;
        animation: gradientMove 10s ease infinite;
    }

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

    .signup-box {
        width: 420px;
        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: slideIn .6s ease-out;
    }

    @keyframes slideIn {
        from { opacity: 0; transform: translateY(30px); }
        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, #a18cd1, #fbc2eb);
        color: white;
        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: #ff6f61;
        text-decoration: none;
        font-weight: bold;
    }

</style>
</head>
<body>

<div class="signup-box">
    <h2>Create Account</h2>

    <form>
        <input type="text" placeholder="Full name">
        <input type="email" placeholder="Email">
        <input type="password" placeholder="Password">
        <input type="password" placeholder="Confirm password">

        <button class="btn">Sign Up</button>
    </form>

    <div class="link">
        Already have an account? <a href="login.html">Login here</a>
    </div>
</div>

</body>
</html>
