<!-- Parks Grid -->
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
    {% for park in parks %}
        <div class="overflow-hidden transition-transform transform bg-white rounded-lg shadow-lg dark:bg-gray-800 hover:-translate-y-1">
            {% if park.photos.exists %}
                <div class="aspect-w-16 aspect-h-9">
                    <img src="{{ park.photos.first.image.url }}" 
                         alt="{{ park.name }}"
                         class="object-cover w-full">
                </div>
            {% endif %}
            <div class="p-4">
                <h2 class="mb-2 text-xl font-bold">
                    <a href="{% url 'parks:park_detail' park.slug %}" 
                       class="text-gray-900 hover:text-blue-600 dark:text-white dark:hover:text-blue-400">
                        {{ park.name }}
                    </a>
                </h2>
                <p class="mb-3 text-gray-600 dark:text-gray-400">
                    <i class="mr-1 fas fa-map-marker-alt"></i>
                    {{ park.location }}
                </p>
                <div class="flex flex-wrap gap-2">
                    <span class="status-badge {% if park.status == 'OPERATING' %}status-operating
                               {% elif park.status == 'CLOSED_TEMP' or park.status == 'CLOSED_PERM' %}status-closed
                               {% elif park.status == 'UNDER_CONSTRUCTION' %}status-construction
                               {% elif park.status == 'DEMOLISHED' %}status-demolished
                               {% elif park.status == 'RELOCATED' %}status-relocated{% endif %}">
                        {{ park.get_status_display }}
                    </span>
                    {% if park.average_rating %}
                        <span class="text-yellow-800 bg-yellow-100 status-badge dark:bg-yellow-400/30 dark:text-yellow-200 dark:ring-1 dark:ring-yellow-400/30">
                            <i class="mr-1 text-yellow-500 fas fa-star dark:text-yellow-300"></i>
                            {{ park.average_rating|floatformat:1 }}/10
                        </span>
                    {% endif %}
                </div>
                <div class="flex items-center justify-between mt-4">
                    <a href="{% url 'parks:rides:ride_list' park.slug %}" 
                       class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300">
                        {{ park.rides.count }} attractions <i class="ml-1 fas fa-arrow-right"></i>
                    </a>
                    {% if park.owner %}
                        <a href="{% url 'companies:company_detail' park.owner.slug %}" 
                           class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300">
                            {{ park.owner.name }}
                        </a>
                    {% endif %}
                </div>
            </div>
        </div>
    {% empty %}
        <div class="col-span-3 py-8 text-center">
            <p class="text-gray-500 dark:text-gray-400">No parks found matching your criteria.</p>
        </div>
    {% endfor %}
</div>

<!-- Pagination -->
{% if is_paginated %}
<div class="flex justify-center mt-6">
    <div class="inline-flex rounded-md shadow-sm">
        {% if page_obj.has_previous %}
            <a href="?page=1{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border border-gray-300 rounded-l-lg hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">&laquo; First</a>
            <a href="?page={{ page_obj.previous_page_number }}{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border-t border-b border-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Previous</a>
        {% endif %}

        <span class="px-3 py-2 text-gray-700 bg-white border border-gray-300 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300">
            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
        </span>

        {% if page_obj.has_next %}
            <a href="?page={{ page_obj.next_page_number }}{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border-t border-b border-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Next</a>
            <a href="?page={{ page_obj.paginator.num_pages }}{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border border-gray-300 rounded-r-lg hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Last &raquo;</a>
        {% endif %}
    </div>
</div>
{% endif %}
