<!doctype html>
<html lang="fr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Connexion - ONE CORE</title>
    <link rel="icon" type="image/png" href="<?= base_url('assets/brand/one-core-favicon.png') ?>">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top left, #16c8ff 0, transparent 28%), linear-gradient(135deg, #0b1220, #1348ff); }
        .login-card { width: min(430px, calc(100vw - 32px)); border: 0; border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
        .login-logo { display: block; width: 150px; height: auto; margin: auto; }
    </style>
</head>
<body>
<div class="card login-card">
    <div class="card-body p-4 p-md-5">
        <div class="mb-4">
            <img class="login-logo" src="<?= base_url('assets/brand/one-core-logo.png') ?>" alt="ONE CORE">
            <div class="fw-bold text-primary">ONE CORE</div>
            <h1 class="h3 mb-1">Connexion</h1>
            <p class="text-muted mb-0">Accédez au socle modulaire.</p>
        </div>

        <?php if (session('error')): ?>
            <div class="alert alert-danger"><?= esc(session('error')) ?></div>
        <?php endif; ?>

        <form method="post" action="<?= site_url('/login') ?>">
            <?= csrf_field() ?>
            <div class="mb-3">
                <label class="form-label" for="email">Email</label>
                <input class="form-control" id="email" name="email" type="email" value="<?= old('email') ?>" required>
            </div>
            <div class="mb-4">
                <label class="form-label" for="password">Mot de passe</label>
                <input class="form-control" id="password" name="password" type="password" required>
            </div>
            <button class="btn btn-primary w-100" type="submit">Se connecter</button>
        </form>
    </div>
</div>
</body>
</html>
