<div class="row justify-content-center">
<div class="col-12">
<div class="card-box">

    <div class="card-box-header">
        <h5>
            <i class="fa-solid fa-tag" style="color:#7c3aed;"></i>
            <?php if(!empty($categorydata)) echo 'Edit Category'; else echo 'Add New Category'; ?>
        </h5>
        <a href="<?php echo site_url('category'); ?>" class="btn btn-sm" style="background:#f1f5f9;color:#374151;">
            <i class="fa-solid fa-arrow-left me-1"></i> Back
        </a>
    </div>

    <form method="post" id="Form">

        <!-- Hidden ID for edit detection -->
        <input type="hidden" name="id" id="id" value="<?php if(!empty($categorydata)) echo $categorydata[0]->id; ?>">

        <div class="row">
            <div class="col-md-4 mb-3">
                <label class="form-label">Category Name <span class="required-star">*</span></label>
                <div class="input-group">
                    <input type="text" name="category_name" id="category_name" class="form-control"
                           value="<?php if(!empty($categorydata)) echo $categorydata[0]->category_name; ?>"
                            autofocus>
                </div>
            </div>

            <div class="col-md-2 mb-4">
    <label class="form-label">Status</label>
    <select name="status" id="status" class="form-select select2 select2-no-search">
        <!--<option value="">-- Select Status --</option>-->
        <option value="1" <?php if(!empty($categorydata) && $categorydata[0]->status == 1) echo 'selected'; ?>>Active</option>
        <option value="0" <?php if(!empty($categorydata) && $categorydata[0]->status == 0) echo 'selected'; ?>>Inactive</option>
    </select>
</div>
        </div>

        <div class="d-flex gap-2">
            <button type="button" id="btn_savee" class="btn btn-primary">
                <i class="fa-solid fa-floppy-disk me-1"></i> Save
            </button>
            <a href="<?php echo site_url('category'); ?>" class="btn" style="background:#f1f5f9;color:#374151;">Cancel</a>
        </div>

    </form>
</div>
</div>
</div>