<?php
$tenant = service('tenantContext')->hasTenant() ? service('tenantContext')->getTenant() : null;
$primaryColor   = safe_hex_color($tenant->primary_color ?? null, '#4f46e5');
$secondaryColor = safe_hex_color($tenant->secondary_color ?? null, '#f59e0b');
$hotelName      = $tenant->hotel_name ?? 'MaxYields PMS';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <?php include APPPATH . 'Views/public/_shell_head.php'; ?>
</head>
<body>
<div class="public-shell">
    <div class="d-flex align-items-center gap-2 mb-4">
        <div class="brand-mark"><i class="bi bi-buildings-fill"></i></div>
        <div class="brand-name"><?= esc($hotelName) ?></div>
    </div>

    <div class="public-card">
        <a href="<?= site_url('organizer/login') ?>" class="text-decoration-none small fw-semibold d-inline-flex align-items-center gap-1 mb-3" style="color: var(--brand);">
            <i class="bi bi-arrow-left"></i> Back to login
        </a>
        <h1 class="h5 mb-1">Forgot Password?</h1>
        <p class="text-muted small mb-3">Enter your email and, if there's a phone number on file, we'll text you a code.</p>

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

        <form action="<?= site_url('organizer/forgot-password') ?>" method="post">
            <?= csrf_field() ?>
            <div class="mb-3">
                <label class="form-label small fw-semibold">Email</label>
                <input type="email" class="form-control" name="email" value="<?= esc(old('email')) ?>" required autofocus>
            </div>
            <button type="submit" class="btn btn-brand w-100"><i class="bi bi-send me-1"></i>Send Code</button>
        </form>
    </div>
</div>
</body>
</html>
