<?php ob_start(); ?>

<h2><?= __('installer.db_title') ?></h2>
<p><?= __('installer.db_text') ?></p>

<?php if (!empty($error)): ?>
<div class="alert alert-error"><?= e($error) ?></div>
<?php endif; ?>

<form method="POST" action="/installer/step/3">
    <div class="form-group">
        <label for="db_host"><?= __('installer.db_host') ?></label>
        <input type="text" id="db_host" name="db_host" value="<?= e($dbConfig['host'] ?? '127.0.0.1') ?>" required>
    </div>
    <div class="form-group">
        <label for="db_port"><?= __('installer.db_port') ?></label>
        <input type="text" id="db_port" name="db_port" value="<?= e($dbConfig['port'] ?? '3306') ?>" required>
    </div>
    <div class="form-group">
        <label for="db_name"><?= __('installer.db_name') ?></label>
        <input type="text" id="db_name" name="db_name" value="<?= e($dbConfig['name'] ?? '') ?>" required>
    </div>
    <div class="form-group">
        <label for="db_user"><?= __('installer.db_user') ?></label>
        <input type="text" id="db_user" name="db_user" value="<?= e($dbConfig['user'] ?? '') ?>" required>
    </div>
    <div class="form-group">
        <label for="db_password"><?= __('installer.db_password') ?></label>
        <input type="password" id="db_password" name="db_password" value="<?= e($dbConfig['password'] ?? '') ?>">
    </div>
    <div class="form-group">
        <label for="db_prefix"><?= __('installer.db_prefix') ?></label>
        <input type="text" id="db_prefix" value="iw_" disabled style="opacity:0.6;">
        <input type="hidden" name="db_prefix" value="iw_">
        <small><?= __('installer.db_prefix_note') ?></small>
    </div>

    <div class="step-actions">
        <a href="/installer/step/2" class="btn btn-secondary"><?= __('installer.db_back') ?></a>
        <button type="submit" class="btn btn-primary"><?= __('installer.db_continue') ?></button>
    </div>
</form>

<?php $content = ob_get_clean(); include __DIR__ . '/layout.php'; ?>
