@extends('admin.layouts.app')

@section('title', 'Тохиргоо')
@section('page_title', 'Сайтын тохиргоо')

@section('content')

<form action="{{ route('admin.settings.update') }}" 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-6">
    @csrf

    <div>
        <h3 class="font-bold mb-4 pb-2 border-b border-gray-100">Үндсэн</h3>
        <div class="space-y-4">
            <div>
                <label class="block text-sm font-semibold mb-1">Сайтын нэр</label>
                <input type="text" name="site_name" value="{{ $settings['site_name']->value ?? 'NSMA' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">Сайтын тагалзаар</label>
                <textarea name="site_description" rows="2" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">{{ $settings['site_description']->value ?? '' }}</textarea>
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">Лого</label>
                @php $logo = $settings['logo']->value ?? null; @endphp
                @if($logo) <img src="{{ \Storage::disk('public')->url($logo) }}" class="h-16 mb-2"> @endif
                <input type="file" name="logo" accept="image/*" class="w-full">
            </div>
        </div>
    </div>

    <div>
        <h3 class="font-bold mb-4 pb-2 border-b border-gray-100">Холбоо барих</h3>
        <div class="space-y-4">
            <div>
                <label class="block text-sm font-semibold mb-1">Утас</label>
                <input type="text" name="contact_phone" value="{{ $settings['contact_phone']->value ?? '+976 7711 1111' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">И-мэйл</label>
                <input type="email" name="contact_email" value="{{ $settings['contact_email']->value ?? 'info@nsma.mn' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">Хаяг</label>
                <input type="text" name="contact_address" value="{{ $settings['contact_address']->value ?? 'Улаанбаатар хот' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
        </div>
    </div>

    <div>
        <h3 class="font-bold mb-4 pb-2 border-b border-gray-100">Сошиал медиа</h3>
        <div class="space-y-4">
            <div>
                <label class="block text-sm font-semibold mb-1">Facebook</label>
                <input type="url" name="facebook_url" value="{{ $settings['facebook_url']->value ?? '' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">Instagram</label>
                <input type="url" name="instagram_url" value="{{ $settings['instagram_url']->value ?? '' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">LinkedIn</label>
                <input type="url" name="linkedin_url" value="{{ $settings['linkedin_url']->value ?? '' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
            <div>
                <label class="block text-sm font-semibold mb-1">YouTube</label>
                <input type="url" name="youtube_url" value="{{ $settings['youtube_url']->value ?? '' }}" class="w-full px-4 py-3 border border-gray-200 rounded-lg outline-none">
            </div>
        </div>
    </div>

    <div class="flex gap-3 pt-4 border-t">
        <button class="bg-nsma-red text-white font-semibold px-6 py-3 rounded-lg">Хадгалах</button>
    </div>
</form>

@endsection
