@php($settings = $settings ?? [])
<div class="modal fade" id="integration-modal-segment" tabindex="-1" aria-hidden="true"
     data-integration-modal data-integration-id="segment">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><i class="fas fa-random me-2"></i>Segment</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <div class="mb-3">
                    <label class="form-label">{{ __('admin/settings.integrations_segment_write_key_label') }}</label>
                    <input type="password" class="form-control" name="segment_write_key" form="settingsForm"
                           value="{{ $settings['segment_write_key'] ?? '' }}" placeholder="Write Key">
                    <div class="form-text small">{{ __('admin/settings.integrations_segment_write_key_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="segment">
                                <i class="fas fa-plug me-1"></i> {{ __('admin/settings.test_connection') }}
                            </button>
                        </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>
