<x-app-layout>
    <x-module-hero
        :title="'Edit Programme: ' . $programme->title"
        :description="$programme->title"
        icon="fa-edit">

        <x-slot name="backButton">
            <a href="{{ route('mentorship.programmes.show', $programme) }}"
               class="inline-flex items-center gap-1 text-sm text-[#475569] hover:text-[#1e293b] transition-colors">
                <i class="fas fa-arrow-left text-xs"></i> Back to Programme
            </a>
        </x-slot>

        <x-slot name="tabs">
            @can('view mentorship programmes')
                <a href="{{ route('mentorship.programmes.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.programmes.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-list text-sm"></i> Programmes
                </a>
            @endcan
            @can('view mentorship applications')
                <a href="{{ route('mentorship.applications.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.applications.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-file-alt text-sm"></i> Applications
                </a>
            @endcan
            @cannot('view mentorship applications')
                @can('view own mentorship applications')
                    <a href="{{ route('mentorship.applications.index') }}"
                       class="module-hero-tab {{ request()->routeIs('mentorship.applications.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                        <i class="fas fa-file-alt text-sm"></i> My Applications
                    </a>
                @endcan
            @endcannot
            @can('view mentorship assignments')
                <a href="{{ route('mentorship.assignments.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.assignments.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-link text-sm"></i> Assignments
                </a>
            @endcan
            @can('view mentorship sessions')
                <a href="{{ route('mentorship.sessions.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.sessions.index') || request()->routeIs('mentorship.sessions.show') || request()->routeIs('mentorship.sessions.create') || request()->routeIs('mentorship.sessions.edit') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-calendar-alt text-sm"></i> Sessions
                </a>
                <a href="{{ route('mentorship.sessions.calendar') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.sessions.calendar') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-calendar text-sm"></i> Sessions Calendar
                </a>
            @endcan
            @can('view mentorship certificates')
                <a href="{{ route('mentorship.certificates.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.certificates.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-certificate text-sm"></i> Certificates
                </a>
            @endcan
            @can('download mentorship certificates')
                @cannot('view mentorship certificates')
                    <a href="{{ route('mentorship.certificates.my-certificates') }}"
                       class="module-hero-tab {{ request()->routeIs('mentorship.certificates.my-certificates') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                        <i class="fas fa-award text-sm"></i> My Certificates
                    </a>
                @endcannot
            @endcan
            @can('view mentorship payments')
                <a href="{{ route('mentorship.payments.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.payments.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-credit-card text-sm"></i> Payments
                </a>
            @endcan
            @can('view own mentorship payments')
                @cannot('view mentorship payments')
                    <a href="{{ route('mentorship.payments.my-payments') }}"
                       class="module-hero-tab {{ request()->routeIs('mentorship.payments.my-payments') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                        <i class="fas fa-history text-sm"></i> My Payments
                    </a>
                @endcannot
            @endcan
            @can('view mentorship categories')
                <a href="{{ route('mentorship.categories.index') }}"
                   class="module-hero-tab {{ request()->routeIs('mentorship.categories.*') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }} inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                    <i class="fas fa-folder text-sm"></i> Categories
                </a>
            @endcan
        </x-slot>

        <x-slot name="actions">
            @can('view mentorship programmes')
                <a href="{{ route('mentorship.programmes.show', $programme) }}"
                   class="inline-flex items-center gap-2 px-4 py-2 bg-white text-green-800 text-sm font-medium rounded hover:bg-green-50 transition-colors">
                    <i class="fas fa-eye"></i> View
                </a>
            @endcan
        </x-slot>
    </x-module-hero>

    <div class="p-6">
        @if($errors->any())
            <div class="mb-4 p-4 bg-red-50 border border-red-200 rounded-lg">
                <div class="flex items-center gap-2 mb-2">
                    <i class="fas fa-exclamation-triangle text-red-500"></i>
                    <h4 class="font-medium text-red-800">Please fix the following errors:</h4>
                </div>
                <ul class="text-sm text-red-600 list-disc list-inside">
                    @foreach($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <form action="{{ route('mentorship.programmes.update', $programme) }}" method="POST" x-data="programmeForm()">
            @csrf
            @method('PUT')

            {{-- Step Indicator --}}
            <div class="mb-6 bg-white rounded-lg border border-gray-200 p-4">
                <div class="flex items-center justify-between mb-2">
                    <span class="text-sm font-medium text-gray-700">Step <span x-text="currentStep"></span> of <span x-text="totalSteps"></span></span>
                    <span class="text-sm font-medium text-green-600" x-text="Math.round((currentStep / totalSteps) * 100) + '%'"></span>
                </div>
                <div class="w-full bg-gray-200 rounded-full h-2">
                    <div class="bg-green-600 h-2 rounded-full transition-all duration-300"
                         :style="'width: ' + ((currentStep / totalSteps) * 100) + '%'"></div>
                </div>
                <div class="flex flex-wrap gap-2 mt-3">
                    <button type="button" @click="currentStep = 1"
                            :class="currentStep === 1 ? 'bg-green-600 text-white' : 'bg-gray-100 text-gray-700 hover:bg-gray-200'"
                            class="px-3 py-1.5 rounded-lg text-sm transition">
                        <i class="fas fa-info-circle mr-1"></i> Basic Info
                    </button>
                    <button type="button" @click="currentStep = 2"
                            :class="currentStep === 2 ? 'bg-green-600 text-white' : 'bg-gray-100 text-gray-700 hover:bg-gray-200'"
                            class="px-3 py-1.5 rounded-lg text-sm transition">
                        <i class="fas fa-align-left mr-1"></i> Description
                    </button>
                    <button type="button" @click="currentStep = 3"
                            :class="currentStep === 3 ? 'bg-green-600 text-white' : 'bg-gray-100 text-gray-700 hover:bg-gray-200'"
                            class="px-3 py-1.5 rounded-lg text-sm transition">
                        <i class="fas fa-calendar mr-1"></i> Schedule
                    </button>
                    <button type="button" @click="currentStep = 4"
                            :class="currentStep === 4 ? 'bg-green-600 text-white' : 'bg-gray-100 text-gray-700 hover:bg-gray-200'"
                            class="px-3 py-1.5 rounded-lg text-sm transition">
                        <i class="fas fa-cog mr-1"></i> Settings
                    </button>
                </div>
            </div>

            {{-- Step 1: Basic Info --}}
            <div x-show="currentStep === 1" x-transition class="bg-white rounded-lg border border-gray-200 p-6 mb-4">
                <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                    <i class="fas fa-info-circle mr-2 text-green-600"></i> Basic Information
                </h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <div class="md:col-span-2">
                        <label for="title" class="block text-sm font-medium text-gray-700 mb-1">
                            Programme Title <span class="text-red-500">*</span>
                        </label>
                        <input type="text" id="title" name="title" value="{{ old('title', $programme->title) }}"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500" required>
                        @error('title')<p class="mt-1 text-xs text-red-600">{{ $message }}</p>@enderror
                    </div>
                    <div>
                        <label for="category_id" class="block text-sm font-medium text-gray-700 mb-1">
                            Category <span class="text-red-500">*</span>
                        </label>
                        <select id="category_id" name="category_id"
                                class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500" required>
                            <option value="">Select a category</option>
                            @foreach($categories as $category)
                                <option value="{{ $category->id }}" {{ old('category_id', $programme->category_id) == $category->id ? 'selected' : '' }}>
                                    {{ $category->name }}
                                </option>
                            @endforeach
                        </select>
                        @error('category_id')<p class="mt-1 text-xs text-red-600">{{ $message }}</p>@enderror
                    </div>
                    <div>
                        <label for="programme_type" class="block text-sm font-medium text-gray-700 mb-1">Programme Type</label>
                        <select id="programme_type" name="programme_type"
                                class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                            <option value="one_on_one" {{ old('programme_type', $programme->programme_type) === 'one_on_one' ? 'selected' : '' }}>One-on-One</option>
                            <option value="group" {{ old('programme_type', $programme->programme_type) === 'group' ? 'selected' : '' }}>Group</option>
                            <option value="hybrid" {{ old('programme_type', $programme->programme_type) === 'hybrid' ? 'selected' : '' }}>Hybrid</option>
                            <option value="structured" {{ old('programme_type', $programme->programme_type) === 'structured' ? 'selected' : '' }}>Structured</option>
                            <option value="self_paced" {{ old('programme_type', $programme->programme_type) === 'self_paced' ? 'selected' : '' }}>Self-Paced</option>
                            <option value="cohort" {{ old('programme_type', $programme->programme_type) === 'cohort' ? 'selected' : '' }}>Cohort-Based</option>
                        </select>
                    </div>
                    <div>
                        <label for="duration_weeks" class="block text-sm font-medium text-gray-700 mb-1">Duration (Weeks)</label>
                        <input type="number" id="duration_weeks" name="duration_weeks" value="{{ old('duration_weeks', $programme->duration_weeks) }}" min="1"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                    <div>
                        <label for="sessions_count" class="block text-sm font-medium text-gray-700 mb-1">Expected Sessions</label>
                        <input type="number" id="sessions_count" name="sessions_count" value="{{ old('sessions_count', $programme->sessions_count) }}" min="1"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                </div>
            </div>

            {{-- Step 2: Description --}}
            <div x-show="currentStep === 2" x-transition class="bg-white rounded-lg border border-gray-200 p-6 mb-4">
                <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                    <i class="fas fa-align-left mr-2 text-green-600"></i> Description & Details
                </h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <div class="md:col-span-2">
                        <label for="description" class="block text-sm font-medium text-gray-700 mb-1">
                            Description <span class="text-red-500">*</span>
                        </label>
                        <textarea id="description" name="description" rows="4"
                                  class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500" required>{{ old('description', $programme->description) }}</textarea>
                        @error('description')<p class="mt-1 text-xs text-red-600">{{ $message }}</p>@enderror
                    </div>
                    <div>
                        <label for="objectives" class="block text-sm font-medium text-gray-700 mb-1">Learning Objectives</label>
                        <textarea id="objectives" name="objectives" rows="4"
                                  class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">{{ old('objectives', $programme->objectives) }}</textarea>
                    </div>
                    <div>
                        <label for="requirements" class="block text-sm font-medium text-gray-700 mb-1">Requirements</label>
                        <textarea id="requirements" name="requirements" rows="4"
                                  class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">{{ old('requirements', $programme->requirements) }}</textarea>
                    </div>
                    <div class="md:col-span-2">
                        <label for="target_audience" class="block text-sm font-medium text-gray-700 mb-1">Target Audience</label>
                        <textarea id="target_audience" name="target_audience" rows="3"
                                  class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">{{ old('target_audience', $programme->target_audience) }}</textarea>
                    </div>
                </div>
            </div>

            {{-- Step 3: Schedule --}}
            <div x-show="currentStep === 3" x-transition class="bg-white rounded-lg border border-gray-200 p-6 mb-4">
                <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                    <i class="fas fa-calendar mr-2 text-green-600"></i> Schedule & Dates
                </h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <div>
                        <label for="registration_start" class="block text-sm font-medium text-gray-700 mb-1">Registration Start</label>
                        <input type="datetime-local" id="registration_start" name="registration_start"
                               value="{{ old('registration_start', $programme->registration_start?->format('Y-m-d\TH:i')) }}"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                    <div>
                        <label for="registration_end" class="block text-sm font-medium text-gray-700 mb-1">Registration End</label>
                        <input type="datetime-local" id="registration_end" name="registration_end"
                               value="{{ old('registration_end', $programme->registration_end?->format('Y-m-d\TH:i')) }}"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                    <div>
                        <label for="programme_start" class="block text-sm font-medium text-gray-700 mb-1">Programme Start</label>
                        <input type="datetime-local" id="programme_start" name="programme_start"
                               value="{{ old('programme_start', $programme->programme_start?->format('Y-m-d\TH:i')) }}"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                    <div>
                        <label for="programme_end" class="block text-sm font-medium text-gray-700 mb-1">Programme End</label>
                        <input type="datetime-local" id="programme_end" name="programme_end"
                               value="{{ old('programme_end', $programme->programme_end?->format('Y-m-d\TH:i')) }}"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                    <div>
                        <label for="session_type" class="block text-sm font-medium text-gray-700 mb-1">Session Type</label>
                        <select id="session_type" name="session_type"
                                class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                            <option value="online" {{ old('session_type', $programme->session_type) === 'online' ? 'selected' : '' }}>Online Only</option>
                            <option value="in_person" {{ old('session_type', $programme->session_type) === 'in_person' ? 'selected' : '' }}>In-Person Only</option>
                            <option value="hybrid" {{ old('session_type', $programme->session_type) === 'hybrid' ? 'selected' : '' }}>Hybrid</option>
                        </select>
                    </div>
                    <div>
                        <label for="venue" class="block text-sm font-medium text-gray-700 mb-1">Venue (in-person)</label>
                        <input type="text" id="venue" name="venue" value="{{ old('venue', $programme->venue) }}"
                               class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                    </div>
                </div>
            </div>

            {{-- Step 4: Settings --}}
            <div x-show="currentStep === 4" x-transition class="space-y-4 mb-4">
                <div class="bg-white rounded-lg border border-gray-200 p-6">
                    <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                        <i class="fas fa-money-bill mr-2 text-green-600"></i> Fee Configuration
                    </h3>
                    <div class="mb-4">
                        <label class="flex items-center gap-2 cursor-pointer">
                            <input type="checkbox" id="is_free" name="is_free" value="1"
                                   {{ old('is_free', $programme->is_free) ? 'checked' : '' }}
                                   class="w-4 h-4 text-green-600 border-gray-300 rounded focus:ring-green-500"
                                   x-model="isFree">
                            <span class="text-sm text-gray-700">This is a free programme</span>
                        </label>
                    </div>
                    <div x-show="!isFree" class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div>
                            <label for="fee_amount" class="block text-sm font-medium text-gray-700 mb-1">Fee Amount</label>
                            <input type="number" id="fee_amount" name="fee_amount" value="{{ old('fee_amount', $programme->fee_amount) }}" step="0.01" min="0"
                                   class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                        </div>
                        <div>
                            <label for="currency" class="block text-sm font-medium text-gray-700 mb-1">Currency</label>
                            <select id="currency" name="currency"
                                    class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                                <option value="UGX" {{ old('currency', $programme->currency) === 'UGX' ? 'selected' : '' }}>UGX</option>
                                <option value="USD" {{ old('currency', $programme->currency) === 'USD' ? 'selected' : '' }}>USD</option>
                                <option value="KES" {{ old('currency', $programme->currency) === 'KES' ? 'selected' : '' }}>KES</option>
                            </select>
                        </div>
                        <div>
                            <label for="fee_description" class="block text-sm font-medium text-gray-700 mb-1">Fee Description</label>
                            <input type="text" id="fee_description" name="fee_description" value="{{ old('fee_description', $programme->fee_description) }}"
                                   class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                        </div>
                    </div>
                </div>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div class="bg-white rounded-lg border border-gray-200 p-6">
                        <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                            <i class="fas fa-users mr-2 text-green-600"></i> Capacity
                        </h3>
                        <div class="grid grid-cols-2 gap-4">
                            <div>
                                <label for="max_mentees" class="block text-sm font-medium text-gray-700 mb-1">Max Mentees</label>
                                <input type="number" id="max_mentees" name="max_mentees" value="{{ old('max_mentees', $programme->max_mentees) }}" min="1"
                                       class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                            </div>
                            <div>
                                <label for="max_mentors" class="block text-sm font-medium text-gray-700 mb-1">Max Mentors</label>
                                <input type="number" id="max_mentors" name="max_mentors" value="{{ old('max_mentors', $programme->max_mentors) }}" min="1"
                                       class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                            </div>
                        </div>
                    </div>
                    <div class="bg-white rounded-lg border border-gray-200 p-6">
                        <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                            <i class="fas fa-certificate mr-2 text-green-600"></i> Certificate
                        </h3>
                        <div class="mb-3">
                            <label class="flex items-center gap-2 cursor-pointer">
                                <input type="checkbox" id="certificate_enabled" name="certificate_enabled" value="1"
                                       {{ old('certificate_enabled', $programme->certificate_enabled) ? 'checked' : '' }}
                                       class="w-4 h-4 text-green-600 border-gray-300 rounded focus:ring-green-500">
                                <span class="text-sm text-gray-700">Enable certificate generation</span>
                            </label>
                        </div>
                        <div>
                            <label for="certificate_orientation" class="block text-sm font-medium text-gray-700 mb-1">Orientation</label>
                            <select id="certificate_orientation" name="certificate_orientation"
                                    class="w-full border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500">
                                <option value="landscape" {{ old('certificate_orientation', $programme->certificate_orientation) === 'landscape' ? 'selected' : '' }}>Landscape</option>
                                <option value="portrait" {{ old('certificate_orientation', $programme->certificate_orientation) === 'portrait' ? 'selected' : '' }}>Portrait</option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-lg border border-gray-200 p-6">
                    <h3 class="text-lg font-semibold text-gray-800 border-b pb-2 mb-4">
                        <i class="fas fa-toggle-on mr-2 text-green-600"></i> Status
                    </h3>
                    <div class="flex flex-wrap gap-6">
                        <label class="flex items-center gap-2 cursor-pointer">
                            <input type="checkbox" name="is_active" value="1"
                                   {{ old('is_active', $programme->is_active) ? 'checked' : '' }}
                                   class="w-4 h-4 text-green-600 border-gray-300 rounded focus:ring-green-500">
                            <span class="text-sm text-gray-700">Programme is active</span>
                        </label>
                        <label class="flex items-center gap-2 cursor-pointer">
                            <input type="checkbox" name="is_featured" value="1"
                                   {{ old('is_featured', $programme->is_featured) ? 'checked' : '' }}
                                   class="w-4 h-4 text-green-600 border-gray-300 rounded focus:ring-green-500">
                            <span class="text-sm text-gray-700">Featured programme</span>
                        </label>
                    </div>
                </div>
            </div>

            {{-- Navigation Buttons --}}
            <div class="flex justify-between items-center bg-white rounded-lg border border-gray-200 p-4">
                <button type="button" @click="previousStep()" x-show="currentStep > 1"
                        class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition text-sm">
                    <i class="fas fa-arrow-left mr-1"></i> Previous
                </button>
                <div x-show="currentStep <= 1"></div>
                <div class="flex gap-2">
                    <button type="button" @click="nextStep()" x-show="currentStep < totalSteps"
                            class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition text-sm">
                        Next <i class="fas fa-arrow-right ml-1"></i>
                    </button>
                    <button type="submit" x-show="currentStep === totalSteps"
                            class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition text-sm">
                        <i class="fas fa-save mr-1"></i> Update Programme
                    </button>
                </div>
            </div>
        </form>
    </div>

    @push('scripts')
    <script>
        function programmeForm() {
            return {
                currentStep: 1,
                totalSteps: 4,
                isFree: {{ old('is_free', $programme->is_free) ? 'true' : 'false' }},
                nextStep() { if (this.currentStep < this.totalSteps) this.currentStep++; },
                previousStep() { if (this.currentStep > 1) this.currentStep--; },
            };
        }
    </script>
    @endpush
</x-app-layout>
