<h2 class="h3"><?php echo $edit_cert ? $t['edit_cert_title'] : $t['add_cert_title']; ?></h2>
<form action="certifications.php" method="POST" enctype="multipart/form-data" class="mb-5">
    <input type="hidden" name="id" value="<?php echo $edit_cert['id'] ?? ''; ?>">
    <input type="hidden" name="current_image" value="<?php echo $edit_cert['image_url'] ?? ''; ?>">

    <div class="mb-3">
        <label for="title" class="form-label"><?php echo $t['cert_title']; ?></label>
        <input type="text" class="form-control" id="title" name="title" value="<?php echo htmlspecialchars($edit_cert['title'] ?? ''); ?>" required>
    </div>

    <div class="mb-3">
        <label for="description" class="form-label"><?php echo $t['cert_description']; ?></label>
        <textarea class="form-control" id="description" name="description" rows="3"><?php echo htmlspecialchars($edit_cert['description'] ?? ''); ?></textarea>
    </div>

    <div class="mb-3">
        <label for="image" class="form-label"><?php echo $t['cert_image']; ?></label>
        <input type="file" class="form-control" id="image" name="image" accept="image/*">
        <small class="form-text text-muted"><?php echo $t['cert_upload_instruction']; ?></small>
        <?php if (!empty($edit_cert['image_url'])): ?>
            <div class="mt-2">
                <small><?php echo $t['cert_current_image']; ?>:</small><br>
                <img src="../public/<?php echo htmlspecialchars($edit_cert['image_url']); ?>" alt="Current Image" style="max-width: 200px; height: auto; border-radius: 0.25rem;">
            </div>
        <?php endif; ?>
    </div>

    <div class="mb-3">
        <label for="sort_order" class="form-label"><?php echo $t['slider_status']; ?></label>
        <input type="number" class="form-control" id="sort_order" name="sort_order" value="<?php echo $edit_cert['sort_order'] ?? 0; ?>" required>
    </div>

    <div class="d-flex gap-3 mt-4">
        <button type="submit" class="btn btn-gold flex-grow-1 py-2 fw-bold fs-6">
            💾 <?php echo $t['user_save_btn']; ?>
        </button>
        <a href="certifications.php" class="btn btn-outline-secondary py-2 px-4"><?php echo $t['user_cancel_btn']; ?></a>
    </div>
</form>