{% extends 'base.html' %}

{% block title %}Course Catalog{% endblock %}

{% block content %}
<div class="hero-section text-center py-5 bg-light">
    <div class="container">
        <h1 class="display-4">Welcome to Our Course Catalog</h1>
        <p class="lead">Find the perfect course to kickstart your learning journey.</p>
    </div>
</div>

<div class="row mt-4">
    {% for course in courses %}
    <div class="col-md-4 mb-4">
        <div class="card h-100">
            <div class="card-body">
                <h5 class="card-title">{{ course.title }}</h5>
                <h6 class="card-subtitle mb-2 text-muted">{{ course.instructor.name }}</h6>
                <p class="card-text">{{ course.description|truncatewords:20 }}</p>
                <a href="{% url 'course_detail' course.pk %}" class="btn btn-primary">View Details</a>
            </div>
            <div class="card-footer">
                <small class="text-muted">Price: ${{ course.price }}</small>
            </div>
        </div>
    </div>
    {% empty %}
    <div class="col">
        <p>No courses available at the moment.</p>
    </div>
    {% endfor %}
</div>
{% endblock %}
