<?php
session_start();

$error = '';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

    // Fixed credentials
    $admin_username = "admin";
    $admin_password = "123456";

    $username = trim($_POST['username']);
    $password = trim($_POST['password']);

    if ($username === $admin_username && $password === $admin_password) {

        $_SESSION['admin_logged_in'] = true;
		$_SESSION['admin_username'] = $username;
        header("Location: dashboard");
        exit();

    } else {
        $error = "Invalid Username or Password";
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Admin Login</title>
<style>
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

.login-box{
    width:400px;
    padding:40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    backdrop-filter:blur(15px);
    border:1px solid rgba(255,255,255,0.2);
    border-radius:20px;
    box-shadow:0 15px 35px rgba(0,0,0,0.25);
    color:#fff;
}

.login-box h2{
    text-align:center;
    margin-bottom:30px;
    font-size:30px;
    font-weight:600;
}

.input-group{
    margin-bottom:20px;
}

.input-group label{
    display:block;
    margin-bottom:8px;
    font-size:14px;
}

.input-group input{
    width:100%;
    padding:14px;
    border:none;
    border-radius:10px;
    background:rgba(255,255,255,0.15);
    color:#fff;
    outline:none;
    font-size:15px;
}

.input-group input::placeholder{
    color:rgba(255,255,255,0.7);
}

button{
    width:100%;
    padding:14px;
    border:none;
    border-radius:10px;
    background:#ffffff;
    color:#022c5e;
    font-size:16px;
    font-weight:bold;
    cursor:pointer;
    transition:0.3s;
}

button:hover{
    transform:translateY(-2px);
    box-shadow:0 8px 20px rgba(0,0,0,0.2);
}

.error{
    background:#ff4d4d;
    color:white;
    padding:12px;
    border-radius:8px;
    margin-bottom:20px;
    text-align:center;
}

.logo{
    text-align:center;
    margin-bottom:15px;
}

.logo img{
    width:80px;
}

.footer-text{
    text-align:center;
    margin-top:20px;
    font-size:13px;
    opacity:.8;
}

@media(max-width:480px){
    .login-box{
        width:90%;
        padding:30px 20px;
    }
}
</style>
</head>
<body>
<div class="login-box">

    <div class="logo">
        <!-- Replace with your logo -->
        <img src="Final logo-02.png" alt="Logo">
    </div>

    <h2>Admin Login</h2>

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

    <form method="post">

        <div class="input-group">
            <label>Username</label>
            <input type="text" name="username" placeholder="Enter Username" required>
        </div>

        <div class="input-group">
            <label>Password</label>
            <input type="password" name="password" placeholder="Enter Password" required>
        </div>

        <button type="submit">Sign In</button>

    </form>

    <div class="footer-text">
        Admin Control Panel
    </div>

</div>


</body>
</html>