<?php
use App\Helpers\SettingHelper;

$branding = SettingHelper::get();
$logo = !empty($branding['logo_path']) ? $baseUrl . '/uploads/branding/' . ltrim($branding['logo_path'], '/') : null;
?>
<div class="login-wrapper row g-4 align-items-center">
    <div class="col-lg-6">
        <div class="brand-panel text-center text-lg-start">
            <?php if ($logo): ?>
                <img src="<?= htmlspecialchars($logo) ?>" alt="Logo" class="brand-logo mb-3">
            <?php endif; ?>
            <h1 class="brand-title mb-1"><?= htmlspecialchars($branding['company_name'] ?? 'Mutiara Group') ?></h1>
            <p class="text-muted mb-0"><?= htmlspecialchars($branding['tagline'] ?? 'Smart HR Portal') ?></p>
        </div>
    </div>
    <div class="col-lg-5 col-xl-4">
        <div class="card shadow-sm border-0">
            <div class="card-body p-4">
                <h4 class="card-title mb-3">Login</h4>
                <?php if (!empty($error)): ?>
                    <div class="alert alert-danger"><?= htmlspecialchars($error) ?></div>
                <?php endif; ?>
                <form method="post" action="index.php?route=login" class="vstack gap-3">
                    <?= $csrf ?>
                    <div>
                        <label class="form-label">ID Pengguna</label>
                        <input type="text" name="login_id" pattern="\d{12}" maxlength="12" class="form-control form-control-lg" placeholder="Contoh: 999999999999" required>
                    </div>
                    <div>
                        <label class="form-label">Password</label>
                        <input type="password" name="password" class="form-control form-control-lg" required>
                    </div>
                    <button class="btn btn-primary btn-lg w-100">Sign In</button>
                </form>
            </div>
        </div>
    </div>
</div>

