{% for ride in rides %}
    <div class="overflow-hidden transition-transform transform bg-white rounded-lg shadow-lg dark:bg-gray-800 hover:-translate-y-1">
        {% if ride.photos.exists %}
            <div class="aspect-w-16 aspect-h-9">
                <img src="{{ ride.photos.first.image.url }}" 
                     alt="{{ ride.name }}"
                     class="object-cover w-full">
            </div>
        {% endif %}
        <div class="p-4">
            <h2 class="mb-2 text-xl font-bold">
                <a href="{% url 'parks:rides:ride_detail' ride.park.slug ride.slug %}" 
                   class="text-gray-900 hover:text-blue-600 dark:text-white dark:hover:text-blue-400">
                    {{ ride.name }}
                </a>
            </h2>
            {% if not park %}
                <p class="mb-3 text-gray-600 dark:text-gray-400">
                    at <a href="{% url 'parks:park_detail' ride.park.slug %}" 
                        class="text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300">
                        {{ ride.park.name }}
                    </a>
                </p>
            {% endif %}
            <div class="flex flex-wrap gap-2">
                <span class="text-blue-800 bg-blue-100 status-badge dark:bg-blue-400/30 dark:text-blue-200 dark:ring-1 dark:ring-blue-400/30">
                    {{ ride.get_category_display }}
                </span>
                <span class="status-badge {% if ride.status == 'OPERATING' %}status-operating
                           {% elif ride.status == 'CLOSED_TEMP' or ride.status == 'CLOSED_PERM' %}status-closed
                           {% elif ride.status == 'UNDER_CONSTRUCTION' %}status-construction
                           {% elif ride.status == 'DEMOLISHED' %}status-demolished
                           {% elif ride.status == 'RELOCATED' %}status-relocated{% endif %}">
                    {{ ride.get_status_display }}
                </span>
                {% if ride.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>
                        {{ ride.average_rating|floatformat:1 }}/10
                    </span>
                {% endif %}
            </div>
            {% if ride.coaster_stats %}
                <div class="grid grid-cols-2 gap-2 mt-4">
                    {% if ride.coaster_stats.height_ft %}
                        <div class="text-sm text-gray-600 dark:text-gray-400">
                            Height: {{ ride.coaster_stats.height_ft }}ft
                        </div>
                    {% endif %}
                    {% if ride.coaster_stats.speed_mph %}
                        <div class="text-sm text-gray-600 dark:text-gray-400">
                            Speed: {{ ride.coaster_stats.speed_mph }}mph
                        </div>
                    {% endif %}
                </div>
            {% endif %}
        </div>
    </div>
{% empty %}
    <div class="col-span-3 py-8 text-center">
        <p class="text-gray-500 dark:text-gray-400">No rides found matching your criteria.</p>
    </div>
{% endfor %}
