<?php $__env->startSection('title', $user->name . ' - Admin'); ?>

<?php $__env->startPush('styles'); ?>
<style>
/* ===== DARK MODE FOR SHOW USER PAGE ===== */

.dark [style*="color:#64748B"] {
    color: #cbd5e1 !important;
}

.dark [style*="color:#1A56DB"] {
    color: #60a5fa !important;
}

.dark .page-title {
    color: #f1f5f9 !important;
}

.dark .page-subtitle {
    color: #cbd5e1 !important;
}

.dark .card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

.dark [style*="background:#EDE9FE"] {
    background: rgba(124, 58, 237, 0.2) !important;
    color: #c4b5fd !important;
}

.dark [style*="background:#FEE2E2"] {
    background: rgba(220, 38, 38, 0.2) !important;
    color: #fca5a5 !important;
}

.dark [style*="color:#1E293B"] {
    color: #f1f5f9 !important;
}

.dark [style*="color:#94A3B8"] {
    color: #cbd5e1 !important;
}

/* Table */
.dark .table-wrapper table thead {
    background: #0f172a !important;
}

.dark .table-wrapper table thead th {
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

.dark .table-wrapper table tbody tr {
    border-color: #334155 !important;
}

.dark .table-wrapper table tbody tr:hover {
    background: rgba(51, 65, 85, 0.3) !important;
}

.dark .table-wrapper table tbody td {
    border-color: #334155 !important;
}

/* Stats cards */
.dark [style*="text-align:center"] {
    color: #cbd5e1 !important;
}

.dark [style*="color:#059669"] {
    color: #86efac !important;
}

.dark [style*="color:#D97706"] {
    color: #fcd34d !important;
}

.dark [style*="color:#DC2626"] {
    color: #fca5a5 !important;
}

/* Badge styles */
.dark [style*="background:#D1FAE5"] {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #86efac !important;
}

.dark [style*="background:#FEF3C7"] {
    background: rgba(217, 119, 6, 0.2) !important;
    color: #fcd34d !important;
}

/* Ban modal */
.dark [style*="background:white;border-radius:16px"] {
    background: #1e293b !important;
    border-color: #334155 !important;
}

.dark [style*="background:rgba(0,0,0,.5)"] {
    background: rgba(0, 0, 0, 0.7) !important;
}

.dark input[type="text"],
.dark textarea {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* ===== LIGHT MODE FALLBACK ===== */

.light .page-title {
    color: #0f172a !important;
}

.light .page-subtitle {
    color: #64748b !important;
}

.light .card {
    background: #ffffff !important;
}
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<div class="max-w-4xl mx-auto">
    <div style="display:flex;align-items:center;gap:6px;font-size:.875rem;color:#64748B;margin-bottom:1.5rem">
        <a href="<?php echo e(route('admin.users.index')); ?>" style="color:#1A56DB;text-decoration:none">Kelola User</a>
        <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
        <span><?php echo e($user->name); ?></span>
    </div>

    
    <div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:1rem;margin-bottom:1.5rem">
        <div style="display:flex;align-items:center;gap:12px">
            <div style="width:52px;height:52px;border-radius:12px;background:<?php echo e($user->isAdmin()?'linear-gradient(135deg,#7C3AED,#A855F7)':'linear-gradient(135deg,#1A56DB,#06B6D4)'); ?>;display:flex;align-items:center;justify-content:center;color:white;font-weight:800;font-size:1.25rem">
                <?php echo e(strtoupper(substr($user->name,0,1))); ?>

            </div>
            <div>
                <div style="display:flex;align-items:center;gap:8px;margin-bottom:2px">
                    <h1 class="page-title" style="margin:0"><?php echo e($user->name); ?></h1>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($user->isAdmin()): ?><span style="background:#EDE9FE;color:#7C3AED;padding:3px 10px;border-radius:6px;font-size:.75rem;font-weight:700">Admin</span><?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($user->isBanned()): ?><span style="background:#FEE2E2;color:#991B1B;padding:3px 10px;border-radius:6px;font-size:.75rem;font-weight:700">Dinonaktifkan</span><?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
                <p class="page-subtitle" style="margin:0"><?php echo e($user->email); ?></p>
            </div>
        </div>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($user->id !== Auth::id()): ?>
        <div style="display:flex;gap:.625rem;flex-wrap:wrap">
            <a href="<?php echo e(route('admin.users.edit',$user->id)); ?>" class="btn btn-secondary btn-sm">Edit</a>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($user->isBanned()): ?>
            <form action="<?php echo e(route('admin.users.unban',$user->id)); ?>" method="POST"><?php echo csrf_field(); ?>
                <button type="submit" class="btn btn-primary btn-sm">Aktifkan Kembali</button>
            </form>
            <?php else: ?>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(!$user->isAdmin()): ?>
            <form action="<?php echo e(route('admin.users.make-admin',$user->id)); ?>" method="POST"><?php echo csrf_field(); ?>
                <button type="submit" class="btn btn-secondary btn-sm">Jadikan Admin</button>
            </form>
            <?php else: ?>
            <form action="<?php echo e(route('admin.users.revoke-admin',$user->id)); ?>" method="POST"><?php echo csrf_field(); ?>
                <button type="submit" class="btn btn-secondary btn-sm">Cabut Admin</button>
            </form>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            <button onclick="document.getElementById('ban-modal').style.display='flex'" class="btn btn-danger btn-sm">Nonaktifkan</button>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>

    
    <div style="display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;margin-bottom:1.5rem">
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = [['Total Analisis',$stats['total'],'#DBEAFE','#1A56DB'],['Zona Aman',$stats['safe'],'#D1FAE5','#059669'],['Zona Waspada',$stats['grey'],'#FEF3C7','#D97706'],['Zona Berbahaya',$stats['distress'],'#FEE2E2','#DC2626']]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$l,$v,$bg,$c]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
        <div class="card" style="padding:1rem;text-align:center">
            <div style="font-size:.75rem;color:#64748B;margin-bottom:4px"><?php echo e($l); ?></div>
            <div style="font-size:1.5rem;font-weight:800;color:<?php echo e($c); ?>"><?php echo e($v); ?></div>
        </div>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
    </div>

    
    <div class="card" style="margin-bottom:1.5rem;padding:1.25rem">
        <div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:1rem">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = [['Bergabung',$user->created_at->format('d F Y')],['Rata-rata Z-Score',number_format($stats['avg_z'],3)],['Status',$user->isBanned()?'Dinonaktifkan':'Aktif']]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$l,$v]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
            <div><div style="font-size:.75rem;color:#64748B;margin-bottom:3px"><?php echo e($l); ?></div><div style="font-weight:700;color:#1E293B"><?php echo e($v); ?></div></div>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
        </div>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($user->isBanned()): ?>
        <div style="margin-top:1rem;padding:.75rem;background:#FEE2E2;border-radius:8px;font-size:.8125rem;color:#991B1B">
            <strong>Alasan:</strong> <?php echo e($user->ban_reason ?? 'Tidak ada keterangan'); ?> · <?php echo e($user->banned_at?->format('d/m/Y H:i')); ?>

        </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>

    
    <div class="card">
        <div style="font-size:.8125rem;font-weight:700;color:#64748B;text-transform:uppercase;letter-spacing:.04em;margin-bottom:1.25rem">Riwayat Analisis Terbaru</div>
        <div class="table-wrapper">
            <table class="table">
                <thead><tr><th>Perusahaan</th><th>Periode</th><th style="text-align:right">Z-Score</th><th style="text-align:center">Kategori</th><th>Tanggal</th></tr></thead>
                <tbody>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $analyses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                    <?php $bc=match($a->z_category){'safe'=>['#D1FAE5','#065F46','Aman'],'grey'=>['#FEF3C7','#92400E','Waspada'],'distress'=>['#FEE2E2','#991B1B','Berbahaya'],default=>['#F1F5F9','#64748B','-']}; ?>
                    <tr>
                        <td style="font-weight:600"><?php echo e($a->company_name); ?></td>
                        <td style="color:#64748B"><?php echo e($a->period); ?></td>
                        <td style="text-align:right;font-weight:700;font-family:monospace;color:<?php echo e($a->z_category==='safe'?'#059669':($a->z_category==='grey'?'#D97706':'#DC2626')); ?>"><?php echo e(number_format($a->z_score,4)); ?></td>
                        <td style="text-align:center"><span style="background:<?php echo e($bc[0]); ?>;color:<?php echo e($bc[1]); ?>;padding:3px 10px;border-radius:20px;font-size:.75rem;font-weight:700"><?php echo e($bc[2]); ?></span></td>
                        <td style="font-size:.8125rem;color:#64748B"><?php echo e($a->created_at->format('d/m/Y H:i')); ?></td>
                    </tr>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                    <tr><td colspan="5" style="text-align:center;padding:2rem;color:#94A3B8">Belum ada analisis</td></tr>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>


<div id="ban-modal" style="display:none;position:fixed;inset:0;z-index:200;align-items:center;justify-content:center;background:rgba(0,0,0,.5)">
    <div style="background:white;border-radius:16px;padding:2rem;width:100%;max-width:440px;margin:1rem">
        <div style="font-size:1.125rem;font-weight:700;color:#991B1B;margin-bottom:1rem">Nonaktifkan Akun <?php echo e($user->name); ?></div>
        <form action="<?php echo e(route('admin.users.ban',$user->id)); ?>" method="POST">
            <?php echo csrf_field(); ?>
            <div class="form-group">
                <label class="form-label">Alasan <span style="color:#94A3B8;font-weight:400">(opsional)</span></label>
                <textarea name="reason" class="form-control" rows="3" placeholder="Contoh: Melanggar ketentuan penggunaan..."></textarea>
            </div>
            <div style="display:flex;gap:.75rem;margin-top:1rem">
                <button type="button" onclick="document.getElementById('ban-modal').style.display='none'" class="btn btn-secondary" style="flex:1">Batal</button>
                <button type="submit" class="btn btn-danger" style="flex:1">Nonaktifkan</button>
            </div>
        </form>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/roky/projects/V1/resources/views/admin/users/show.blade.php ENDPATH**/ ?>