<?php
$page_title = 'Iniciar Sesión';
// We don't want the full header here, just the HTML head part.
// So we create a simpler header for login/public pages.
?>
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars($page_title) ?></title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="/assets/css/style.css?v=<?php echo time(); ?>">
</head>
<body>

<div class="login-container">
    <div class="form-container">
        <h1>Iniciar Sesión</h1>
        
        <?php 
        session_start();
        if (isset($_SESSION['login_error'])) {
            echo '<div class="alert alert-error">' . $_SESSION['login_error'] . '</div>';
            unset($_SESSION['login_error']);
        }
        ?>

        <form action="/auth/handle_login.php" method="POST">
            <div class="form-group">
                <label for="email">Correo Electrónico</label>
                <input type="email" id="email" name="email" class="form-control" required>
            </div>
            <div class="form-group">
                <label for="password">Contraseña</label>
                <input type="password" id="password" name="password" class="form-control" required>
            </div>
            <button type="submit" class="btn btn-principal" style="width:100%;">Ingresar</button>
        </form>
    </div>
</div>

</body>
</html>
