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

{% block title %}Dashboard - PI Case Management{% endblock %}

{% block content %}
<div class="hero-section text-center p-5 rounded-3 mb-4">
    <h1 class="display-4">Case Dashboard</h1>
    <p class="lead">Welcome to your private investigation case management system.</p>
    <a href="/admin/core/case/add/" class="btn btn-primary btn-lg">Add New Case</a>
</div>

<h2 class="mb-4">Active Cases</h2>

<div class="row">
    {% for case in cases %}
    <div class="col-md-6 col-lg-4 mb-4">
        <div class="card h-100 case-card">
            <div class="card-body">
                <h5 class="card-title">{{ case.case_title }}</h5>
                <h6 class="card-subtitle mb-2 text-muted">Case #{{ case.case_number }}</h6>
                <p class="card-text"><strong>Client:</strong> {{ case.client.name }}</p>
                <p class="card-text"><strong>Status:</strong> <span class="badge status-{{ case.status|lower }}">{{ case.get_status_display }}</span></p>
                <p class="card-text">{{ case.description|truncatewords:20 }}</p>
            </div>
            <div class="card-footer text-end">
                 <a href="#" class="btn btn-secondary btn-sm">View Details</a>
            </div>
        </div>
    </div>
    {% empty %}
    <div class="col">
        <div class="alert alert-info" role="alert">
            No cases found. <a href="/admin/core/case/add/" class="alert-link">Create your first case</a> to get started.
        </div>
    </div>
    {% endfor %}
</div>
{% endblock %}
