<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Edit Produk | Vogue3D</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Plus Jakarta Sans', sans-serif; }
        .glass {
            background: rgba(255, 255, 255, 0.75);
            backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.5);
        }
    </style>
</head>
<body class="bg-[#fff5f7] min-h-screen flex items-center justify-center p-6 text-slate-800">

    <div class="max-w-2xl w-full">
        <a href="<?php echo e(route('admin.products.index')); ?>" class="inline-flex items-center text-pink-400 hover:text-pink-600 mb-6 transition font-bold group">
            <div class="bg-white p-2 rounded-xl shadow-sm mr-3 group-hover:-translate-x-1 transition-transform">
                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
                </svg>
            </div>
            Batal & Kembali
        </a>

        <div class="glass rounded-[48px] shadow-2xl shadow-pink-100/50 p-8 md:p-12 border-white">
            <div class="mb-10 text-center md:text-left">
                <div class="text-[10px] font-black uppercase tracking-[0.3em] text-pink-400 mb-2">Editor Koleksi</div>
                <h1 class="text-3xl font-extrabold text-slate-900 tracking-tight">Edit <span class="text-pink-500">Produk</span></h1>
                <p class="text-slate-400 mt-2 text-sm italic font-medium">Perbarui informasi detail produk dengan gaya.</p>
            </div>

            <form action="<?php echo e(route('admin.products.update', $product->id)); ?>" method="POST" enctype="multipart/form-data" class="space-y-6">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>

                <div>
                    <label class="block text-xs font-black text-pink-400 uppercase tracking-widest mb-2 ml-1">Nama Pakaian</label>
                    <input type="text" name="name" value="<?php echo e(old('name', $product->name)); ?>" class="w-full px-6 py-4 rounded-[24px] border border-pink-50 focus:border-pink-300 focus:ring-4 focus:ring-pink-400/10 transition outline-none bg-white/50" required>
                </div>

                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <label class="block text-xs font-black text-pink-400 uppercase tracking-widest mb-2 ml-1">Kategori</label>
                        <select name="category_id" class="w-full px-6 py-4 rounded-[24px] border border-pink-50 focus:border-pink-300 focus:ring-4 focus:ring-pink-400/10 transition outline-none bg-white/50 appearance-none cursor-pointer" required>
                            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($category->id); ?>" <?php echo e($product->category_id == $category->id ? 'selected' : ''); ?>>
                                    <?php echo e($category->name); ?>

                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>

                    <div>
                        <label class="block text-xs font-black text-pink-400 uppercase tracking-widest mb-2 ml-1">Jumlah Stok</label>
                        <input type="number" name="stock" value="<?php echo e(old('stock', $product->stock)); ?>" class="w-full px-6 py-4 rounded-[24px] border border-pink-50 focus:border-pink-300 focus:ring-4 focus:ring-pink-400/10 transition outline-none bg-white/50" required>
                    </div>
                </div>

                <div>
                    <label class="block text-xs font-black text-pink-400 uppercase tracking-widest mb-2 ml-1">Harga Retail</label>
                    <div class="relative">
                        <span class="absolute left-6 top-4 text-pink-300 font-bold">Rp</span>
                        <input type="number" name="price" value="<?php echo e(old('price', intval($product->price))); ?>" class="w-full pl-14 pr-6 py-4 rounded-[24px] border border-pink-50 focus:border-pink-300 focus:ring-4 focus:ring-pink-400/10 transition outline-none bg-white/50 font-bold text-slate-700" required>
                    </div>
                </div>

                <div class="bg-white/30 p-6 rounded-[32px] border border-white">
                    <label class="block text-xs font-black text-pink-400 uppercase tracking-widest mb-4 ml-1">Visual Produk</label>
                    
                    <div class="flex flex-col md:flex-row items-center gap-6">
                        <?php if($product->image): ?>
                            <div class="relative group">
                                <img id="imagePreview" src="<?php echo e(asset('storage/' . $product->image)); ?>" class="w-32 h-32 object-cover rounded-[24px] border-4 border-white shadow-lg shadow-pink-100 transition-transform group-hover:scale-105">
                                <div class="absolute inset-0 rounded-[24px] ring-1 ring-black/5"></div>
                            </div>
                        <?php endif; ?>

                        <div class="flex-1">
                            <p class="text-[10px] text-slate-400 mb-3 font-bold uppercase tracking-tight">Ganti foto (Opsional)</p>
                            <input type="file" name="image" id="imageInput" class="w-full text-xs text-slate-500 file:mr-4 file:py-2 file:px-6 file:rounded-full file:border-0 file:text-[10px] file:font-black file:uppercase file:bg-pink-50 file:text-pink-500 hover:file:bg-pink-100 cursor-pointer transition">
                        </div>
                    </div>
                </div>

                <div>
                    <label class="block text-xs font-black text-pink-400 uppercase tracking-widest mb-2 ml-1">Catatan Deskripsi</label>
                    <textarea name="description" rows="3" class="w-full px-6 py-4 rounded-[24px] border border-pink-50 focus:border-pink-300 focus:ring-4 focus:ring-pink-400/10 transition outline-none bg-white/50 resize-none" placeholder="Ceritakan tentang artikel ini..."><?php echo e(old('description', $product->description)); ?></textarea>
                </div>

                <button type="submit" class="w-full bg-gradient-to-r from-pink-400 to-pink-500 text-white font-black py-5 rounded-[28px] text-lg hover:from-pink-500 hover:to-pink-600 hover:scale-[1.02] active:scale-95 transition transform shadow-xl shadow-pink-200 uppercase tracking-widest">
                    Simpan Perubahan ✨
                </button>
            </form>
        </div>
    </div>

    <script>
        // Preview foto instan
        const imageInput = document.getElementById('imageInput');
        const imagePreview = document.getElementById('imagePreview');

        imageInput.onchange = evt => {
            const [file] = imageInput.files;
            if (file) {
                if (imagePreview) {
                    imagePreview.src = URL.createObjectURL(file);
                }
            }
        }
    </script>
</body>
</html><?php /**PATH C:\laragon\www\SwiftCart\resources\views/products/edit.blade.php ENDPATH**/ ?>