<?php
session_start();
$correct_password = 'wuhuan'; // 🔐 Change this to your secure password
$error = '';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  if ($_POST['password'] === $correct_password) {
    $_SESSION['logged_in'] = true;
    header('Location: upload.php');
    exit;
  } else {
    $error = 'Incorrect password.';
  }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <title>Admin Login</title>
  <style>
    :root{--bg:#0b1020;--card:#121830;--muted:#a9b3c9;--text:#e9edf6;--accent:#6fb1ff;}
    html,body{margin:0;background:linear-gradient(180deg,#0b1020,#0c1430);}
    body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,sans-serif;color:var(--text);}
    .wrap{max-width:400px;margin:100px auto;padding:0 16px;}
    h1{margin-bottom:12px;font-size:clamp(24px,4vw,32px)}
    .card{background:var(--card);border:1px solid #223;border-radius:16px;padding:24px;box-shadow:0 10px 28px rgba(0,0,0,.25)}
    label{display:block;margin-bottom:8px;font-weight:500}
    input{background:#0f1631;border:1px solid #223;color:var(--text);padding:10px 12px;border-radius:12px;outline:none;width:100%;margin-bottom:16px}
    .btn{background:var(--accent);color:#031225;border:0;padding:10px 14px;border-radius:12px;font-weight:700;cursor:pointer;width:100%}
    .error{margin-top:10px;color:#f87171;font-size:14px;text-align:center}
  </style>
</head>
<body>
  <div class="wrap">
    <h1>Admin Login</h1>
    <div class="card">
      <form method="post" action="">
        <label for="password">Enter Password</label>
        <input type="password" id="password" name="password" required autofocus>
        <button type="submit" class="btn">Login</button>
        <?php if (!empty($error)) echo "<div class='error'>$error</div>"; ?>
      </form>
    </div>
  </div>
</body>
</html>
