<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Add Gallery Media') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6 text-gray-900">
                    <form action="{{ route('galleries.store') }}" method="POST" enctype="multipart/form-data">
                        @csrf
                        <div class="mb-4">
                            <label class="block text-gray-700 font-bold mb-2">Title (Optional)</label>
                            <input type="text" name="title" class="border rounded w-full py-2 px-3 text-gray-700" value="{{ old('title') }}">
                        </div>

                        <div class="mb-4">
                            <label class="block text-gray-700 font-bold mb-2">Media File (Image or Video) <span class="text-red-500">*</span></label>
                            <input type="file" name="media" class="border rounded w-full py-2 px-3 text-gray-700" required accept="image/*,video/*">
                            <p class="text-xs text-gray-500 mt-1">Max 50MB. Supported: JPG, PNG, WEBP, MP4, MOV</p>
                            @error('media') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
                        </div>

                        <div class="mb-4">
                            <label class="block text-gray-700 font-bold mb-2">Category (Optional)</label>
                            <input type="text" name="category" class="border rounded w-full py-2 px-3 text-gray-700" value="{{ old('category') }}">
                        </div>

                        <div class="mb-4">
                            <label class="flex items-center">
                                <input type="checkbox" name="is_active" class="form-checkbox" checked value="1">
                                <span class="ml-2 text-gray-700 font-bold">Active</span>
                            </label>
                        </div>

                        <div class="flex items-center gap-4">
                            <button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700">Save</button>
                            <a href="{{ route('galleries.index') }}" class="text-gray-600 hover:underline">Cancel</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</x-app-layout>
