<?php session_start(); if (isset($_SESSION['admin_logged_in'])) header('Location: dashboard.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Admin Login</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Google Font -->
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
  <style>
    body {
      margin: 0;
      font-family: 'Inter', sans-serif;
      background: url('https://img.freepik.com/free-photo/beautiful-optical-fiber-detail_23-2149182522.jpg?ga=GA1.1.503399405.1745384729&semt=ais_items_boosted&w=740') no-repeat center center fixed;
      background-size: cover;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
    }

    .login-container {
      background: rgba(255, 255, 255, 0.95);
      padding: 45px 70px;
      border-radius: 12px;
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
      width: 100%;
      max-width: 400px;
      text-align: center;
    }

    .login-container img {
      width: 180px;
      margin-bottom: 20px;
    }

    .login-container h2 {
      margin-bottom: 20px;
      color: #7d0d0d;
    }

    .login-container input[type="text"],
    .login-container input[type="password"] {
      width: 100%;
      padding: 12px 15px;
      margin: 10px 0;
      border: 1px solid #ccc;
      border-radius: 8px;
      font-size: 15px;
    }

    .login-container button {
      width: 100%;
      padding: 12px;
      margin-top: 10px;
      background-color: #7d0d0d;
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      cursor: pointer;
      transition: background 0.3s ease;
    }

    .login-container button:hover {
      background-color: #5e0808;
    }

    .error-message {
      color: red;
      margin-top: 15px;
    }

    @media (max-width: 480px) {
      .login-container {
        margin: 20px;
        padding: 30px 20px;
      }
    }
  </style>
</head>
<body>
  <div class="login-container">
    <img src="https://www.manakanalytics.com/assets/image/logo/logo1.png" alt="Logo">
    <h2>Admin Login</h2>
    <form method="post">
      <input type="text" name="username" placeholder="Username" required>
      <input type="password" name="password" placeholder="Password" required>
      <button type="submit">Login</button>
    </form>
    <?php
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        $user = $_POST['username'];
        $pass = $_POST['password'];

        if ($user === 'admin' && $pass === 'admin@123') {
            $_SESSION['admin_logged_in'] = true;
            header('Location: dashboard.php');
            exit();
        } else {
            echo "<p class='error-message'>Invalid Credentials</p>";
        }
    }
    ?>
  </div>
</body>
</html>
