<?php $title = 'Upload Document'; ?>
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-white font-weight-bold"><i class="fas fa-upload mr-2"></i>Upload Document</h1>
</div>
<div class="glass-card">
    <form method="POST" action="<?= $baseUrl ?>/documents/store" enctype="multipart/form-data">
        <div class="form-group">
            <label style="color: rgba(255,255,255,0.7);">Title</label>
            <input type="text" name="title" class="form-control glass-input" required>
        </div>
        <div class="form-group">
            <label style="color: rgba(255,255,255,0.7);">Description</label>
            <textarea name="description" class="form-control glass-input" rows="3"></textarea>
        </div>
        <div class="row">
            <div class="col-md-6 form-group">
                <label style="color: rgba(255,255,255,0.7);">Category</label>
                <select name="category_id" class="form-control glass-input">
                    <option value="">No Category</option>
                    <?php if (!empty($categories)): ?>
                        <?php foreach ($categories as $cat): ?>
                        <option value="<?= $cat->id ?>"><?= htmlspecialchars($cat->name) ?></option>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </select>
            </div>
            <div class="col-md-6 form-group">
                <label style="color: rgba(255,255,255,0.7);">File</label>
                <input type="file" name="file" class="form-control glass-input" required>
            </div>
        </div>
        <div class="custom-control custom-checkbox mb-3">
            <input type="checkbox" class="custom-control-input" id="is_public" name="is_public" value="1">
            <label class="custom-control-label" for="is_public" style="color: rgba(255,255,255,0.7);">Make this document public</label>
        </div>
        <div class="text-right">
            <a href="<?= $baseUrl ?>/documents" class="glass-btn mr-2">Cancel</a>
            <button type="submit" class="glass-btn glass-btn-primary"><i class="fas fa-upload mr-1"></i>Upload</button>
        </div>
    </form>
</div>
