<?php
session_start();

$error = "";

if(isset($_POST['login']))
{
    $username = "admin";
    $password = "123456";

    if($_POST['username'] === $username &&
       $_POST['password'] === $password)
    {
        $_SESSION['admin_logged_in'] = true;
        header("Location: dashboard.php");
        exit;
    }
    else
    {
        $error = "Invalid Username or Password";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Admin Login</title>

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

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

<style>

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;

    background:linear-gradient(
        135deg,
        #0f172a,
        #1e293b,
        #2563eb
    );

    font-family:Arial, sans-serif;
}

.login-box{

    width:420px;

    background:rgba(255,255,255,.08);

    backdrop-filter:blur(15px);

    border:1px solid rgba(255,255,255,.15);

    border-radius:25px;

    padding:40px;

    box-shadow:
    0 20px 50px rgba(0,0,0,.30);

    color:white;
}

.logo{

    text-align:center;
    margin-bottom:30px;
}

.logo i{

    font-size:65px;
    color:#60a5fa;
}

.logo h2{

    margin-top:15px;
    font-weight:700;
}

.logo p{

    color:#cbd5e1;
    margin-top:5px;
}

.form-control{

    height:52px;

    border-radius:12px;

    border:none;

    background:rgba(255,255,255,.12);

    color:white;
}

.form-control:focus{

    background:rgba(255,255,255,.15);

    color:white;

    box-shadow:none;

    border:1px solid #60a5fa;
}

.form-control::placeholder{

    color:#cbd5e1;
}

.input-group-text{

    background:rgba(255,255,255,.12);

    border:none;

    color:white;
}

.btn-login{

    width:100%;

    height:52px;

    border:none;

    border-radius:12px;

    background:#2563eb;

    color:white;

    font-weight:bold;

    transition:.3s;
}

.btn-login:hover{

    background:#1d4ed8;

    transform:translateY(-2px);
}

.alert{

    border-radius:12px;
}

.footer-text{

    text-align:center;

    margin-top:20px;

    color:#cbd5e1;

    font-size:14px;
}

</style>

</head>
<body>

<div class="login-box">

    <div class="logo">

        <i class="fas fa-user-shield"></i>

        <h2>LICENSE PANEL</h2>

        <p>Administrator Login</p>

    </div>

    <?php if(!empty($error)): ?>

        <div class="alert alert-danger">
            <?= $error ?>
        </div>

    <?php endif; ?>

    <form method="POST">

        <div class="mb-3">

            <div class="input-group">

                <span class="input-group-text">
                    <i class="fas fa-user"></i>
                </span>

                <input
                    type="text"
                    name="username"
                    class="form-control"
                    placeholder="Username"
                    required>

            </div>

        </div>

        <div class="mb-4">

            <div class="input-group">

                <span class="input-group-text">
                    <i class="fas fa-lock"></i>
                </span>

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

            </div>

        </div>

        <button
            type="submit"
            name="login"
            class="btn-login">

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

        </button>

    </form>

    <div class="footer-text">

        Trade License Management System

    </div>

</div>

</body>
</html>