{% for ride in rides %}
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden transform transition-transform hover:-translate-y-1">
    {% if ride.photos.first %}
        <img src="{{ ride.photos.first.image.url }}" 
             alt="{{ ride.name }}"
             class="w-full h-48 object-cover">
    {% else %}
        <div class="w-full h-48 bg-gray-200 dark:bg-gray-700 flex items-center justify-center">
            <span class="text-gray-400">No image available</span>
        </div>
    {% endif %}
    
    <div class="p-4">
        <h3 class="text-xl font-semibold mb-2">
            <a href="{% url 'rides:ride_detail' park_slug=ride.park.slug ride_slug=ride.slug %}" 
               class="text-blue-600 dark:text-blue-400 hover:underline">{{ ride.name }}</a>
        </h3>
        <p class="text-gray-600 dark:text-gray-400 mb-2">
            at <a href="{% url 'parks:park_detail' slug=ride.park.slug %}" 
                  class="text-blue-600 dark:text-blue-400 hover:underline">{{ ride.park.name }}</a>
        </p>
        <div class="flex justify-between items-center">
            <span class="text-sm text-gray-500 dark:text-gray-400">{{ ride.get_category_display }}</span>
            {% if ride.average_rating %}
                <div class="flex items-center">
                    <span class="text-yellow-400 mr-1">★</span>
                    <span class="text-gray-600 dark:text-gray-400">{{ ride.average_rating|floatformat:1 }}/10</span>
                </div>
            {% endif %}
        </div>
        {% if ride.category == 'RC' and ride.coaster_stats %}
            <div class="mt-2 text-sm text-gray-600 dark:text-gray-400">
                {% if ride.coaster_stats.height_ft %}
                    <div>Height: {{ ride.coaster_stats.height_ft|floatformat:0 }}ft</div>
                {% endif %}
                {% if ride.coaster_stats.speed_mph %}
                    <div>Speed: {{ ride.coaster_stats.speed_mph|floatformat:0 }}mph</div>
                {% endif %}
                <div>Inversions: {{ ride.coaster_stats.inversions }}</div>
            </div>
        {% endif %}
        {% if ride.status != 'OPERATING' %}
            <div class="mt-2">
                <span class="px-2 py-1 text-xs rounded-full
                    {% if ride.status == 'CLOSED_TEMP' %}bg-yellow-100 text-yellow-800
                    {% elif ride.status == 'CLOSED_PERM' %}bg-red-100 text-red-800
                    {% elif ride.status == 'UNDER_CONSTRUCTION' %}bg-blue-100 text-blue-800
                    {% elif ride.status == 'DEMOLISHED' %}bg-gray-100 text-gray-800
                    {% endif %}">
                    {{ ride.get_status_display }}
                </span>
            </div>
        {% endif %}
    </div>
</div>
{% empty %}
<div class="col-span-full text-center py-8">
    <p class="text-gray-500 dark:text-gray-400">No rides found matching your criteria.</p>
</div>
{% endfor %}
