<?php
$pageTitle = 'Create Form';
$currentPage = 'forms';
$breadcrumb = [['label'=>'Forms','url'=>url('/forms')],['label'=>'Create New']];
require_once APP_PATH . '/views/layouts/header.php';
?>
<div style="max-width:640px">
<div class="card" style="padding:2rem">
    <h2 style="font-weight:800;font-size:1.1rem;color:#111827;margin:0 0 1.5rem">Create New Form</h2>
    <form method="POST" action="<?= url('/forms/store') ?>">
        <?= csrf_field() ?>
        <div style="display:flex;flex-direction:column;gap:1.25rem">
            <div>
                <label class="form-label">Form Name *</label>
                <input type="text" name="name" class="form-input" placeholder="e.g. Contact Form, Registration Form" required autofocus>
            </div>
            <div>
                <label class="form-label">Description</label>
                <textarea name="description" class="form-input" rows="2" placeholder="Short description (optional)"></textarea>
            </div>
            <div>
                <label class="form-label">WhatsApp Number</label>
                <input type="text" name="whatsapp_number" class="form-input" placeholder="e.g. 601234567890 (with country code, no +)">
                <p style="font-size:.7rem;color:#9ca3af;margin:.375rem 0 0">Responses will be sent to this WhatsApp after form submission.</p>
            </div>
            <div>
                <label class="form-label">Thank You Message</label>
                <textarea name="thank_you_message" class="form-input" rows="2" placeholder="Thank you for your submission!">Thank you for your submission! We will get back to you soon.</textarea>
            </div>
            <div>
                <label class="form-label">Redirect URL (optional)</label>
                <input type="url" name="redirect_url" class="form-input" placeholder="https://example.com/thank-you">
                <p style="font-size:.7rem;color:#9ca3af;margin:.375rem 0 0">Leave blank to show thank you message only.</p>
            </div>
            <div style="display:flex;gap:.75rem;padding-top:.5rem;border-top:1px solid #f3f4f6">
                <button type="submit" class="btn-primary"><i class="fas fa-save"></i> Create Form</button>
                <a href="<?= url('/forms') ?>" class="btn-secondary">Cancel</a>
            </div>
        </div>
    </form>
</div>
</div>
<?php require_once APP_PATH . '/views/layouts/footer.php'; ?>
