<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <div class="flex justify-between items-center">
            <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                <?php echo e(__('Admin - User Details')); ?>

            </h2>
            <div class="flex space-x-2">
                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['onclick' => 'window.location=\''.e(route('admin.users.index')).'\'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['onclick' => 'window.location=\''.e(route('admin.users.index')).'\'']); ?>
                    Back to Users
                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
            </div>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <!-- Admin Actions Bar -->
            <div class="bg-gray-50 border border-gray-200 rounded-lg p-4 mb-6">
                <div class="flex items-center justify-between">
                    <div class="flex items-center">
                        <span class="text-gray-700 font-medium">Admin Actions:</span>
                    </div>
                    <div class="flex space-x-2">
                        <?php if($user->id !== auth()->id()): ?>
                            <form method="POST" action="<?php echo e(route('admin.users.impersonate', $user)); ?>" class="inline">
                                <?php echo csrf_field(); ?>
                                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['type' => 'submit','onclick' => 'return confirm(\'Login as '.e($user->name).'? You will be able to see the site as they do.\')']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'submit','onclick' => 'return confirm(\'Login as '.e($user->name).'? You will be able to see the site as they do.\')']); ?>
                                    <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
                                    </svg>
                                    Login as User
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                            </form>
                        <?php endif; ?>

                        <?php if($user->is_active && !$user->is_admin): ?>
                            <form method="POST" action="<?php echo e(route('admin.users.ban', $user)); ?>" class="inline">
                                <?php echo csrf_field(); ?>
                                <?php if (isset($component)) { $__componentOriginal656e8c5ea4d9a4fa173298297bfe3f11 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal656e8c5ea4d9a4fa173298297bfe3f11 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.danger-button','data' => ['onclick' => 'return confirm(\'Ban this user? This will also disable all their items.\')']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('danger-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['onclick' => 'return confirm(\'Ban this user? This will also disable all their items.\')']); ?>
                                    Ban User
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal656e8c5ea4d9a4fa173298297bfe3f11)): ?>
<?php $attributes = $__attributesOriginal656e8c5ea4d9a4fa173298297bfe3f11; ?>
<?php unset($__attributesOriginal656e8c5ea4d9a4fa173298297bfe3f11); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal656e8c5ea4d9a4fa173298297bfe3f11)): ?>
<?php $component = $__componentOriginal656e8c5ea4d9a4fa173298297bfe3f11; ?>
<?php unset($__componentOriginal656e8c5ea4d9a4fa173298297bfe3f11); ?>
<?php endif; ?>
                            </form>
                        <?php elseif(!$user->is_active): ?>
                            <form method="POST" action="<?php echo e(route('admin.users.unban', $user)); ?>" class="inline">
                                <?php echo csrf_field(); ?>
                                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['type' => 'submit']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'submit']); ?>
                                    Unban User
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                            </form>
                        <?php endif; ?>
                        <?php if($user->review_status !== 'approved'): ?>
                            <form method="POST" action="<?php echo e(route('admin.users.approve', $user)); ?>" class="inline">
                                <?php echo csrf_field(); ?>
                                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['type' => 'submit']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'submit']); ?>
                                    Approve User
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                            </form>
                        <?php endif; ?>
                        <?php if($user->review_status !== 'flagged'): ?>
                            <form method="POST" action="<?php echo e(route('admin.users.flag', $user)); ?>" class="inline">
                                <?php echo csrf_field(); ?>
                                <?php if (isset($component)) { $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.secondary-button','data' => ['type' => 'submit']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('secondary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'submit']); ?>
                                    Flag User
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $attributes = $__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__attributesOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af)): ?>
<?php $component = $__componentOriginal3b0e04e43cf890250cc4d85cff4d94af; ?>
<?php unset($__componentOriginal3b0e04e43cf890250cc4d85cff4d94af); ?>
<?php endif; ?>
                            </form>
                        <?php endif; ?>

                    </div>
                </div>
            </div>

            <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
                <!-- User Details -->
                <div class="lg:col-span-2 space-y-6">
                    <!-- Profile Info -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <div class="flex items-center mb-6">
                                <div class="flex-shrink-0 h-20 w-20">
                                    <div class="h-20 w-20 rounded-full bg-gray-200 flex items-center justify-center">
                                        <span class="text-gray-500 font-medium text-2xl">
                                            <?php echo e(strtoupper(substr($user->name, 0, 1))); ?>

                                        </span>
                                    </div>
                                </div>
                                <div class="ml-6">
                                    <h1 class="text-2xl font-bold text-gray-900"><?php echo e($user->name); ?></h1>
                                    <p class="text-gray-600"><?php echo e($user->email); ?></p>
                                    <div class="flex items-center mt-2 space-x-4">
                                        <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full <?php echo e($user->is_active ? 'bg-gray-100 text-gray-700' : 'bg-red-50 text-red-600'); ?>">
                                            <?php echo e($user->is_active ? 'Active' : 'Banned'); ?>

                                        </span>
                                        <?php if($user->is_admin): ?>
                                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-gray-100 text-gray-700">
                                                Admin
                                            </span>
                                        <?php endif; ?>
                                        <?php if($user->review_status === 'pending'): ?>
                                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-gray-100 text-gray-600">Pending Review</span>
                                        <?php elseif($user->review_status === 'flagged'): ?>
                                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-gray-100 text-gray-600">Flagged</span>
                                        <?php elseif($user->review_status === 'approved'): ?>
                                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-gray-100 text-gray-600">Approved</span>
                                        <?php endif; ?>
                                        <?php if($user->rating > 0): ?>
                                            <div class="flex items-center">
                                                <span class="text-yellow-400">★</span>
                                                <span class="ml-1 text-sm font-medium"><?php echo e(number_format($user->rating, 1)); ?></span>
                                            </div>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>

                            <?php if($user->bio || $user->location || $user->phone): ?>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <?php if($user->location): ?>
                                        <div>
                                            <span class="text-sm font-medium text-gray-600">Location:</span>
                                            <span class="text-sm text-gray-900 ml-2"><?php echo e($user->location); ?></span>
                                        </div>
                                    <?php endif; ?>
                                    <?php if($user->phone): ?>
                                        <div>
                                            <span class="text-sm font-medium text-gray-600">Phone:</span>
                                            <span class="text-sm text-gray-900 ml-2"><?php echo e($user->phone); ?></span>
                                        </div>
                                    <?php endif; ?>
                                </div>
                                
                                <?php if($user->bio): ?>
                                    <div class="mt-4">
                                        <span class="text-sm font-medium text-gray-600">Bio:</span>
                                        <p class="text-sm text-gray-900 mt-1"><?php echo e($user->bio); ?></p>
                                    </div>
                                <?php endif; ?>
                            <?php endif; ?>
                        </div>
                    </div>

                    <!-- User Items -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <div class="flex justify-between items-center mb-4">
                                <h3 class="text-lg font-semibold text-gray-900">Items (<?php echo e($user->items->count()); ?>)</h3>
                                <a href="<?php echo e(route('admin.items.index', ['search' => $user->email])); ?>" class="text-gray-600 hover:opacity-60 transition-opacity text-sm">View All</a>
                            </div>
                            
                            <?php if($user->items->count() > 0): ?>
                                <div class="space-y-3">
                                    <?php $__currentLoopData = $user->items->take(5); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
                                            <div class="flex items-center">
                                                <div class="flex-shrink-0 h-12 w-12">
                                                    <?php if($item->primaryPhoto): ?>
                                                        <img class="h-12 w-12 rounded-lg object-cover" src="<?php echo e(asset($item->primaryPhoto->url)); ?>" alt="<?php echo e($item->title); ?>">
                                                    <?php else: ?>
                                                        <div class="h-12 w-12 rounded-lg bg-gray-200 flex items-center justify-center">
                                                            <span class="text-gray-400 text-xs">No Image</span>
                                                        </div>
                                                    <?php endif; ?>
                                                </div>
                                                <div class="ml-4">
                                                    <p class="font-medium text-sm">
                                                        <a href="<?php echo e(route('admin.items.show', $item)); ?>" class="text-gray-700 hover:opacity-60 transition-opacity">
                                                            <?php echo e(Str::limit($item->title, 40)); ?>

                                                        </a>
                                                    </p>
                                                    <p class="text-xs text-gray-600"><?php echo e($item->category?->name ?? 'No Category'); ?> • <?php echo e($item->created_at->diffForHumans()); ?></p>
                                                </div>
                                            </div>
                                            <div class="flex flex-col items-end space-y-1">
                                                <?php if($item->price): ?>
                                                    <span class="text-sm font-medium">$<?php echo e(number_format($item->price, 2)); ?></span>
                                                <?php endif; ?>
                                                <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full <?php echo e($item->status === 'active' ? 'bg-gray-100 text-gray-700' : ($item->status === 'removed' ? 'bg-red-50 text-red-600' : ($item->status === 'flagged' ? 'bg-gray-100 text-gray-600' : 'bg-gray-100 text-gray-700'))); ?>">
                                                    <?php echo e(ucfirst(str_replace('_', ' ', $item->status))); ?>

                                                </span>
                                            </div>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    
                                    <?php if($user->items->count() > 5): ?>
                                        <div class="text-center pt-2">
                                            <a href="<?php echo e(route('admin.items.index', ['search' => $user->email])); ?>" class="text-gray-600 hover:opacity-60 transition-opacity text-sm">
                                                View <?php echo e($user->items->count() - 5); ?> more items
                                            </a>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            <?php else: ?>
                                <p class="text-gray-500 text-sm">No items listed</p>
                            <?php endif; ?>
                        </div>
                    </div>

                    <!-- Transaction History -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <h3 class="text-lg font-semibold text-gray-900 mb-4">Transaction History</h3>
                            
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <!-- Sales -->
                                <div>
                                    <h4 class="font-medium text-gray-900 mb-3">Sales (<?php echo e($user->soldTransactions->count()); ?>)</h4>
                                    <?php if($user->soldTransactions->count() > 0): ?>
                                        <div class="space-y-2">
                                            <?php $__currentLoopData = $user->soldTransactions->take(3); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="text-sm">
                                                    <p class="font-medium"><?php echo e($transaction->item->title); ?></p>
                                                    <p class="text-gray-600">Sold to <?php echo e($transaction->buyer->name); ?></p>
                                                    <p class="text-gray-500">$<?php echo e(number_format($transaction->amount, 2)); ?> • <?php echo e($transaction->created_at->format('M j, Y')); ?></p>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    <?php else: ?>
                                        <p class="text-gray-500 text-sm">No sales</p>
                                    <?php endif; ?>
                                </div>

                                <!-- Purchases -->
                                <div>
                                    <h4 class="font-medium text-gray-900 mb-3">Purchases (<?php echo e($user->boughtTransactions->count()); ?>)</h4>
                                    <?php if($user->boughtTransactions->count() > 0): ?>
                                        <div class="space-y-2">
                                            <?php $__currentLoopData = $user->boughtTransactions->take(3); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="text-sm">
                                                    <p class="font-medium"><?php echo e($transaction->item->title); ?></p>
                                                    <p class="text-gray-600">Bought from <?php echo e($transaction->seller->name); ?></p>
                                                    <p class="text-gray-500">$<?php echo e(number_format($transaction->amount, 2)); ?> • <?php echo e($transaction->created_at->format('M j, Y')); ?></p>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    <?php else: ?>
                                        <p class="text-gray-500 text-sm">No purchases</p>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Feedback -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <h3 class="text-lg font-semibold text-gray-900 mb-4">Feedback</h3>
                            
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <!-- Received Feedback -->
                                <div>
                                    <h4 class="font-medium text-gray-900 mb-3">Received (<?php echo e($user->receivedFeedback->count()); ?>)</h4>
                                    <?php if($user->receivedFeedback->count() > 0): ?>
                                        <div class="space-y-3">
                                            <?php $__currentLoopData = $user->receivedFeedback->take(3); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feedback): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="text-sm border-l-4 border-gray-200 pl-3">
                                                    <div class="flex items-center mb-1">
                                                        <div class="flex items-center">
                                                            <?php for($i = 1; $i <= 5; $i++): ?>
                                                                <span class="text-<?php echo e($i <= $feedback->rating ? 'yellow' : 'gray'); ?>-400">★</span>
                                                            <?php endfor; ?>
                                                        </div>
                                                        <span class="ml-2 text-gray-600"><?php echo e($feedback->rating); ?>/5</span>
                                                    </div>
                                                    <?php if($feedback->comment): ?>
                                                        <p class="text-gray-700"><?php echo e($feedback->comment); ?></p>
                                                    <?php endif; ?>
                                                    <p class="text-gray-500 mt-1">From <?php echo e($feedback->giver->name); ?> • <?php echo e($feedback->created_at->diffForHumans()); ?></p>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    <?php else: ?>
                                        <p class="text-gray-500 text-sm">No feedback received</p>
                                    <?php endif; ?>
                                </div>

                                <!-- Given Feedback -->
                                <div>
                                    <h4 class="font-medium text-gray-900 mb-3">Given (<?php echo e($user->givenFeedback->count()); ?>)</h4>
                                    <?php if($user->givenFeedback->count() > 0): ?>
                                        <div class="space-y-3">
                                            <?php $__currentLoopData = $user->givenFeedback->take(3); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feedback): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="text-sm border-l-4 border-gray-200 pl-3">
                                                    <div class="flex items-center mb-1">
                                                        <div class="flex items-center">
                                                            <?php for($i = 1; $i <= 5; $i++): ?>
                                                                <span class="text-<?php echo e($i <= $feedback->rating ? 'yellow' : 'gray'); ?>-400">★</span>
                                                            <?php endfor; ?>
                                                        </div>
                                                        <span class="ml-2 text-gray-600"><?php echo e($feedback->rating); ?>/5</span>
                                                    </div>
                                                    <?php if($feedback->comment): ?>
                                                        <p class="text-gray-700"><?php echo e($feedback->comment); ?></p>
                                                    <?php endif; ?>
                                                    <p class="text-gray-500 mt-1">To <?php echo e($feedback->receiver->name); ?> • <?php echo e($feedback->created_at->diffForHumans()); ?></p>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    <?php else: ?>
                                        <p class="text-gray-500 text-sm">No feedback given</p>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Sidebar -->
                <div class="space-y-6">
                    <!-- Account Stats -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <h3 class="text-lg font-semibold text-gray-900 mb-4">Account Stats</h3>
                            <div class="space-y-3">
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-600">Member Since:</span>
                                    <span class="text-sm text-gray-900"><?php echo e($user->created_at->format('M j, Y')); ?></span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-600">Last Active:</span>
                                    <span class="text-sm text-gray-900"><?php echo e($user->updated_at->diffForHumans()); ?></span>
                                </div>
                                <?php if($user->reviewed_at): ?>
                                    <div class="flex justify-between">
                                        <span class="text-sm font-medium text-gray-600">Reviewed:</span>
                                        <span class="text-sm text-gray-900"><?php echo e($user->reviewed_at->format('M j, Y')); ?></span>
                                    </div>
                                    <?php if($user->reviewer): ?>
                                        <div class="flex justify-between">
                                            <span class="text-sm font-medium text-gray-600">Reviewed By:</span>
                                            <span class="text-sm text-gray-900"><?php echo e($user->reviewer->name); ?></span>
                                        </div>
                                    <?php endif; ?>
                                <?php endif; ?>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-600">Items Listed:</span>
                                    <span class="text-sm text-gray-900"><?php echo e($user->items->count()); ?></span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-600">Items Sold:</span>
                                    <span class="text-sm text-gray-900 font-medium"><?php echo e($user->soldTransactions->count()); ?></span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-600">Items Bought:</span>
                                    <span class="text-sm text-gray-900 font-medium"><?php echo e($user->boughtTransactions->count()); ?></span>
                                </div>
                                <?php if($user->rating > 0): ?>
                                    <div class="flex justify-between">
                                        <span class="text-sm font-medium text-gray-600">Rating:</span>
                                        <div class="flex items-center">
                                            <span class="text-yellow-400">★</span>
                                            <span class="ml-1 text-sm text-gray-900"><?php echo e(number_format($user->rating, 1)); ?></span>
                                            <span class="ml-1 text-xs text-gray-500">(<?php echo e($user->receivedFeedback->count()); ?>)</span>
                                        </div>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>

                    <!-- Trust Links Management -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <h3 class="text-lg font-semibold text-gray-900 mb-4">Trust Links</h3>

                            <?php if($user->trustLinks->count() > 0): ?>
                                <div class="mb-6 overflow-x-auto">
                                    <table class="w-full text-sm">
                                        <thead>
                                            <tr class="border-b border-gray-200 bg-gray-50">
                                                <th class="px-3 py-2 text-left text-xs font-semibold text-gray-700">Service</th>
                                                <th class="px-3 py-2 text-left text-xs font-semibold text-gray-700">Remote ID</th>
                                                <th class="px-3 py-2 text-left text-xs font-semibold text-gray-700">Status</th>
                                                <th class="px-3 py-2 text-left text-xs font-semibold text-gray-700">Code</th>
                                                <th class="px-3 py-2 text-left text-xs font-semibold text-gray-700">Expires</th>
                                                <th class="px-3 py-2 text-left text-xs font-semibold text-gray-700">Actions</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php $__currentLoopData = $user->trustLinks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $link): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr class="border-b border-gray-200 hover:bg-gray-50">
                                                    <td class="px-3 py-3 text-gray-900 font-medium"><?php echo e($link->service->name); ?></td>
                                                    <td class="px-3 py-3 text-gray-600">
                                                        <?php if($link->remote_user_url): ?>
                                                            <a href="<?php echo e($link->remote_user_url); ?>" target="_blank" class="text-blue-600 hover:text-blue-700 underline text-xs"><?php echo e($link->remote_id); ?></a>
                                                        <?php else: ?>
                                                            <?php echo e($link->remote_id); ?>

                                                        <?php endif; ?>
                                                    </td>
                                                    <td class="px-3 py-3">
                                                        <span class="px-2 py-1 rounded text-xs font-semibold
                                                            <?php if($link->status === 'verified'): ?>
                                                                bg-green-100 text-green-700
                                                            <?php elseif($link->status === 'submitted'): ?>
                                                                bg-yellow-100 text-yellow-700
                                                            <?php elseif($link->status === 'failed'): ?>
                                                                bg-red-100 text-red-700
                                                            <?php else: ?>
                                                                bg-gray-100 text-gray-700
                                                            <?php endif; ?>
                                                        ">
                                                            <?php echo e(ucfirst(str_replace('_', ' ', $link->status))); ?>

                                                        </span>
                                                    </td>
                                                    <td class="px-3 py-3 font-mono text-xs text-gray-600">
                                                        <?php if($link->challenge_code): ?>
                                                            <code class="bg-gray-100 px-2 py-1 rounded"><?php echo e($link->challenge_code); ?></code>
                                                        <?php else: ?>
                                                            --
                                                        <?php endif; ?>
                                                    </td>
                                                    <td class="px-3 py-3 text-sm text-gray-600">
                                                        <?php if($link->challenge_expires_at): ?>
                                                            <span class="text-xs"><?php echo e($link->challenge_expires_at->format('M j, Y')); ?></span>
                                                            <?php if($link->isExpired()): ?>
                                                                <span class="text-red-600">(expired)</span>
                                                            <?php endif; ?>
                                                        <?php else: ?>
                                                            --
                                                        <?php endif; ?>
                                                    </td>
                                                    <td class="px-3 py-3 text-right space-x-1">
                                                        <?php if($link->status === 'submitted' && $link->service->verification_mode === 'automated'): ?>
                                                            <form method="POST" action="<?php echo e(route('admin.trust-links.check-proof', $link)); ?>" class="inline">
                                                                <?php echo csrf_field(); ?>
                                                                <button type="submit" class="text-blue-600 hover:text-blue-700 text-xs font-medium">Check</button>
                                                            </form>
                                                        <?php endif; ?>
                                                        <?php if($link->status !== 'verified' && $link->service->verification_mode === 'manual'): ?>
                                                            <form method="POST" action="<?php echo e(route('admin.trust-links.verify', $link)); ?>" class="inline">
                                                                <?php echo csrf_field(); ?>
                                                                <button type="submit" class="text-green-600 hover:text-green-700 text-xs font-medium">Verify</button>
                                                            </form>
                                                        <?php endif; ?>
                                                        <form method="POST" action="<?php echo e(route('admin.trust-links.destroy', $link)); ?>" class="inline" onsubmit="return confirm('Delete this trust link?');">
                                                            <?php echo csrf_field(); ?>
                                                            <?php echo method_field('DELETE'); ?>
                                                            <button type="submit" class="text-red-600 hover:text-red-700 text-xs font-medium">Delete</button>
                                                        </form>
                                                    </td>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </tbody>
                                    </table>
                                </div>
                            <?php else: ?>
                                <p class="text-gray-600 text-sm mb-4">No trust links yet.</p>
                            <?php endif; ?>

                            <!-- Add Trust Link Form -->
                            <div class="border-t border-gray-200 pt-4">
                                <h4 class="font-medium text-gray-900 mb-3 text-sm">Add Trust Link</h4>
                                <form method="POST" action="<?php echo e(route('admin.users.trust.store', $user)); ?>" class="space-y-3">
                                    <?php echo csrf_field(); ?>
                                    <div class="flex gap-2">
                                        <div class="flex-1">
                                            <select name="trust_service_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-gray-400 focus:border-gray-400 text-sm" required>
                                                <option value="">Select a service...</option>
                                                <?php $__currentLoopData = \App\Models\TrustService::active()->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $service): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($service->id); ?>"><?php echo e($service->name); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                        <div class="flex-1">
                                            <input type="text" name="remote_id" placeholder="Username/ID" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-gray-400 focus:border-gray-400 text-sm" required>
                                        </div>
                                        <div class="flex-1">
                                            <input type="url" name="remote_user_url" placeholder="Profile URL" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-gray-400 focus:border-gray-400 text-sm" required>
                                        </div>
                                        <button type="submit" class="px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-700 text-sm font-medium">Add</button>
                                    </div>
                                    <input type="text" name="note" placeholder="Internal note (optional)" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-gray-400 focus:border-gray-400 text-sm">
                                </form>
                            </div>
                        </div>
                    </div>

                    <!-- Admin Edit Form -->
                    <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                        <div class="p-6">
                            <h3 class="text-lg font-semibold text-gray-900 mb-4">Admin Edit</h3>
                            <form method="POST" action="<?php echo e(route('admin.users.update', $user)); ?>" class="space-y-4">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('PATCH'); ?>

                                <div class="flex items-center">
                                    <input id="is_active" name="is_active" type="checkbox" value="1" <?php echo e($user->is_active ? 'checked' : ''); ?> class="h-4 w-4 text-gray-800 focus:ring-gray-400 border-gray-300 rounded">
                                    <label for="is_active" class="ml-2 block text-sm text-gray-900">
                                        Account Active
                                    </label>
                                </div>

                                <div>
                                    <?php if (isset($component)) { $__componentOriginale3da9d84bb64e4bc2eeebaafabfb2581 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale3da9d84bb64e4bc2eeebaafabfb2581 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-label','data' => ['for' => 'admin_notes','value' => __('Admin Notes')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-label'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['for' => 'admin_notes','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__('Admin Notes'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale3da9d84bb64e4bc2eeebaafabfb2581)): ?>
<?php $attributes = $__attributesOriginale3da9d84bb64e4bc2eeebaafabfb2581; ?>
<?php unset($__attributesOriginale3da9d84bb64e4bc2eeebaafabfb2581); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale3da9d84bb64e4bc2eeebaafabfb2581)): ?>
<?php $component = $__componentOriginale3da9d84bb64e4bc2eeebaafabfb2581; ?>
<?php unset($__componentOriginale3da9d84bb64e4bc2eeebaafabfb2581); ?>
<?php endif; ?>
                                    <textarea id="admin_notes" name="admin_notes" rows="3" class="mt-1 block w-full border-gray-300 focus:border-gray-400 focus:ring-gray-400 rounded-md shadow-sm" placeholder="Internal notes about this user..."><?php echo e($user->admin_notes); ?></textarea>
                                </div>

                                <?php if (isset($component)) { $__componentOriginald411d1792bd6cc877d687758b753742c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginald411d1792bd6cc877d687758b753742c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.primary-button','data' => ['type' => 'submit','class' => 'w-full']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('primary-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'submit','class' => 'w-full']); ?>
                                    Update User
                                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginald411d1792bd6cc877d687758b753742c)): ?>
