@extends('layouts.admin')

@section('title', 'Create Plan')

@section('content')
<div class="min-h-screen bg-slate-50">
    <div class="mx-auto max-w-4xl px-4 py-6 sm:px-6 lg:px-8">

        <div class="mb-6 flex items-center justify-between">
            <div>
                <h1 class="text-2xl font-bold text-slate-800 md:text-3xl">Create New Plan</h1>
                <p class="mt-1 text-sm text-slate-500">
                    নতুন সাবস্ক্রিপশন প্ল্যান যোগ করুন।
                </p>
            </div>

            <a href="{{ route('plans.index') }}"
               class="inline-flex items-center rounded-2xl border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700 shadow-sm transition hover:bg-slate-50">
                ← Back
            </a>
        </div>

        <div class="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm">
            <form action="{{ route('plans.store') }}" method="POST" class="space-y-6">
                @csrf

                <div>
                    <label class="mb-2 block text-sm font-semibold text-slate-700">Plan Name <span class="text-rose-500">*</span></label>
                    <input type="text"
                           name="name"
                           value="{{ old('name') }}"
                           placeholder="e.g. Basic Plan"
                           class="w-full rounded-xl border border-slate-300 px-4 py-3 text-sm outline-none transition focus:border-blue-500">
                    @error('name')
                        <p class="mt-1 text-sm text-rose-600">{{ $message }}</p>
                    @enderror
                </div>

                <div class="grid grid-cols-1 gap-6 md:grid-cols-2">
                    <div>
                        <label class="mb-2 block text-sm font-semibold text-slate-700">Price <span class="text-rose-500">*</span></label>
                        <input type="number"
                               step="0.01"
                               min="0"
                               name="price"
                               value="{{ old('price') }}"
                               placeholder="e.g. 500"
                               class="w-full rounded-xl border border-slate-300 px-4 py-3 text-sm outline-none transition focus:border-blue-500">
                        @error('price')
                            <p class="mt-1 text-sm text-rose-600">{{ $message }}</p>
                        @enderror
                    </div>

                    <div>
                        <label class="mb-2 block text-sm font-semibold text-slate-700">Duration Days <span class="text-rose-500">*</span></label>
                        <input type="number"
                               min="1"
                               name="duration_days"
                               value="{{ old('duration_days') }}"
                               placeholder="e.g. 30"
                               class="w-full rounded-xl border border-slate-300 px-4 py-3 text-sm outline-none transition focus:border-blue-500">
                        @error('duration_days')
                            <p class="mt-1 text-sm text-rose-600">{{ $message }}</p>
                        @enderror
                    </div>
                </div>

                <div class="grid grid-cols-1 gap-6 md:grid-cols-2">
                    <div class="rounded-2xl border border-slate-200 p-4">
                        <label class="flex items-center gap-3">
                            <input type="checkbox"
                                   name="is_trial"
                                   value="1"
                                   {{ old('is_trial') ? 'checked' : '' }}
                                   class="h-5 w-5 rounded border-slate-300 text-blue-600 focus:ring-blue-500">
                            <div>
                                <p class="text-sm font-semibold text-slate-800">Trial Plan</p>
                                <p class="text-xs text-slate-500">চেক করলে এই প্ল্যান Trial হিসেবে গণ্য হবে।</p>
                            </div>
                        </label>
                    </div>

                    <div class="rounded-2xl border border-slate-200 p-4">
                        <label class="flex items-center gap-3">
                            <input type="checkbox"
                                   name="status"
                                   value="1"
                                   {{ old('status', 1) ? 'checked' : '' }}
                                   class="h-5 w-5 rounded border-slate-300 text-blue-600 focus:ring-blue-500">
                            <div>
                                <p class="text-sm font-semibold text-slate-800">Active Status</p>
                                <p class="text-xs text-slate-500">চেক থাকলে প্ল্যান Active থাকবে।</p>
                            </div>
                        </label>
                    </div>
                </div>

                <div class="flex items-center gap-3 pt-2">
                    <button type="submit"
                            class="inline-flex items-center rounded-2xl bg-blue-600 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-700">
                        Save Plan
                    </button>

                    <a href="{{ route('plans.index') }}"
                       class="inline-flex items-center rounded-2xl border border-slate-300 bg-white px-6 py-3 text-sm font-semibold text-slate-700 transition hover:bg-slate-50">
                        Cancel
                    </a>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection