<?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>
            <?php foreach ($conferences as $c): ?>
                <option value="<?= e((string) $c['id']) ?>" <?= ((int) ($item['conference_id'] ?? ($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 ec-required"><?= e(trans('day_date')) ?></label>
        <select name="conference_day_id" class="form-select rounded-3" required>
            <?php foreach ($days as $d): ?>
                <option value="<?= e((string) $d['id']) ?>" <?= ((int) ($item['conference_day_id'] ?? 0) === (int) $d['id']) ? 'selected' : '' ?>>
                    <?= e((string) $d['day_date']) ?> — <?= e(current_lang() === 'ar' ? (string) ($d['title_ar'] ?: $d['title_en']) : (string) ($d['title_en'] ?: $d['title_ar'])) ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="col-md-4">
        <label class="form-label"><?= e(trans('tracks')) ?></label>
        <select name="track_id" class="form-select rounded-3">
            <option value="0">--</option>
            <?php foreach ($tracks as $t): ?>
                <option value="<?= e((string) $t['id']) ?>" <?= ((int) ($item['track_id'] ?? 0) === (int) $t['id']) ? 'selected' : '' ?>>
                    <?= e(current_lang() === 'ar' ? (string) ($t['name_ar'] ?? '') : (string) ($t['name_en'] ?? '')) ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>

    <div class="col-md-6"><label class="form-label"><?= e(trans('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('title_ar')) ?></label><input type="text" name="title_ar" class="form-control rounded-3" value="<?= e((string) ($item['title_ar'] ?? '')) ?>"></div>
    <div class="col-md-6"><label class="form-label"><?= e(trans('hall_en')) ?></label><input type="text" name="hall_en" class="form-control rounded-3" value="<?= e((string) ($item['hall_en'] ?? '')) ?>"></div>
    <div class="col-md-6"><label class="form-label"><?= e(trans('hall_ar')) ?></label><input type="text" name="hall_ar" class="form-control rounded-3" value="<?= e((string) ($item['hall_ar'] ?? '')) ?>"></div>
    <div class="col-md-6"><label class="form-label"><?= e(trans('chair_name_en')) ?></label><input type="text" name="chair_name_en" class="form-control rounded-3" value="<?= e((string) ($item['chair_name_en'] ?? '')) ?>"></div>
    <div class="col-md-6"><label class="form-label"><?= e(trans('chair_name_ar')) ?></label><input type="text" name="chair_name_ar" class="form-control rounded-3" value="<?= e((string) ($item['chair_name_ar'] ?? '')) ?>"></div>
    <div class="col-md-3"><label class="form-label"><?= e(trans('start_time')) ?></label><input type="time" name="start_time" class="form-control rounded-3" value="<?= e((string) ($item['start_time'] ?? '')) ?>"></div>
    <div class="col-md-3"><label class="form-label"><?= e(trans('end_time')) ?></label><input type="time" name="end_time" class="form-control rounded-3" value="<?= e((string) ($item['end_time'] ?? '')) ?>"></div>
    <div class="col-md-3">
        <label class="form-label"><?= e(trans('session_type')) ?></label>
        <select name="session_type" class="form-select rounded-3">
            <?php foreach (['opening','keynote','technical','panel','workshop','closing','other'] as $st): ?>
                <option value="<?= e($st) ?>" <?= (($item['session_type'] ?? 'technical') === $st) ? 'selected' : '' ?>><?= e(trans($st)) ?></option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="col-md-3"><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-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>
