<?php
session_start();
// Basic Admin Auth
if(isset($_POST['login'])) {
    if($_POST['username'] == 'admin' && $_POST['password'] == 'admin123') {
        $_SESSION['admin_logged_in'] = true;
        header("Location: index.php");
        exit();
    } else {
        $error = "Invalid Credentials!";
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Login - Bhartiya Seva</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body { background-color: #f8fafc; display: flex; align-items: center; justify-content: center; height: 100vh; }
        .login-card { width: 100%; max-width: 400px; border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); border: none; }
        .btn-brand { background-color: #15803d; color: white; }
        .btn-brand:hover { background-color: #166534; color: white; }
    </style>
</head>
<body>
    <div class="card login-card">
        <div class="card-body p-5">
            <div class="text-center mb-4">
                <img src="https://i.ibb.co/4gVbp8YZ/Whats-App-Image-2026-04-23-at-9-54-25-PM.png" alt="Logo" class="img-fluid mb-3" style="max-height: 80px;">
                <h4 class="fw-bold">Admin Portal</h4>
            </div>
            
            <?php if(isset($error)): ?>
                <div class="alert alert-danger text-center"><?php echo $error; ?></div>
            <?php endif; ?>

            <form action="" method="POST">
                <div class="mb-3">
                    <label class="form-label text-muted fw-bold">Username</label>
                    <div class="input-group">
                        <span class="input-group-text"><i class="fas fa-user border-0"></i></span>
                        <input type="text" name="username" class="form-control py-2" required placeholder="admin">
                    </div>
                </div>
                <div class="mb-4">
                    <label class="form-label text-muted fw-bold">Password</label>
                    <div class="input-group">
                        <span class="input-group-text"><i class="fas fa-lock"></i></span>
                        <input type="password" name="password" class="form-control py-2" required placeholder="admin123">
                    </div>
                </div>
                <button type="submit" name="login" class="btn btn-brand w-100 py-2 fs-5 rounded-pill shadow-sm">Secure Login <i class="fas fa-arrow-right ms-2"></i></button>
            </form>
            <div class="text-center mt-4">
                <a href="../index.php" class="text-decoration-none text-secondary"><i class="fas fa-home me-1"></i> Back to Website</a>
            </div>
        </div>
    </div>
</body>
</html>
