<?php

session_start();

if (isset($_SESSION['super_admin_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>
        Super Admin Login
    </title>

    <!-- Bootstrap -->

    <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
    >

    <!-- Font Awesome -->

    <link
        rel="stylesheet"
        href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
    >

    <style>

        body {

            background: #f4f6f9;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .login-box {

            width: 400px;
        }

        .card {

            border: 0;
            border-radius: 10px;
            box-shadow: 0 0 25px rgba(0,0,0,0.08);
        }

        .card-header {

            background: #343a40;
            color: #fff;
            text-align: center;
            font-size: 24px;
            font-weight: 600;
            padding: 20px;
        }

        .btn-dark {

            padding: 10px;
            font-weight: 600;
        }

    </style>

</head>

<body>

    <div class="login-box">

        <div class="card">

            <div class="card-header">

                Super Admin Login

            </div>

            <div class="card-body">

                <?php if (isset($_SESSION['error'])): ?>

                    <div class="alert alert-danger">

                        <?= htmlspecialchars($_SESSION['error']); ?>

                    </div>

                    <?php unset($_SESSION['error']); ?>

                <?php endif; ?>

                <form action="process_login.php" method="POST">

                    <div class="form-group">

                        <label>
                            Email
                        </label>

                        <input
                            type="email"
                            name="email"
                            class="form-control"
                            required
                            autocomplete="off"
                        >

                    </div>

                    <div class="form-group">

                        <label>
                            Password
                        </label>

                        <input
                            type="password"
                            name="password"
                            class="form-control"
                            required
                        >

                    </div>

                    <button
                        type="submit"
                        class="btn btn-dark btn-block"
                    >

                        <i class="fas fa-sign-in-alt"></i>

                        Login

                    </button>

                </form>

            </div>

        </div>

    </div>

</body>

</html>