{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <h1>{{ category.name }} Tours</h1>
    
    <div class="row row-cols-1 row-cols-md-3 g-4">
        {% for tour in tours %}
        <div class="col">
            <div class="card h-100">
                {% if tour.image_url %}
                <img src="{{ tour.image_url }}" class="card-img-top" alt="{{ tour.name }}">
                {% endif %}
                <div class="card-body">
                    <h5 class="card-title">{{ tour.name }}</h5>
                    <p class="card-text">{{ tour.description | truncate(100) }}</p>
                    <p class="card-text"><small class="text-muted">Duration: {{ tour.duration }} days</small></p>
                    <p class="card-text"><strong>Price: ${{ tour.price }}</strong></p>
                    <a href="{{ url_for('main.tour_detail', tour_id=tour.id) }}" class="btn btn-primary">View Details</a>
                </div>
            </div>
        </div>
        {% else %}
        <div class="col-12">
            <p>No tours available for this category at the moment.</p>
        </div>
        {% endfor %}
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // You can add any JavaScript specific to this page here
        console.log('Category Tours page loaded');
        
        // Example: Add event listeners to tour cards
        const tourCards = document.querySelectorAll('.card');
        tourCards.forEach(card => {
            card.addEventListener('mouseenter', function() {
                this.style.transform = 'scale(1.05)';
                this.style.transition = 'transform 0.3s ease-in-out';
            });
            card.addEventListener('mouseleave', function() {
                this.style.transform = 'scale(1)';
            });
        });
    });
</script>
{% endblock %}
