<?php
session_start();

// Simple hardcoded check for demonstration (In production, use a database!)
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // Example logic:
    if ($username === 'admin' && $password === 'admin') {
        $_SESSION['is_admin'] = true;
        header("Location: admin.php"); // Redirect to the admin panel
        exit();
    } else {
        $error = "Invalid login credentials.";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Admin Login</title>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');
        
        body {
            font-family: 'Plus Jakarta Sans', sans-serif;
            background: #0b0f19;
            color: #f3f4f6;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }

        .login-container {
            background: linear-gradient(145deg, rgba(22, 30, 49, 0.9) 0%, rgba(15, 22, 36, 1) 100%);
            border: 1px solid rgba(255, 255, 255, 0.05);
            padding: 40px;
            border-radius: 20px;
            width: 100%;
            max-width: 350px;
            box-shadow: 0 20px 50px rgba(0,0,0,0.5);
            text-align: center;
        }

        h2 { font-weight: 800; margin-bottom: 24px; color: #fff; font-size: 20px; }

        input {
            width: 100%;
            padding: 12px;
            margin-bottom: 16px;
            background: #090d16;
            border: 1px solid rgba(255,255,255,0.1);
            color: #fff;
            border-radius: 8px;
            box-sizing: border-box;
        }

        button {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
            color: #fff;
            border: none;
            font-weight: 700;
            border-radius: 8px;
            cursor: pointer;
            transition: 0.2s;
        }

        button:hover { background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); }

        .error { color: #fca5a5; font-size: 14px; margin-bottom: 16px; }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>System Authentication Required</h2>
        <?php if (isset($error)) echo "<p class='error'>$error</p>"; ?>
        <form method="POST">
            <input type="text" name="username" placeholder="Username" required><br>
            <input type="password" name="password" placeholder="Password" required><br>
            <button type="submit">Login to Admin Console</button>
        </form>
    </div>
</body>
</html>