<?php if (empty($apks) && !empty($_GET['search'])): ?>
    <div class="text-center py-5">
        <i class="bi bi-search display-1 text-muted opacity-25 mb-4"></i>
        <h3 class="fw-bold"><?php echo __('no_apks_found', 'No APKs found'); ?></h3>
        <p class="text-muted"><?php echo __('try_another_search', 'Try another search term or browse categories.'); ?></p>
        <a href="/" class="btn btn-outline-success rounded-pill px-4 mt-2"><?php echo __('view_all_apks', 'View All APKs'); ?></a>
    </div>
<?php else: ?>
    <div class="row g-2 g-md-4">
        <?php foreach ($apks as $apk): ?>
            <div class="col-4 col-md-4 col-lg-3">
                <div class="card h-100 border-0 shadow-sm rounded-4 hover-lift">
                    <div class="card-body p-2 p-md-3 text-center d-flex flex-column h-100">
                        <?php 
                            $icon = !empty($apk['icon_path']) ? '/'.$apk['icon_path'] : $apk['image_url'];
                        ?>
                        <div class="mx-auto mb-2" style="width: 50px; height: 50px; min-height: 50px;">
                            <img src="<?php echo $icon; ?>" class="rounded-3 shadow-sm" width="50" height="50" alt="<?php echo $apk['title']; ?>" style="object-fit: cover; width: 50px; height: 50px;">
                        </div>
                        
                        <h6 class="card-title fw-bold mb-1 text-truncate" style="font-size: 0.75rem;"><?php echo $apk['title']; ?></h6>
                        <div class="mb-2">
                            <span class="badge bg-light text-muted fw-normal x-small" style="font-size: 0.65rem;">v<?php echo $apk['version']; ?></span>
                        </div>
                        
                        <div class="mt-auto">
                            <a href="/apk/<?php echo $apk['slug']; ?>" class="btn btn-success rounded-pill py-1 btn-sm fw-medium w-100" style="font-size: 0.7rem;"><?php echo __('details'); ?></a>
                        </div>
                    </div>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
<?php endif; ?>