@php($settings = $settings ?? [])
<div class="modal fade" id="integration-modal-discord" tabindex="-1" aria-hidden="true"
     data-integration-modal data-integration-id="discord">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><i class="fab fa-discord me-2"></i>Discord</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <p class="text-muted small">
                    Create a webhook from your server's channel settings (Integrations -> Webhooks) and paste the URL below.
                </p>
                <div class="mb-3">
                    <label class="form-label">{{ __('admin/settings.integrations_discord_webhook') }}</label>
                    <input type="password" class="form-control" name="discord_admin_webhook" form="settingsForm"
                           value="{{ $settings['discord_admin_webhook'] ?? '' }}"
                           placeholder="https://discord.com/api/webhooks/...">
                    <div class="form-text small">{{ __('admin/settings.integrations_discord_webhook_hint') }}</div>
                </div>
            </div>
            <div class="modal-footer">
                <div class="border-top pt-3 mt-1 w-100">
                    <div class="d-flex justify-content-between align-items-start gap-3">
                        <div class="flex-shrink-0">
                            <button type="button" class="btn btn-sm btn-outline-primary" data-integration-test="discord">
                                <i class="fas fa-plug me-1"></i> {{ __('admin/settings.test_connection') }}
                            </button>
                            <small class="text-warning d-block mt-1">
                                <i class="fas fa-exclamation-triangle me-1"></i>{{ __('admin/settings.test_connection_discord_warning') }}
                            </small>
                        </div>
                        <div class="integration-test-result small text-end"></div>
                    </div>
                </div>
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
                    {{ __('admin/settings.integrations_modal_close') }}
                </button>
            </div>
        </div>
    </div>
</div>
