<?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, []); ?> 
        <style>
            .dash-header-title {
                font-weight: 600;
                font-size: 1.5rem;
                letter-spacing: -0.01em;
                color: #0f0f0f;
            }
        </style>
        <h2 class="dash-header-title">Daftar Pengguna</h2>
     <?php $__env->endSlot(); ?>

    <style>
        .user-wrap { 
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
        }

        .user-inner {
            max-width: 1400px;
            margin: 0 auto;
            padding: 40px 24px;
        }

        /* ── TOP BAR ── */
        .user-topbar {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            margin-bottom: 32px;
            flex-wrap: wrap;
            gap: 20px;
        }

        .user-eyebrow {
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #999;
            margin-bottom: 4px;
        }

        .user-title {
            font-size: 1.5rem;
            font-weight: 600;
            color: #0f0f0f;
            letter-spacing: -0.01em;
        }

        /* ── STATS GRID ── */
        .user-stats {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
            margin-bottom: 32px;
        }

        @media (max-width: 768px) {
            .user-stats { grid-template-columns: repeat(2, 1fr); }
        }

        @media (max-width: 480px) {
            .user-stats { grid-template-columns: 1fr; }
        }

        .user-stat-card {
            background: #fff;
            border: 1px solid #ebebeb;
            border-radius: 12px;
            padding: 20px 24px;
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .user-stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }

        .user-stat-label {
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #999;
            margin-bottom: 8px;
        }

        .user-stat-value {
            font-size: 2rem;
            font-weight: 700;
            color: #0f0f0f;
            letter-spacing: -0.02em;
        }

        /* ── FILTER BAR ── */
        .user-filter-wrap {
            background: #fff;
            border: 1px solid #ebebeb;
            border-radius: 12px;
            margin-bottom: 32px;
            overflow: hidden;
        }

        .user-filter-form {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-end;
            gap: 16px;
            padding: 20px 24px;
        }

        .user-filter-group {
            flex: 1;
            min-width: 160px;
        }

        .user-filter-label {
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #999;
            margin-bottom: 6px;
            display: block;
        }

        .user-filter-input,
        .user-filter-select {
            width: 100%;
            padding: 10px 12px;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            font-size: 0.8rem;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            background: #fff;
            transition: border-color 0.2s;
        }

        .user-filter-input:focus,
        .user-filter-select:focus {
            outline: none;
            border-color: #0f0f0f;
        }

        .user-filter-btn {
            background: #0f0f0f;
            color: #fff;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            font-size: 0.7rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            padding: 10px 24px;
            border: none;
            border-radius: 30px;
            cursor: pointer;
            transition: background 0.2s;
            white-space: nowrap;
        }

        .user-filter-btn:hover { background: #333; }

        /* ── TABLE WRAP ── */
        .user-table-wrap {
            background: #fff;
            border: 1px solid #ebebeb;
            border-radius: 12px;
            overflow-x: auto;
        }

        .user-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 800px;
        }

        .user-table thead th {
            padding: 14px 20px;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #999;
            background: #fafafa;
            border-bottom: 1px solid #f0f0f0;
            text-align: left;
        }

        .user-table thead th.right { text-align: right; }

        .user-table tbody tr {
            border-bottom: 1px solid #f5f5f5;
            transition: background 0.15s;
        }

        .user-table tbody tr:last-child { border-bottom: none; }
        .user-table tbody tr:hover { background: #fafafa; }

        .user-table td {
            padding: 16px 20px;
            vertical-align: middle;
        }

        /* ── USER AVATAR ── */
        .user-avatar {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .user-avatar-img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
            background: #f5f5f5;
        }

        .user-avatar-placeholder {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #0f0f0f;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            font-weight: 600;
            color: #fff;
        }

        .user-name {
            font-size: 0.9rem;
            font-weight: 600;
            color: #1a1a1a;
        }

        /* ── BADGES ── */
        .user-badge {
            display: inline-block;
            padding: 4px 12px;
            font-size: 0.6rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            border-radius: 30px;
            text-transform: uppercase;
        }

        .user-badge-admin {
            background: #e3f2fd;
            color: #1565c0;
        }

        .user-badge-kurir {
            background: #fff3e0;
            color: #e65100;
        }

        .user-badge-customer {
            background: #e8eaf6;
            color: #3949ab;
        }

        .user-badge-active {
            background: #e8f5e9;
            color: #2e7d32;
        }

        .user-badge-inactive {
            background: #ffebee;
            color: #c62828;
        }

        /* ── TEXT UTILITIES ── */
        .user-text-small {
            font-size: 0.75rem;
            color: #aaa;
        }

        .user-text-email {
            font-size: 0.8rem;
            font-weight: 500;
            color: #666;
        }

        .user-text-phone {
            font-size: 0.7rem;
            color: #bbb;
            margin-top: 2px;
        }

        /* ── BLACK BUTTON STYLES ── */
        .btn-black-small {
            display: inline-block;
            padding: 6px 16px;
            background: #0f0f0f;
            color: #fff;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            text-decoration: none;
            border-radius: 30px;
            transition: all 0.2s ease;
            border: none;
            cursor: pointer;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }

        .btn-black-small:hover {
            background: #333;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

        .btn-black-danger {
            display: inline-block;
            padding: 6px 16px;
            background: #fff;
            color: #c62828;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            text-decoration: none;
            border-radius: 30px;
            transition: all 0.2s ease;
            border: 1px solid #ffcdd2;
            cursor: pointer;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }

        .btn-black-danger:hover {
            background: #c62828;
            color: #fff;
            border-color: #c62828;
            transform: translateY(-1px);
        }

        .btn-black-success {
            display: inline-block;
            padding: 6px 16px;
            background: #fff;
            color: #2e7d32;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            text-decoration: none;
            border-radius: 30px;
            transition: all 0.2s ease;
            border: 1px solid #c8e6c9;
            cursor: pointer;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }

        .btn-black-success:hover {
            background: #2e7d32;
            color: #fff;
            border-color: #2e7d32;
            transform: translateY(-1px);
        }

        .user-actions {
            display: flex;
            align-items: center;
            gap: 12px;
            justify-content: flex-end;
        }

        /* ── EMPTY STATE ── */
        .user-empty {
            padding: 72px 28px;
            text-align: center;
        }

        .user-empty-title {
            font-size: 1.1rem;
            font-weight: 500;
            color: #ccc;
            margin-bottom: 8px;
        }

        .user-empty-desc {
            font-size: 0.8rem;
            font-weight: 400;
            color: #ddd;
        }

        /* ── PAGINATION ── */
        .user-pagination {
            margin-top: 20px;
        }

        /* ── ALERT ── */
        .user-alert {
            padding: 12px 20px;
            margin-bottom: 20px;
            font-size: 0.75rem;
            border-left: 3px solid;
            background: #fff;
            border: 1px solid #ebebeb;
            border-left-width: 3px;
            border-radius: 8px;
        }

        .user-alert-success {
            border-left-color: #2e7d32;
            background: #e8f5e9;
            color: #2e7d32;
        }

        .user-alert-error {
            border-left-color: #c62828;
            background: #ffebee;
            color: #c62828;
        }
    </style>

    <div class="user-wrap">
        <div class="user-inner">

            
            <div class="user-topbar">
                <div>
                </div>
            </div>

            
            <div class="user-stats">
                <div class="user-stat-card">
                    <div class="user-stat-label">Total Customer</div>
                    <div class="user-stat-value"><?php echo e($stats['total_customers']); ?></div>
                </div>
                <div class="user-stat-card">
                    <div class="user-stat-label">Total Admin</div>
                    <div class="user-stat-value"><?php echo e($stats['total_admins']); ?></div>
                </div>
                <div class="user-stat-card">
                    <div class="user-stat-label">Total Kurir</div>
                    <div class="user-stat-value"><?php echo e($stats['total_couriers']); ?></div>
                </div>
                <div class="user-stat-card">
                    <div class="user-stat-label">Customer Aktif</div>
                    <div class="user-stat-value"><?php echo e($stats['active_customers']); ?></div>
                </div>
            </div>

            
            <?php if(session('success')): ?>
            <div class="user-alert user-alert-success"><?php echo e(session('success')); ?></div>
            <?php endif; ?>
            <?php if(session('error')): ?>
            <div class="user-alert user-alert-error"><?php echo e(session('error')); ?></div>
            <?php endif; ?>

            
            <div class="user-filter-wrap">
                <form method="GET" action="<?php echo e(route('admin.users.index')); ?>" class="user-filter-form">
                    <div class="user-filter-group">
                        <label class="user-filter-label">Cari Pengguna</label>
                        <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Nama, Email, atau HP" class="user-filter-input">
                    </div>
                    <div class="user-filter-group">
                        <label class="user-filter-label">Role</label>
                        <select name="role" class="user-filter-select">
                            <option value="customer" <?php echo e(request('role', 'customer') == 'customer' ? 'selected' : ''); ?>>Customer</option>
                            <option value="kurir" <?php echo e(request('role') == 'kurir' ? 'selected' : ''); ?>>Kurir</option>
                            <option value="admin" <?php echo e(request('role') == 'admin' ? 'selected' : ''); ?>>Admin</option>
                            <option value="all" <?php echo e(request('role') == 'all' ? 'selected' : ''); ?>>Semua</option>
                        </select>
                    </div>
                    <div class="user-filter-group">
                        <label class="user-filter-label">Status</label>
                        <select name="status" class="user-filter-select">
                            <option value="">Semua Status</option>
                            <option value="1" <?php echo e(request('status') == '1' ? 'selected' : ''); ?>>Aktif</option>
                            <option value="0" <?php echo e(request('status') == '0' ? 'selected' : ''); ?>>Nonaktif</option>
                        </select>
                    </div>
                    <div class="user-filter-group">
                        <button type="submit" class="user-filter-btn">Filter</button>
                    </div>
                </form>
            </div>

            
            <div class="user-table-wrap">
                <table class="user-table">
                    <thead>
                        <tr>
                            <th>Pengguna</th>
                            <th>Kontak</th>
                            <th>Role</th>
                            <th>Status</th>
                            <th>Orders</th>
                            <th>Bergabung</th>
                            <th class="right">Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td>
                                <div class="user-avatar">
                                    <?php if($user->avatar): ?>
                                        <img class="user-avatar-img" src="<?php echo e(\Storage::url($user->avatar)); ?>" alt="<?php echo e($user->name); ?>">
                                    <?php else: ?>
                                        <div class="user-avatar-placeholder"><?php echo e(strtoupper(substr($user->name, 0, 1))); ?></div>
                                    <?php endif; ?>
                                    <span class="user-name"><?php echo e($user->name); ?></span>
                                </div>
                            </td>
                            <td>
                                <div class="user-text-email"><?php echo e($user->email); ?></div>
                                <div class="user-text-phone"><?php echo e($user->phone ?? '-'); ?></div>
                            </td>
                            <td>
                                <?php if($user->role === 'admin'): ?>
                                    <span class="user-badge user-badge-admin">Admin</span>
                                <?php elseif($user->role === 'kurir'): ?>
                                    <span class="user-badge user-badge-kurir">Kurir</span>
                                <?php else: ?>
                                    <span class="user-badge user-badge-customer">Customer</span>
                                <?php endif; ?>
                            </td>
                            <td>
                                <?php if($user->is_active): ?>
                                    <span class="user-badge user-badge-active">Aktif</span>
                                <?php else: ?>
                                    <span class="user-badge user-badge-inactive">Nonaktif</span>
                                <?php endif; ?>
                            </td>
                            <td class="user-text-small">
                                <?php if($user->role === 'kurir'): ?>
                                    <?php echo e($user->courier_orders_count ?? 0); ?> diantar
                                <?php else: ?>
                                    <?php echo e($user->orders_count); ?> pesanan
                                <?php endif; ?>
                            </td>
                            <td class="user-text-small">
                                <div><?php echo e($user->created_at->format('d M Y')); ?></div>
                                <div class="user-text-phone"><?php echo e($user->created_at->format('H:i')); ?></div>
                            </td>
                            <td>
                                <div class="user-actions">
                                    <a href="<?php echo e(route('admin.users.show', $user)); ?>" class="btn-black-small">Detail</a>

                                    <form action="<?php echo e(route('admin.users.toggle-status', $user)); ?>" method="POST" class="inline"
                                          onsubmit="return confirm('<?php echo e($user->is_active ? 'Nonaktifkan' : 'Aktifkan'); ?> user \'<?php echo e($user->name); ?>\'?')">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('PATCH'); ?>
                                        <?php if($user->is_active): ?>
                                            <button type="submit" class="btn-black-danger">Nonaktifkan</button>
                                        <?php else: ?>
                                            <button type="submit" class="btn-black-success">Aktifkan</button>
                                        <?php endif; ?>
                                    </form>
                                </div>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="7">
                                <div class="user-empty">
                                    <div class="user-empty-title">Tidak ada data pengguna</div>
                                    <div class="user-empty-desc">Belum ada pengguna yang terdaftar</div>
                                </div>
                            </td>
                        </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>

            
            <?php if($users->hasPages()): ?>
            <div class="user-pagination">
                <?php echo e($users->links()); ?>

            </div>
            <?php endif; ?>

        </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 C:\laragon\www\pakaian\resources\views/admin/users/index.blade.php ENDPATH**/ ?>