<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('front.ranking.nav', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    
    <div class="card">
        <div class="card-header">
            <h2 class="card-title"><?php echo e(trans('ranking.faction')); ?> - <?php echo e(trans('ranking.type.' . Request::segment(3))); ?></h2>
        </div>
        <div class="card-body">
            <?php if($ranks->count() > 0): ?>
                <div class="space-y-4">
                    @php  $count = (($ranks->currentPage() - 1) * $ranks->perPage()) + 1 @endphp
                    <?php foreach($ranks as $rank): ?>
                        <div class="bg-dark-50 rounded-xl p-4 hover:bg-dark-100/50 transition-all duration-200 hover:scale-[1.01] group">
                            <div class="flex items-center justify-between">
                                <!-- Rank & Faction Info -->
                                <div class="flex items-center space-x-4">
                                    <!-- Rank Number -->
                                    <div class="flex-shrink-0">
                                        <?php if($count <= 3): ?>
                                            <div class="w-12 h-12 rounded-full flex items-center justify-center text-white font-bold text-lg
                                                <?php echo e($count == 1 ? 'bg-gradient-to-br from-yellow-400 to-yellow-600' : ''); ?>

                                                <?php echo e($count == 2 ? 'bg-gradient-to-br from-gray-300 to-gray-500' : ''); ?>

                                                <?php echo e($count == 3 ? 'bg-gradient-to-br from-amber-600 to-amber-800' : ''); ?>">
                                                <?php echo e($count); ?>

                                            </div>
                                        <?php else: ?>
                                            <div class="w-12 h-12 rounded-full bg-dark-200 flex items-center justify-center text-dark-600 font-bold">
                                                <?php echo e($count); ?>

                                            </div>
                                        <?php endif; ?>
                                    </div>

                                    <!-- Faction Details -->
                                    <div class="flex-1 min-w-0">
                                        <div class="flex items-center space-x-3 mb-2">
                                            <div class="w-10 h-10 bg-gradient-to-br from-purple-500/20 to-pink-500/20 rounded-lg flex items-center justify-center">
                                                <svg class="w-5 h-5 text-purple-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
                                                </svg>
                                            </div>
                                            <div>
                                                <h3 class="text-lg font-semibold text-dark-800 group-hover:text-primary-400 transition-colors">
                                                    <?php echo e($rank->name); ?>

                                                </h3>
                                                <div class="flex items-center space-x-2 text-sm text-dark-500">
                                                    <svg class="w-4 h-4" 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>
                                                    <span><?php echo e(trans('ranking.leader')); ?>: <?php echo e($rank->master_name); ?></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <!-- Ranking Value -->
                                <div class="text-right">
                                    <div class="text-2xl font-bold text-primary-400">
                                        <?php if(Request::is('ranking/*/level')): ?>
                                            <?php echo e($rank->level); ?>

                                        <?php elseif(Request::is('ranking/*/members')): ?>
                                            <?php echo e(number_format($rank->members)); ?>

                                        <?php elseif(Request::is('ranking/*/territories')): ?>
                                            <?php echo e(number_format($rank->territories)); ?>

                                        <?php elseif(Request::is('ranking/*/pvp')): ?>
                                            <?php echo e(number_format($rank->pk_count)); ?>

                                        <?php endif; ?>
                                    </div>
                                    <div class="text-xs text-dark-500 uppercase tracking-wide">
                                        <?php echo e(trans('ranking.type.' . Request::segment(3))); ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                        @php  $count++ @endphp
                    <?php endforeach; ?>
                </div>

                <!-- Pagination -->
                <?php if($ranks->hasPages()): ?>
                    <div class="flex justify-center mt-8">
                        <nav class="flex items-center space-x-1">
                            <?php /* Previous Page Link */ ?>
                            <?php if($ranks->onFirstPage()): ?>
                                <span class="px-3 py-2 text-sm text-dark-400 bg-dark-100 rounded-lg cursor-not-allowed">
                                    Previous
                                </span>
                            <?php else: ?>
                                <a href="<?php echo e($ranks->previousPageUrl()); ?>" 
                                   class="px-3 py-2 text-sm text-dark-600 bg-dark-100 border border-dark-200 rounded-lg hover:bg-dark-200/50 transition-colors">
                                    Previous
                                </a>
                            <?php endif; ?>

                            <?php /* Pagination Elements */ ?>
                            <?php foreach($ranks->getUrlRange(1, $ranks->lastPage()) as $page => $url): ?>
                                <?php if($page == $ranks->currentPage()): ?>
                                    <span class="px-3 py-2 text-sm text-white bg-primary-500 rounded-lg">
                                        <?php echo e($page); ?>

                                    </span>
                                <?php else: ?>
                                    <a href="<?php echo e($url); ?>" 
                                       class="px-3 py-2 text-sm text-dark-600 bg-dark-100 border border-dark-200 rounded-lg hover:bg-dark-200/50 transition-colors">
                                        <?php echo e($page); ?>

                                    </a>
                                <?php endif; ?>
                            <?php endforeach; ?>

                            <?php /* Next Page Link */ ?>
                            <?php if($ranks->hasMorePages()): ?>
                                <a href="<?php echo e($ranks->nextPageUrl()); ?>" 
                                   class="px-3 py-2 text-sm text-dark-600 bg-dark-100 border border-dark-200 rounded-lg hover:bg-dark-200/50 transition-colors">
                                    Next
                                </a>
                            <?php else: ?>
                                <span class="px-3 py-2 text-sm text-dark-400 bg-dark-100 rounded-lg cursor-not-allowed">
                                    Next
                                </span>
                            <?php endif; ?>
                        </nav>
                    </div>
                <?php endif; ?>
            <?php else: ?>
                <div class="text-center py-16">
                    <svg class="w-24 h-24 mx-auto text-dark-400 mb-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
                    </svg>
                    <h3 class="text-xl font-semibold text-dark-700 mb-2">No Faction Rankings Available</h3>
                    <p class="text-dark-500">There are no faction rankings to display at this time.</p>
                </div>
            <?php endif; ?>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('front.layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>