<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var $title
 * @var $page_title
 * @var $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);

$counters = $data['counters'] ?? [];
?>

<div class="max-w-2xl">
    <!-- Search Form -->
    <form action="./search/" method="get" class="mb-6">
        <label for="search" class="block text-sm font-medium text-gray-700 mb-2">
            <?= __('Look for the User') ?>
        </label>
        <div class="flex space-x-2">
            <input type="text" 
                   name="search" 
                   id="search" 
                   class="flex-1 px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors duration-200"
                   placeholder="<?= __('Nickname') ?>">
            <button type="submit" 
                    class="px-6 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200 shadow-sm">
                <?= __('Search') ?>
            </button>
        </div>
        <div class="text-gray-500 text-sm mt-2">
            <?= __('The search is performed by Nickname and are case-insensitive.') ?>
        </div>
    </form>

    <!-- Navigation Menu -->
    <div class="bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden">
        <!-- Users -->
        <a href="./users/" 
           class="flex justify-between items-center p-4 border-b border-gray-100 hover:bg-gray-50 transition-colors duration-150 group">
            <div class="flex items-center space-x-3">
                <svg class="w-5 h-5 text-gray-400 group-hover:text-blue-500 transition-colors duration-150" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"></path>
                </svg>
                <span class="font-medium text-gray-700 group-hover:text-blue-600 transition-colors duration-150">
                    <?= __('Users') ?>
                </span>
            </div>
            <span class="bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-sm font-medium group-hover:bg-blue-100 group-hover:text-blue-800 transition-colors duration-150">
                <?= $counters['usersCount'] ?>
            </span>
        </a>

        <!-- Administration -->
        <a href="./administration/" 
           class="flex justify-between items-center p-4 border-b border-gray-100 hover:bg-gray-50 transition-colors duration-150 group">
            <div class="flex items-center space-x-3">
                <svg class="w-5 h-5 text-gray-400 group-hover:text-red-500 transition-colors duration-150" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path>
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
                </svg>
                <span class="font-medium text-gray-700 group-hover:text-red-600 transition-colors duration-150">
                    <?= __('Administration') ?>
                </span>
            </div>
            <span class="bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-sm font-medium group-hover:bg-red-100 group-hover:text-red-800 transition-colors duration-150">
                <?= $counters['adminCount'] ?>
            </span>
        </a>

        <!-- Birthdays -->
        <?php if (! empty($counters['birthDays'])): ?>
            <a href="./birthdays/" 
               class="flex justify-between items-center p-4 border-b border-gray-100 hover:bg-gray-50 transition-colors duration-150 group">
                <div class="flex items-center space-x-3">
                    <svg class="w-5 h-5 text-gray-400 group-hover:text-yellow-500 transition-colors duration-150" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                    </svg>
                    <span class="font-medium text-gray-700 group-hover:text-yellow-600 transition-colors duration-150">
                        <?= __('Birthdays') ?>
                    </span>
                </div>
                <span class="bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-sm font-medium group-hover:bg-yellow-100 group-hover:text-yellow-800 transition-colors duration-150">
                    <?= $counters['birthDays'] ?>
                </span>
            </a>
        <?php endif ?>

        <!-- Top Activity -->
        <a href="./top/" 
           class="flex justify-between items-center p-4 hover:bg-gray-50 transition-colors duration-150 group">
            <div class="flex items-center space-x-3">
                <svg class="w-5 h-5 text-gray-400 group-hover:text-green-500 transition-colors duration-150" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
                </svg>
                <span class="font-medium text-gray-700 group-hover:text-green-600 transition-colors duration-150">
                    <?= __('Top Activity') ?>
                </span>
            </div>
            <svg class="w-4 h-4 text-gray-400 group-hover:text-green-500 transition-colors duration-150" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
            </svg>
        </a>
    </div>
</div>