<?php
session_start();
if (isset($_SESSION['student_id'])) {
    header("Location: dashboard.php");
    exit();
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Graduation Seating Login</title>
    <link rel="stylesheet" href="styles.css">
</head>

<body>
    <div class="container">
        <div class="header">
            <img src="MUBAS Logo.png" alt="MUBAS Logo" class="app-logo">
            <h1>Welcome Graduand</h1>
            <p>Enter your Registration Number to view seating</p>
        </div>

        <?php if (isset($_GET['error'])): ?>
            <div class="error-message">
                <?= htmlspecialchars($_GET['error']) ?>
            </div>
        <?php endif; ?>

        <form action="login.php" method="POST">
            <div class="form-group">
                <label for="student_id">Registration Number</label>
                <input type="text" id="student_id" name="student_id" class="form-control" placeholder="e.g. XXX/XX/XX/001"
                    required autofocus autocomplete="off">
            </div>
            <button type="submit" class="btn">View Allocation</button>
        </form>

        <div class="footer">
            Powered by <a href="https://unipod.ac.mw" target="_blank" rel="noopener noreferrer"><strong>unipod</strong></a>
        </div>
    </div>
</body>

</html>