<?php
// admin_login.php
session_start();

$error = "";

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    $email = $_POST['email'] ?? '';
    $password = $_POST['password'] ?? '';

    // Demo credentials
    if ($email === "admin@rslearninglab.in" && $password === "admin123") {
        $_SESSION['admin_logged_in'] = true;
        header("Location: dashboard.php");
        exit;
    } else {
        $error = "Invalid admin credentials";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin Login | RS Learning Lab</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: radial-gradient(circle at top, #0b1a2a, #05080f);
    color: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand img {
    width: 64px;
    margin-bottom: 10px;
}

.brand h1 {
    font-size: 28px;
    margin: 0;
}

.brand p {
    font-size: 14px;
    opacity: 0.75;
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 6px;
}

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    outline: none;
}

input::placeholder {
    color: rgba(255,255,255,0.4);
}

button {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #0b8c9f, #1fd1f9);
    color: #000;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(31,209,249,0.4);
}

.error {
    background: rgba(255,0,0,0.15);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
    text-align: center;
}

.demo-box {
    margin-top: 24px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px;
    font-size: 13px;
    opacity: 0.85;
}

.demo-box strong {
    color: #1fd1f9;
}

.footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    opacity: 0.6;
}
</style>
</head>

<body>

<div class="login-wrapper">

    <div class="brand">
        <!-- Optional logo -->
        <!-- <img src="assets/logo.png" alt="RS Learning Lab"> -->
        <h1>RS Learning Lab</h1>
        <p>Institution Admin Login</p>
    </div>

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

    <form method="post">
        <div class="form-group">
            <label>Email Address</label>
            <input type="email" name="email" placeholder="admin@rslearninglab.in" required>
        </div>

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

        <button type="submit">Login as Admin</button>
    </form>

    <div class="demo-box">
        <strong>Demo Credentials</strong><br>
        Email: admin@rslearninglab.in<br>
        Password: admin123
    </div>

    <div class="footer">
        © RS Learning Lab · Learning Behaviour Platform
    </div>

</div>

</body>
</html>