<?php $attributes = $__attributesOriginald411d1792bd6cc877d687758b753742c; ?>
<?php unset($__attributesOriginald411d1792bd6cc877d687758b753742c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginald411d1792bd6cc877d687758b753742c)): ?>
<?php $component = $__componentOriginald411d1792bd6cc877d687758b753742c; ?>
<?php unset($__componentOriginald411d1792bd6cc877d687758b753742c); ?>
<?php endif; ?>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Login History -->
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6">
                    <h3 class="text-lg font-semibold text-gray-900 mb-4">Login History</h3>

                    <?php if($user->loginHistory->count() > 0): ?>
                        <div class="overflow-x-auto">
                            <table class="min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date & Time</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">IP Address</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Device / Browser</th>
                                    </tr>
                                </thead>
                                <tbody class="bg-white divide-y divide-gray-200">
                                    <?php $__currentLoopData = $user->loginHistory->take(50); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $login): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr class="hover:bg-gray-50">
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
                                                <?php echo e($login->logged_in_at->format('M j, Y g:i A')); ?>

                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-mono text-gray-600">
                                                <?php echo e($login->ip_address); ?>

                                            </td>
                                            <td class="px-6 py-4 text-sm text-gray-600">
                                                <div class="max-w-xs truncate" title="<?php echo e($login->user_agent); ?>">
                                                    <?php echo e($login->user_agent ? Str::limit($login->user_agent, 60) : 'Unknown'); ?>

                                                </div>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>

                        <?php if($user->loginHistory->count() > 50): ?>
                            <div class="mt-4 text-center">
                                <p class="text-sm text-gray-500">Showing 50 most recent logins out of <?php echo e($user->loginHistory->count()); ?> total</p>
                            </div>
                        <?php endif; ?>
                    <?php else: ?>
                        <p class="text-gray-500 text-sm">No login history available.</p>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH /var/www/html/resources/views/admin/users/show.blade.php ENDPATH**/ ?>