{{-- Header --}}

{{ $campaignId ? __('Edit Campaign') : __('Create Campaign') }}

{{-- Step Progress --}}
@foreach([1 => __('Basics'), 2 => __('Content'), 3 => __('Audience'), 4 => __('Schedule')] as $step => $label) @if($step < 4)
@endif @endforeach
{{-- Step 1: Basics --}} @if($currentStep === 1) @if($channel === 'email') @endif

{{ __('Campaign Details') }}

{{-- ════════════════════════════════════════════════════════════════ CHANNEL PICKER — first decision in the wizard. Switching channels resets the conflicting fields (subject/body) and reshapes the rest of the editor (drag-drop builder for email vs plain text + Twilio number picker for SMS). ════════════════════════════════════════════════════════════════ --}}
@php $canSms = $planFeatures['sms_campaigns'] ?? false; @endphp
@error('channel')

{{ $message }}

@enderror
@error('name')

{{ $message }}

@enderror
@if($channel === 'email')
@error('subject')

{{ $message }}

@enderror
@else {{-- SMS path: Step 1 only collects channel + name. The Twilio number picker and message body live on Step 2 (content) to mirror the email flow's information density. --}}

{{ __('SMS Campaign:') }} {{ __('Next step lets you pick your Twilio number and write the message. Recipients are filtered to contacts who have a phone number on file.') }}

@endif {{-- A/B Test Fields --}} @if($type === 'ab_test')

{{ __('A/B Test Configuration') }}

@error('subjectA')

{{ $message }}

@enderror
@error('subjectB')

{{ $message }}

@enderror
A: {{ $splitPercentage }}% / B: {{ 100 - $splitPercentage }}%
@endif
@endif {{-- Step 2: Content --}} @if($currentStep === 2) @if($channel === 'sms') {{-- ════════════════════════════════════════════════════════════════ SMS CONTENT STEP Twilio number selector + plain-text body with live char counter and segment estimation. No drag-drop builder, no HTML, no preview pane — SMS is fundamentally a 160-char primitive. ════════════════════════════════════════════════════════════════ --}}

{{ __('SMS Content') }}

{{-- Twilio "From" number selector --}}
@if($smsNumbers->isEmpty())

{{ __('No active SMS integration found.') }}

{{ __('Connect a Twilio number first:') }} {{ __('Settings → Channels → SMS') }}

@else @error('fromNumber')

{{ $message }}

@enderror @endif
{{-- SMS body --}}
{{ __('chars') }} · {{ __('segment(s)') }} ({{ __('Unicode — 70/segment') }})

{{ __('Variables:') }} {first_name} {last_name} {full_name} {company} {phone} {email}

{{ __('Carriers split long SMS into multiple billed segments.') }}

@error('bodyText')

{{ $message }}

@enderror
@else {{-- Full-screen Email Builder Overlay. wire:key on both branches tells Livewire morphdom these are distinct DOM nodes. Without it, morphdom tried to mutate one into the other in-place, which occasionally collapsed the page layout (header + step wizard disappeared after the builder closed). --}} @if($showEmailBuilder)
@else

{{ __('Email Content') }}

{{-- Editor Mode Toggle --}}
@if($editorMode === 'visual') {{-- Visual Builder Mode --}}
@if($bodyHtml && !empty($bodyBlocks)) {{-- Content already built - show summary --}}

{{ __('Email content ready') }}

{{ count($bodyBlocks) }} block(s) built with the visual editor

{{-- Mini Preview. We pass the RAW $bodyHtml (not the sanitized version) so inline styles and