{% extends 'base/base.html' %}
{% load static %}

{% block title %}ThrillWiki - Theme Parks & Attractions Guide{% endblock %}

{% block content %}
<!-- Hero Section -->
<div class="mb-12 bg-white border border-gray-200 rounded-lg shadow-lg dark:bg-gray-800 dark:border-gray-700">
    <div class="px-4 py-12 text-center">
        <h1 class="mb-6 text-4xl font-bold text-gray-900 md:text-5xl lg:text-6xl dark:text-white">
            Welcome to ThrillWiki
        </h1>
        <p class="max-w-3xl mx-auto mb-8 text-xl text-gray-600 md:text-2xl dark:text-gray-300">
            Your ultimate guide to theme parks and attractions worldwide
        </p>
        <div class="flex flex-wrap justify-center gap-4">
            <a href="{% url 'parks:park_list' %}" 
               class="px-8 py-3 text-lg btn-primary">
                Explore Parks
            </a>
            <a href="{% url 'parks:all_rides' %}" 
               class="px-8 py-3 text-lg btn-secondary">
                View Rides
            </a>
        </div>
    </div>
</div>

<!-- Stats Section -->
<div class="grid grid-cols-1 gap-6 mb-12 md:grid-cols-3">
    <!-- Total Parks -->
    <div class="p-6 text-center transition-transform transform bg-white rounded-lg shadow-lg dark:bg-gray-800 hover:-translate-y-1">
        <div class="mb-2 text-4xl font-bold text-blue-600 dark:text-blue-400">
            {{ stats.total_parks }}
        </div>
        <div class="text-xl text-gray-600 dark:text-gray-300">
            Theme Parks
        </div>
    </div>

    <!-- Total Attractions -->
    <div class="p-6 text-center transition-transform transform bg-white rounded-lg shadow-lg dark:bg-gray-800 hover:-translate-y-1">
        <div class="mb-2 text-4xl font-bold text-blue-600 dark:text-blue-400">
            {{ stats.total_rides }}
        </div>
        <div class="text-xl text-gray-600 dark:text-gray-300">
            Attractions
        </div>
    </div>

    <!-- Total Roller Coasters -->
    <div class="p-6 text-center transition-transform transform bg-white rounded-lg shadow-lg dark:bg-gray-800 hover:-translate-y-1">
        <div class="mb-2 text-4xl font-bold text-blue-600 dark:text-blue-400">
            {{ stats.total_roller_coasters }}
        </div>
        <div class="text-xl text-gray-600 dark:text-gray-300">
            Roller Coasters
        </div>
    </div>
</div>

<!-- Featured Content -->
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
    <!-- Popular Parks -->
    <div class="p-6 bg-white rounded-lg shadow-lg dark:bg-gray-800">
        <h2 class="mb-6 text-2xl font-bold text-gray-900 dark:text-white">
            Popular Parks
        </h2>
        {% for park in popular_parks %}
            <a href="{% url 'parks:park_detail' park.slug %}" 
               class="block p-4 mb-4 transition-all rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 hover:translate-x-2">
                <div class="text-lg font-semibold text-blue-600 dark:text-blue-400">
                    {{ park.name }}
                </div>
                <div class="text-gray-600 dark:text-gray-300">
                    {{ park.location }}
                </div>
                {% if park.average_rating %}
                    <div class="flex items-center mt-1 text-yellow-500">
                        <span class="mr-1">★</span>
                        <span>{{ park.average_rating|floatformat:1 }}/10</span>
                    </div>
                {% endif %}
            </a>
        {% empty %}
            <p class="text-gray-600 dark:text-gray-400">No popular parks found.</p>
        {% endfor %}
    </div>

    <!-- Popular Rides -->
    <div class="p-6 bg-white rounded-lg shadow-lg dark:bg-gray-800">
        <h2 class="mb-6 text-2xl font-bold text-gray-900 dark:text-white">
            Popular Rides
        </h2>
        {% for ride in popular_rides %}
            <a href="{% url 'parks:rides:ride_detail' ride.park.slug ride.slug %}" 
               class="block p-4 mb-4 transition-all rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 hover:translate-x-2">
                <div class="text-lg font-semibold text-blue-600 dark:text-blue-400">
                    {{ ride.name }}
                </div>
                <div class="text-gray-600 dark:text-gray-300">
                    at {{ ride.park.name }}
                </div>
                {% if ride.average_rating %}
                    <div class="flex items-center mt-1 text-yellow-500">
                        <span class="mr-1">★</span>
                        <span>{{ ride.average_rating|floatformat:1 }}/10</span>
                    </div>
                {% endif %}
            </a>
        {% empty %}
            <p class="text-gray-600 dark:text-gray-400">No popular rides found.</p>
        {% endfor %}
    </div>
</div>
{% endblock %}
