@extends('layouts.user')

@section('title', __('expenses_categories.create.page_title'))
@section('page_title', __('expenses_categories.create.page_title'))
@section('breadcrumb', __('expenses_categories.create.breadcrumb'))

@section('content')

{{-- ================= FULL WIDTH HEADER ================= --}}
<div class="w-full overflow-hidden border-b border-slate-300 bg-white shadow-sm">
    <div class="px-4 py-4 md:px-6 lg:px-8">
        <div class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">

            <div>
                <h3 class="text-sm font-bold text-slate-900">
                    {{ __('expenses_categories.create.header.title') }}
                </h3>
                <p class="mt-1 text-[11px] text-slate-500">
                    {{ __('expenses_categories.create.header.subtitle') }}
                </p>
            </div>

            <a href="{{ route('user.expense_categories.index') }}"
               class="inline-flex items-center justify-center border border-slate-300 bg-white px-3 py-2 text-xs font-semibold text-slate-700 transition hover:bg-slate-50">
                {{ __('expenses_categories.create.header.back_to_list') }}
            </a>

        </div>
    </div>
</div>

{{-- ================= CONTENT AREA ================= --}}
<div class="max-w-3xl mx-auto px-4 py-4 space-y-4">

    {{-- Form --}}
    <div class="border border-slate-300 bg-white p-4 shadow-sm md:p-5">
        <form action="{{ route('user.expense_categories.store') }}" method="POST" class="space-y-4">
            @csrf

            {{-- Category Name --}}
            <div>
                <label for="name" class="mb-1.5 block text-xs font-bold text-slate-800">
                    {{ __('expenses_categories.create.fields.name') }} <span class="text-rose-500">*</span>
                </label>

                <input type="text"
                       id="name"
                       name="name"
                       value="{{ old('name') }}"
                       placeholder="{{ __('expenses_categories.create.fields.name_placeholder') }}"
                       class="w-full border px-3 py-2 text-xs text-slate-800 outline-none transition
                              {{ $errors->has('name')
                                    ? 'border-rose-300 bg-rose-50 focus:border-rose-500'
                                    : 'border-slate-300 bg-white focus:border-slate-900' }}">

                @error('name')
                    <p class="mt-1.5 text-[11px] font-medium text-rose-600">{{ $message }}</p>
                @enderror

                <p class="mt-1.5 text-[11px] text-slate-500">
                    {{ __('expenses_categories.create.fields.name_hint') }}
                </p>
            </div>

            {{-- Actions --}}
            <div class="flex flex-wrap items-center gap-2 pt-1">
                <button type="submit"
                        class="inline-flex items-center justify-center border border-slate-900 bg-slate-900 px-4 py-2 text-xs font-bold text-white transition hover:bg-slate-800">
                    {{ __('expenses_categories.create.actions.save') }}
                </button>

                <a href="{{ route('user.expense_categories.index') }}"
                   class="inline-flex items-center justify-center border border-slate-300 bg-white px-4 py-2 text-xs font-semibold text-slate-700 transition hover:bg-slate-50">
                    {{ __('expenses_categories.create.actions.cancel') }}
                </a>
            </div>

        </form>
    </div>

</div>

@endsection