<?php $pageTitle = 'Create Lesson'; ?>
<div class="mb-3"><a href="<?= base_url('teacher/modules/' . $module['course_id'] ?? '') ?>" class="text-secondary"><i class="fas fa-arrow-left me-1"></i> Back to Modules</a></div>
<div class="card-cix">
    <div class="card-cix-header"><h5 class="mb-0"><i class="fas fa-plus-circle text-orange me-2"></i> New Lesson</h5></div>
    <?php if (!empty($error)): ?><div class="alert-cix alert-cix-error"><i class="fas fa-exclamation-circle"></i> <?= $error ?></div><?php endif; ?>
    <?php if (!empty($success)): ?><div class="alert-cix alert-cix-success"><i class="fas fa-check-circle"></i> <?= $success ?></div><?php endif; ?>
    <form method="POST" action="<?= base_url('teacher/lesson-create/' . ($module['course_id'] ?? 0) . '/' . $module['id']) ?>">
        <?= csrf_field() ?>
        <div class="row g-3">
            <div class="col-md-8"><div class="form-group-cix"><label class="form-label-cix">Title *</label><input type="text" name="title" class="form-control-cix" required></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Sort Order</label><input type="number" name="sort_order" class="form-control-cix" value="0"></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Lesson Type</label><select name="lesson_type" class="form-control-cix"><option value="text">Text</option><option value="video">Video</option><option value="pdf">PDF</option><option value="download">Download</option><option value="external_link">External Link</option><option value="mixed">Mixed</option></select></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Status</label><select name="is_published" class="form-control-cix"><option value="0">Draft</option><option value="1">Published</option></select></div></div>
            <div class="col-12"><div class="form-group-cix"><label class="form-label-cix">Content</label><textarea name="content" class="form-control-cix" rows="10" placeholder="Lesson content..."></textarea></div></div>
        </div>
        <button type="submit" class="btn-cix btn-cix-accent mt-2"><i class="fas fa-save"></i> Create Lesson</button>
    </form>
</div>
