
<?php $__env->startSection('title', 'Profil Saya'); ?>
<?php $__env->startSection('content'); ?>

<div class="max-w-2xl mx-auto px-4 py-4" style="font-family: 'Plus Jakarta Sans', sans-serif;">

    
    <div class="mb-8">
        <h1 class="text-3xl font-black text-slate-800 italic tracking-tight">Profil Saya 👤</h1>
        <p class="text-pink-400 font-bold text-sm mt-1">Update informasi akun kamu</p>
    </div>

    <form action="<?php echo e(route('user.profile.update')); ?>" method="POST" enctype="multipart/form-data">
        <?php echo csrf_field(); ?>
        <?php echo method_field('PUT'); ?>

        
        <div class="bg-white rounded-[32px] border border-pink-50 shadow-sm p-6 mb-6">
            <div class="flex items-center gap-5">

                
                <label for="avatar-input" class="relative cursor-pointer group shrink-0">
                    <img id="avatar-preview"
                         src="<?php echo e($user->avatar ? asset('storage/' . $user->avatar) : 'https://ui-avatars.com/api/?name=' . urlencode($user->name) . '&background=fce7f3&color=db2777&size=128'); ?>"
                         class="w-20 h-20 rounded-2xl object-cover border-4 border-pink-100 shadow-md group-hover:opacity-70 transition-all duration-300">
                    
                    <div class="absolute inset-0 rounded-2xl bg-black/40 opacity-0 group-hover:opacity-100 transition-all duration-300 flex flex-col items-center justify-center gap-1">
                        <i data-lucide="camera" class="w-6 h-6 text-white"></i>
                        <span class="text-[9px] font-black text-white uppercase tracking-wider">Ganti</span>
                    </div>
                </label>
                <input type="file" id="avatar-input" name="avatar" accept="image/*" class="hidden">

                <div>
                    <p class="text-xl font-black text-slate-800"><?php echo e($user->name); ?></p>
                    <p class="text-sm text-slate-400 font-bold"><?php echo e($user->email); ?></p>
                    <span class="inline-block mt-2 bg-pink-100 text-pink-600 text-[10px] font-black uppercase tracking-widest px-3 py-1 rounded-full">
                        <?php echo e($user->role === 'admin' ? 'Admin' : ($user->role === 'courier' ? 'Kurir' : 'Member')); ?>

                    </span>
                    <p class="text-[11px] text-slate-400 mt-2 font-bold">Klik foto untuk ganti gambar</p>
                    <?php $__errorArgs = ['avatar'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-xs font-bold mt-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>
        </div>

        
        <div class="bg-white rounded-[32px] border border-pink-50 shadow-sm p-6 mb-6">
            <h2 class="font-black text-slate-800 flex items-center gap-2 mb-5">
                <i data-lucide="user" class="w-5 h-5 text-pink-400"></i>
                Informasi Dasar
            </h2>

            <div class="grid gap-4">
                
                <div>
                    <label class="block text-xs font-black text-slate-600 uppercase tracking-widest mb-2 ml-1">
                        Nama Lengkap
                    </label>
                    <input type="text" name="name" value="<?php echo e(old('name', $user->name)); ?>"
                           placeholder="Nama kamu..."
                           class="w-full px-5 py-4 rounded-2xl bg-slate-50 border-2 border-transparent focus:border-pink-300 focus:ring-0 outline-none text-sm font-bold text-slate-700 transition-all
                                  <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-300 bg-red-50 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                    <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-xs font-bold mt-1 ml-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                
                <div>
                    <label class="block text-xs font-black text-slate-600 uppercase tracking-widest mb-2 ml-1">
                        Email
                    </label>
                    <input type="email" name="email" value="<?php echo e(old('email', $user->email)); ?>"
                           placeholder="email@kamu.com"
                           class="w-full px-5 py-4 rounded-2xl bg-slate-50 border-2 border-transparent focus:border-pink-300 focus:ring-0 outline-none text-sm font-bold text-slate-700 transition-all
                                  <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-300 bg-red-50 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                    <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-xs font-bold mt-1 ml-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>
        </div>

        
        <div class="bg-white rounded-[32px] border border-pink-50 shadow-sm p-6 mb-6">
            <h2 class="font-black text-slate-800 flex items-center gap-2 mb-1">
                <i data-lucide="lock" class="w-5 h-5 text-pink-400"></i>
                Ganti Password
            </h2>
            <p class="text-xs text-slate-400 font-bold mb-5 ml-7">Kosongkan jika tidak ingin ganti password</p>

            <div class="grid gap-4">
                
                <div>
                    <label class="block text-xs font-black text-slate-600 uppercase tracking-widest mb-2 ml-1">
                        Password Lama
                    </label>
                    <div class="relative">
                        <input type="password" name="current_password" id="current_password"
                               placeholder="Masukkan password lama..."
                               class="w-full px-5 py-4 pr-12 rounded-2xl bg-slate-50 border-2 border-transparent focus:border-pink-300 focus:ring-0 outline-none text-sm font-bold text-slate-700 transition-all
                                      <?php $__errorArgs = ['current_password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-300 bg-red-50 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                        <button type="button" onclick="togglePassword('current_password', this)"
                                class="absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-pink-500 transition">
                            <i data-lucide="eye" class="w-4 h-4"></i>
                        </button>
                    </div>
                    <?php $__errorArgs = ['current_password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-xs font-bold mt-1 ml-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                
                <div>
                    <label class="block text-xs font-black text-slate-600 uppercase tracking-widest mb-2 ml-1">
                        Password Baru
                    </label>
                    <div class="relative">
                        <input type="password" name="password" id="new_password"
                               placeholder="Minimal 8 karakter..."
                               class="w-full px-5 py-4 pr-12 rounded-2xl bg-slate-50 border-2 border-transparent focus:border-pink-300 focus:ring-0 outline-none text-sm font-bold text-slate-700 transition-all
                                      <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> border-red-300 bg-red-50 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                        <button type="button" onclick="togglePassword('new_password', this)"
                                class="absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-pink-500 transition">
                            <i data-lucide="eye" class="w-4 h-4"></i>
                        </button>
                    </div>
                    <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="text-red-500 text-xs font-bold mt-1 ml-1"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                
                <div>
                    <label class="block text-xs font-black text-slate-600 uppercase tracking-widest mb-2 ml-1">
                        Konfirmasi Password Baru
                    </label>
                    <div class="relative">
                        <input type="password" name="password_confirmation" id="confirm_password"
                               placeholder="Ulangi password baru..."
                               class="w-full px-5 py-4 pr-12 rounded-2xl bg-slate-50 border-2 border-transparent focus:border-pink-300 focus:ring-0 outline-none text-sm font-bold text-slate-700 transition-all">
                        <button type="button" onclick="togglePassword('confirm_password', this)"
                                class="absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-pink-500 transition">
                            <i data-lucide="eye" class="w-4 h-4"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>

        
        <button type="submit"
                class="w-full bg-pink-500 hover:bg-pink-600 active:scale-95 text-white font-black text-xs uppercase tracking-widest py-4 rounded-2xl shadow-xl shadow-pink-200 transition-all">
            Simpan Perubahan ✨
        </button>
        <a href="<?php echo e(route('user.dashboard')); ?>"
           class="block text-center mt-4 text-slate-400 font-bold text-sm hover:text-pink-400 transition">
            Batal
        </a>
    </form>

</div>

<script>
// Preview foto sebelum upload
document.getElementById('avatar-input').addEventListener('change', function (e) {
    const file = e.target.files[0];
    if (!file) return;
    const reader = new FileReader();
    reader.onload = (ev) => {
        document.getElementById('avatar-preview').src = ev.target.result;
    };
    reader.readAsDataURL(file);
});

function togglePassword(inputId, btn) {
    const input = document.getElementById(inputId);
    const isHidden = input.type === 'password';
    input.type = isHidden ? 'text' : 'password';
    btn.innerHTML = isHidden
        ? '<i data-lucide="eye-off" class="w-4 h-4"></i>'
        : '<i data-lucide="eye" class="w-4 h-4"></i>';
    lucide.createIcons();
}
</script>

<script>lucide.createIcons();</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\SwiftCart\resources\views/user/profile/edit.blade.php ENDPATH**/ ?>