<x-layout title="Lauck - Nuevo Producto">
    
    <x-section-header subtitle="Inventario" title="Nuevo " highlight="Producto" />

    <div class="w-full max-w-4xl mx-auto bg-panel-bg border border-neutral-800 rounded-xl p-8 shadow-lg">
        
        <form action="{{ route('productos.store') }}" method="POST">
            @csrf

            <!-- Grid Layout -->
            <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-6">
                
                <!-- Nombre (Ocupa 2 columnas) -->
                <div class="md:col-span-4">
                    <x-forms.label for="name" value="Nombre del Producto" />
                    <x-forms.input id="name" name="name" type="text" :value="old('name')" required autofocus placeholder="Ej: Cámara 29 Válvula Auto" :error="$errors->first('name')" />
                </div>

                <!-- SKU -->
                <div class="md:col-span-2">
                    <x-forms.label for="sku" value="Código SKU (Opcional)" />
                    <x-forms.input id="sku" name="sku" type="text" :value="old('sku')" placeholder="Dejar vacío para generar auto" :error="$errors->first('sku')" />
                </div>

                <!-- Tipo -->
                <div class="md:col-span-2">
                    <x-forms.label for="type" value="Tipo de Producto" />
                    <select id="type" name="type" class="bg-neutral-800 border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5">
                        <option value="accessory" {{ old('type') == 'accessory' ? 'selected' : '' }}>Accesorio / Repuesto</option>
                        <option value="bike" {{ old('type') == 'bike' ? 'selected' : '' }}>Bicicleta</option>
                        <option value="service" {{ old('type') == 'service' ? 'selected' : '' }}>Servicio / Mano de Obra</option>
                    </select>
                </div>

                <!-- Precios -->
                <div class="">
                    <x-forms.label for="price" value="Precio Venta ($)" />
                    <x-forms.input id="price" name="price" type="number" step="0.01" :value="old('price')" required :error="$errors->first('price')" />
                </div>

                <div class="">
                    <x-forms.label for="cost" value="Costo ($) - Solo Admin" />
                    <x-forms.input id="cost" name="cost" type="number" step="0.01" :value="old('cost')" :error="$errors->first('cost')" />
                </div>

                <!-- Stock -->
                <div class="">
                    <x-forms.label for="stock_quantity" value="Cantidad Inicial" />
                    <x-forms.input id="stock_quantity" name="stock_quantity" type="number" :value="old('stock_quantity', 0)" required :error="$errors->first('stock_quantity')" />
                </div>

                <div class="">
                    <x-forms.label for="min_stock_alert" value="Alerta de Stock Mínimo" />
                    <x-forms.input id="min_stock_alert" name="min_stock_alert" type="number" :value="old('min_stock_alert', 5)" required />
                </div>

                <!-- Descripción (2 columnas) -->
                <div class="md:col-span-4">
                    <x-forms.label for="description" value="Descripción / Notas" />
                    <textarea id="description" name="description" rows="3" class="bg-neutral-800 border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5 placeholder-gray-500">{{ old('description') }}</textarea>
                </div>
            </div>

            <!-- Botones Acción -->
            <div class="flex items-center justify-between md:justify-end space-x-4 border-t border-neutral-800 pt-6">
                <a href="{{ route('productos.index') }}" class="text-gray-400 hover:text-white font-medium text-sm transition-colors">Cancelar</a>
                <button type="submit" class="px-6 py-2.5 bg-neon-lime text-neutral-900 font-bold rounded-lg hover:bg-[#b3e600] transition-colors shadow-lg shadow-neon-lime/20">
                    Guardar
                </button>
            </div>

        </form>
    </div>
</x-layout>