@extends('admin.layouts.app')

@section('title', 'Шинэ үйлчилгээ')
@section('page_title', 'Шинэ үйлчилгээ нэмэх')

@section('content')

<form action="{{ route('admin.services.store') }}" method="POST" enctype="multipart/form-data" class="max-w-3xl bg-white rounded-2xl border border-gray-100 p-6 lg:p-8 space-y-5">
    @csrf

    <div>
        <label class="block text-sm font-semibold mb-1">Үйлчилгээний нэр <span class="text-nsma-red">*</span></label>
        <input type="text" name="title" value="{{ old('title') }}" required class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none focus:border-nsma-red">
    </div>

    <div>
        <label class="block text-sm font-semibold mb-1">Богино тайлбар</label>
        <textarea name="short_description" rows="2" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none focus:border-nsma-red">{{ old('short_description') }}</textarea>
    </div>

    <div>
        <label class="block text-sm font-semibold mb-1">Дэлгэрэнгүй тайлбар</label>
        <textarea name="description" rows="4" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none focus:border-nsma-red">{{ old('description') }}</textarea>
    </div>

    <div>
        <label class="block text-sm font-semibold mb-1">Бүтэн контент (HTML)</label>
        <textarea name="full_content" rows="8" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none focus:border-nsma-red font-mono text-sm">{{ old('full_content') }}</textarea>
    </div>

    <div>
        <label class="block text-sm font-semibold mb-1">Онцлог (мөр бүр нэг шинж)</label>
        <textarea name="features" rows="4" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none focus:border-nsma-red">{{ old('features') }}</textarea>
    </div>

    <div class="grid md:grid-cols-2 gap-4">
        <div>
            <label class="block text-sm font-semibold mb-1">Дүрс зураг (icon)</label>
            <input type="file" name="icon_image" accept="image/*" class="w-full">
        </div>
        <div>
            <label class="block text-sm font-semibold mb-1">Cover зураг</label>
            <input type="file" name="cover_image" accept="image/*" class="w-full">
        </div>
    </div>

    <div class="grid md:grid-cols-3 gap-4">
        <div>
            <label class="block text-sm font-semibold mb-1">Эрэмбэ</label>
            <input type="number" name="sort_order" value="{{ old('sort_order', 0) }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
        </div>
        <div class="flex items-end">
            <label class="flex items-center gap-2 pb-3"><input type="hidden" name="is_active" value="0"><input type="checkbox" name="is_active" value="1" checked class="rounded"> Идэвхтэй</label>
        </div>
        <div class="flex items-end">
            <label class="flex items-center gap-2 pb-3"><input type="hidden" name="show_on_home" value="0"><input type="checkbox" name="show_on_home" value="1" checked class="rounded"> Нүүр хуудсанд</label>
        </div>
    </div>

    <div class="border-t border-gray-100 pt-5">
        <h3 class="font-semibold mb-3">SEO</h3>
        <div class="space-y-3">
            <input type="text" name="meta_title" placeholder="Meta title" value="{{ old('meta_title') }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            <textarea name="meta_description" placeholder="Meta description" rows="2" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">{{ old('meta_description') }}</textarea>
        </div>
    </div>

    <div class="flex items-center gap-3 pt-4 border-t border-gray-100">
        <button type="submit" class="bg-nsma-red text-white font-semibold px-6 py-3 rounded-lg hover:bg-red-600">Хадгалах</button>
        <a href="{{ route('admin.services.index') }}" class="text-gray-600">Цуцлах</a>
    </div>
</form>

@endsection
