<?php
session_start();

if (isset($_SESSION['userID'])) {
    header('Location: ../dashboard/dashboard.php');
    exit();
}

$first_name = $_SESSION['first_name'];
$email = $_SESSION['email'];

?>


<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>GLH | Login</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
    
    <style>
        
        .navbar-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 5px; 
            border-bottom: 1px solid #ddd;
            background-color: #90d5ff;
        }
        
        .logo { 
            display: block;
            height: 40px;
            width: auto;
        }
        
        .navbar {
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap; 
            gap: 80px;           
        }
        
        .navbar a {
            text-decoration: none;
            color: black;
            position: relative;
            padding-bottom: 2px;
        }
        
        .navbar a::after{
            content: '';
            position: absolute;
            width: 100%;
            transform: scaleX(0);
            height: 2px;
            bottom: 0;
            left: 0;
            background-color: black;
            transition: transform 0.25s ease-out;
        }

        .navbar a:hover::after {
            transform: scaleX(1);
        }

        .account {
            justify-content: flex-end;
        }
        
        .account button {
            background: white;
            border: 0px solid #ccc;
            padding: 5px 15px;
            border-radius: 5px;
            cursor: pointer;
    }
        
        
        .logo, .account {
            flex: 1; 
             display: flex;
}
        

        @media (max-width: 576px) {
            .navbar a {
            font-size: 14px;
            }
            
            .navbar {
                gap: 20px
            }
            
            .logo img {
                width: 90px;
                height: auto;
            }
            
        }
        
        .login-form {
            display: flex;
            justify-content: center; 
            align-items: center;    
            min-height: 80vh;      
        }

        .form-card {
            background: white;
            padding: 70px;
            border-radius: 7px;
            box-shadow: 0 8px 8px rgba(0,0,0,0.1);
            text-align: center;
        }
    
        .form-card input {
            display: block;
            width: 100%;
            margin-bottom: 15px;
            padding: 7px;
            box-sizing: border-box;
            border-radius: 5px;
        }
    
        .submit-button {
            width: 140px !important; 
            height: 40px;
            cursor: pointer;
            display: block; 
            margin: 0 auto;
            border-color: transparent;
            background-color: #90d5ff;
        }
        
        .submit-button:hover {
            background-color: #6FB7E3;
            transition: 0.3s;
        }
        
</style>

<body>
    <header class="navbar-container">
            
            <div class="logo">
                <a href="../index.php">
                    <img src="../glh.png" class="logo" alt="logo" width="50" height="15">
                </a>
            </div>
        
            <div class="navbar">
                <a href="/glh/market/market.php">Market</a>
                <a href="/glh/dashboard/dashboard.php">Dashboard</a>
                <a href="/glh/market/basket.php">Basket</a>
            </div>
            
            <div class="account">
                <a href="/glh/register/register.html">
                    <button>Register <i class="bi bi-person-circle"></i></button>
                </a>
            </div>
            
        </header>

    <div class="login-form">
        <div class="form-card">
            <form method="POST" action="login.php">
                
                <h3>Login</h3><br>
                
                <input type="email" name="email" placeholder="Email" required>
                <input type="password" name="password" placeholder="Password" required>
                
                <input type="submit" class="submit-button" value="Login">
                <br>
                <label>Don't have an account?&nbsp;</label><a href="../register/register.html">Create one here</a>
                
            </form>
        </div>
    </div>
</body>
</html>