<div class="d-flex justify-content-between align-items-center mb-4">
    <h2><i class="bi bi-plus-lg"></i> Nieuwe pagina</h2>
    <a href="admin.php?route=content&dir=<?= urlencode($dir ?? '') ?>" class="btn btn-outline-secondary btn-sm">
        <i class="bi bi-arrow-left"></i> Terug
    </a>
</div>

<div class="card shadow-sm">
    <div class="card-body">
        <form method="POST" action="admin.php?route=content-new&dir=<?= urlencode($dir ?? '') ?>">
            <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
            <div class="row mb-3">
                <div class="col-md-8">
                    <label for="filename" class="form-label">Bestandsnaam</label>
                    <input type="text" class="form-control" id="filename" name="filename" placeholder="bijv. mijn-pagina" required>
                    <small class="form-text text-muted">Extensie wordt automatisch toegevoegd.</small>
                </div>
                <div class="col-md-4">
                    <label for="type" class="form-label">Type</label>
                    <select class="form-select" id="type" name="type">
                        <option value="md" selected>Markdown (.md)</option>
                        <option value="php">PHP (.php)</option>
                        <option value="html">HTML (.html)</option>
                    </select>
                </div>
            </div>
            <?php if (!empty($dir)): ?>
                <div class="mb-3">
                    <small class="text-muted">Map: <?= htmlspecialchars($dir) ?></small>
                </div>
            <?php endif; ?>
            <div class="mb-3">
                <label for="content" class="form-label">Inhoud</label>
                <textarea name="content" id="content" class="form-control font-monospace" rows="20" style="font-size: 0.9rem; tab-size: 4;" placeholder="# Mijn nieuwe pagina

Schrijf hier je inhoud..."></textarea>
            </div>
            <div class="d-flex gap-2">
                <button type="submit" class="btn btn-primary">
                    <i class="bi bi-check-lg"></i> Aanmaken
                </button>
                <a href="admin.php?route=content&dir=<?= urlencode($dir ?? '') ?>" class="btn btn-outline-secondary">Annuleren</a>
            </div>
        </form>
    </div>
</div>
