<?php
session_start();
// Agar pehle se logged in hai toh direct leads par bhejein
if(isset($_SESSION['admin_logged_in'])) { header("Location: view-leads.php"); exit; }

$error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // Aapka diya gaya credential
    if ($username === "hsrp" && $password === "Hsrp@432%bca") {
        $_SESSION['admin_logged_in'] = true;
        header("Location: view-leads.php");
        exit;
    } else {
        $error = "Galat Username ya Password!";
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Admin Login - HSRP Book</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body { background: #f4f9ff; height: 100vh; display: flex; align-items: center; justify-content: center; }
        .login-card { width: 400px; padding: 30px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); background: #fff; }
        .btn-primary { background: #243875; border: none; }
    </style>
</head>
<body>
    <div class="login-card">
        <h3 class="text-center fw-bold mb-4" style="color: #243875;">HSRP Admin Login</h3>
        <?php if($error): ?> <div class="alert alert-danger"><?php echo $error; ?></div> <?php endif; ?>
        <form method="POST">
            <div class="mb-3">
                <label>Username</label>
                <input type="text" name="username" class="form-control" required>
            </div>
            <div class="mb-3">
                <label>Password</label>
                <input type="password" name="password" class="form-control" required>
            </div>
            <button type="submit" class="btn btn-primary w-100 py-2">Login Now</button>
        </form>
    </div>
</body>
</html>