<div class="row justify-content-center"><div class="col-xl-8">
    <div class="card"><div class="card-header"><h5 class="mb-0"><?= lang('members.create_type') ?></h5></div><div class="card-body">
        <form method="POST" action="/api/membership-types/store" data-ajax="true">
            <?= csrf_field() ?>
            <div class="row g-3">
                <div class="col-md-4"><label class="form-label">Type Code *</label><input type="text" name="type_code" class="form-control" required><div class="invalid-feedback" data-field="type_code"></div></div>
                <div class="col-md-4"><label class="form-label">Name (EN) *</label><input type="text" name="name_en" class="form-control" required><div class="invalid-feedback" data-field="name_en"></div></div>
                <div class="col-md-4"><label class="form-label">Name (AR) *</label><input type="text" name="name_ar" class="form-control" dir="rtl" required><div class="invalid-feedback" data-field="name_ar"></div></div>
                <div class="col-md-4"><label class="form-label">Category</label><select name="category_id" class="form-select"><option value="">—</option><?php foreach ($categories as $c): ?><option value="<?= $c['id'] ?>"><?= e($c['name_en']) ?></option><?php endforeach; ?></select></div>
                <div class="col-md-4"><label class="form-label">Gender Restriction</label><select name="gender_restriction" class="form-select"><option value="both">Both</option><option value="male">Male Only</option><option value="female">Female Only</option></select></div>
                <div class="col-md-4"><label class="form-label">Grace Period (days)</label><input type="number" name="grace_period_days" class="form-control" value="30"></div>
                <div class="col-md-3"><div class="form-check mt-4"><input type="checkbox" name="is_family_membership" value="1" class="form-check-input" id="ck-fam"><label class="form-check-label" for="ck-fam">Family Membership</label></div></div>
                <div class="col-md-3"><label class="form-label">Max Dependents</label><input type="number" name="max_dependents" class="form-control" min="0"></div>
                <div class="col-md-3"><div class="form-check mt-4"><input type="checkbox" name="requires_sponsor" value="1" class="form-check-input" id="ck-sp"><label class="form-check-label" for="ck-sp">Requires Sponsor</label></div></div>
                <div class="col-md-3"><label class="form-label">Sponsor Count</label><input type="number" name="sponsor_count" class="form-control" min="0" value="0"></div>
                <div class="col-md-3"><div class="form-check mt-4"><input type="checkbox" name="requires_board_approval" value="1" class="form-check-input"><label class="form-check-label">Board Approval</label></div></div>
                <div class="col-md-3"><label class="form-label">Sort Order</label><input type="number" name="sort_order" class="form-control" value="10"></div>
            </div>
            <div class="mt-4"><button type="submit" class="btn btn-primary"><i class="fas fa-save me-1"></i>Save</button> <a href="/membership-types" class="btn btn-secondary">Cancel</a></div>
        </form>
    </div></div>
</div></div>