<?php 
session_start();
if(isset($_SESSION['admin'])){
    header('location:halaman_utama.php');
    exit();
}
?>

<!DOCTYPE html>
<html>
<head>
  <title>Pasar Pagi UMKM Galeri 3D</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="../css/home.css">
  <link rel="stylesheet" type="text/css" href="../css/bootstrap-theme.css">
  <link rel="icon" href="../image/home/logo.ico" type="image/x-icon">
  <script src="../js/jquery.js"></script>
  <script src="../js/bootstrap.min.js"></script>

  <style>
    /* Center modal vertikal dan horizontal */
    #loginModal .modal-dialog {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0; /* hilangkan margin default */
    }
    /* Modal full screen untuk HP */
    @media (max-width: 767px) {
      .modal-dialog {
        width: 95%;
        margin: 10px auto;
      }
      .modal-content {
        border-radius: 15px;
      }
      .modal-body input {
        font-size: 1.2em;
        padding: 12px;
      }
      .btn-warning {
        width: 100%;
        padding: 12px;
        font-size: 1.1em;
      }
    }

    /* Modal desktop standar tapi lebih lebar */
    @media (min-width: 768px) {
      .modal-dialog {
        width: 400px;
      }
      .modal-content {
        border-radius: 10px;
      }
    }
  </style>

  <script type="text/javascript">
    $(document).ready(function() {
      $("#target").click();
    });
  </script>
</head>
<body>
  <input type="hidden" id="target" data-toggle="modal" data-target="#loginModal">

  <div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header text-center" style="background-color:#f7c04a; color:#fff;">
          <h4 class="modal-title w-100" id="loginModalLabel">LOGIN ADMIN</h4>
        </div>
        <div class="modal-body">
          <form action="proses/login.php" method="POST">
            <div class="form-group">
              <label for="username">Username</label>
              <input type="text" class="form-control" id="username" placeholder="Username" name="user" autofocus autocomplete="off">
            </div>
            <div class="form-group">
              <label for="password">Password</label>
              <input type="password" class="form-control" id="password" placeholder="Password" name="pass" autocomplete="off">
            </div>
            <div class="modal-footer">
              <button type="submit" class="btn btn-warning">Login</button>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</body>
</html>
