<div class="d-flex align-items-center gap-2 mb-4">
    <a href="<?= url('customers/'.$customer['id']) ?>" class="btn btn-sm btn-outline-secondary">
        <i class="bi bi-arrow-left"></i>
    </a>
    <h4 class="mb-0 fw-bold">Edit Customer</h4>
</div>

<?= flash_alert() ?>

<div class="row justify-content-center">
<div class="col-lg-6">
<div class="card border-0 shadow-sm">
<div class="card-body p-4">
<form method="POST" action="<?= url('customers/'.$customer['id'].'/update') ?>">
    <?= csrf_field() ?>

    <div class="mb-3">
        <label class="form-label fw-semibold">Full Name <span class="text-danger">*</span></label>
        <input type="text" name="name" class="form-control"
               value="<?= e($customer['name']) ?>" required>
    </div>

    <div class="mb-3">
        <label class="form-label fw-semibold">Email <span class="text-danger">*</span></label>
        <input type="email" name="email" class="form-control"
               value="<?= e($customer['email']) ?>" required>
    </div>

    <div class="mb-3">
        <label class="form-label fw-semibold">Phone</label>
        <input type="text" name="phone" class="form-control"
               value="<?= e($customer['phone']) ?>">
    </div>

    <div class="mb-3">
        <label class="form-label fw-semibold">Account Status</label>
        <select name="is_active" class="form-select">
            <option value="1" <?= $customer['is_active'] ? 'selected' : '' ?>>Active</option>
            <option value="0" <?= !$customer['is_active'] ? 'selected' : '' ?>>Inactive</option>
        </select>
    </div>

    <div class="mb-4">
        <label class="form-label fw-semibold">Admin Note
            <span class="text-muted fw-normal small">(internal only)</span>
        </label>
        <textarea name="admin_note" class="form-control" rows="3"
                  placeholder="Internal notes about this customer…"><?= e($customer['admin_note'] ?? '') ?></textarea>
    </div>

    <div class="d-flex gap-2">
        <button type="submit" class="btn btn-primary fw-semibold px-4">
            <i class="bi bi-check-lg me-1"></i> Save Changes
        </button>
        <a href="<?= url('customers/'.$customer['id']) ?>" class="btn btn-outline-secondary">Cancel</a>
    </div>
</form>
</div>
</div>

<div class="card border-0 shadow-sm mt-3">
<div class="card-body p-3">
    <div class="text-muted small">
        <i class="bi bi-shield-lock me-1"></i>
        Password cannot be changed here for security. Use the password reset flow.
    </div>
</div>
</div>

</div>
</div>
