<?php $item = $row ?? null; ?>
<div class="row g-3">
    <div class="col-md-4">
        <label class="form-label ec-required"><?= e(trans('conference')) ?></label>
        <select name="conference_id" class="form-select rounded-3" required>
            <option value="0">--</option>
            <?php foreach ($conferences as $c): ?>
                <option value="<?= e((string) $c['id']) ?>" <?= ((int) ($item['conference_id'] ?? ($_GET['conference_id'] ?? 0)) === (int) $c['id']) ? 'selected' : '' ?>>
                    <?= e(current_lang() === 'ar' ? (string) $c['title_ar'] : (string) $c['title_en']) ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="col-md-4">
        <label class="form-label"><?= e(trans('criterion_key')) ?></label>
        <input type="text" name="criterion_key" class="form-control rounded-3" value="<?= e((string) ($item['criterion_key'] ?? '')) ?>" required>
    </div>
    <div class="col-md-4">
        <label class="form-label"><?= e(trans('sort_order')) ?></label>
        <input type="number" name="sort_order" class="form-control rounded-3" value="<?= e((string) ($item['sort_order'] ?? 0)) ?>">
    </div>

    <div class="col-md-6">
        <label class="form-label"><?= e(trans('criterion_title_en')) ?></label>
        <input type="text" name="title_en" class="form-control rounded-3" value="<?= e((string) ($item['title_en'] ?? '')) ?>" required>
    </div>
    <div class="col-md-6">
        <label class="form-label"><?= e(trans('criterion_title_ar')) ?></label>
        <input type="text" name="title_ar" class="form-control rounded-3" value="<?= e((string) ($item['title_ar'] ?? '')) ?>" required>
    </div>

    <div class="col-md-6">
        <label class="form-label">Description EN</label>
        <textarea name="description_en" class="form-control rounded-3 richtext" rows="5"><?= e((string) ($item['description_en'] ?? '')) ?></textarea>
    </div>
    <div class="col-md-6">
        <label class="form-label">Description AR</label>
        <textarea name="description_ar" class="form-control rounded-3 richtext" rows="5"><?= e((string) ($item['description_ar'] ?? '')) ?></textarea>
    </div>

    <div class="col-md-4">
        <label class="form-label">Min Score</label>
        <input type="number" step="0.01" name="min_score" class="form-control rounded-3" value="<?= e((string) ($item['min_score'] ?? 1)) ?>">
    </div>
    <div class="col-md-4">
        <label class="form-label">Max Score</label>
        <input type="number" step="0.01" name="max_score" class="form-control rounded-3" value="<?= e((string) ($item['max_score'] ?? 5)) ?>">
    </div>
    <div class="col-md-4">
        <label class="form-label">Weight</label>
        <input type="number" step="0.01" name="weight" class="form-control rounded-3" value="<?= e((string) ($item['weight'] ?? 1)) ?>">
    </div>

    <div class="col-md-12">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="is_active" <?= !isset($item) || !empty($item['is_active']) ? 'checked' : '' ?>>
            <label class="form-check-label"><?= e(trans('is_active')) ?></label>
        </div>
    </div>
</div>
