{% extends "base.html" %}

{% block content %}
<div class="container py-5">
    <!-- Header -->
    <div class="d-flex justify-content-between align-items-center mb-5">
        <div>
            <h1 class="text-cyan font-syncopate display-4">Biblioteca de Assets</h1>
            <p class="text-secondary">Catálogo central de personagens, cenários e objetos digitais.</p>
        </div>
        <div class="glass-effect p-3 border-purple rounded">
            <span class="text-purple small d-block">Total de Assets</span>
            <span class="h3 text-white mb-0">{{ assets|length }}</span>
        </div>
    </div>

    <!-- Asset Tabs/Filters -->
    <ul class="nav nav-pills mb-4" id="assetTabs" role="tablist">
        <li class="nav-item">
            <button class="nav-link active btn-outline-cyan me-2" id="all-tab" data-bs-toggle="pill" data-bs-target="#all">Todos</button>
        </li>
        <li class="nav-item">
            <button class="nav-link btn-outline-purple me-2" id="char-tab" data-bs-toggle="pill" data-bs-target="#char">Personagens</button>
        </li>
        <li class="nav-item">
            <button class="nav-link btn-outline-purple me-2" id="prop-tab" data-bs-toggle="pill" data-bs-target="#prop">Props</button>
        </li>
        <li class="nav-item">
            <button class="nav-link btn-outline-purple" id="env-tab" data-bs-toggle="pill" data-bs-target="#env">Cenários</button>
        </li>
    </ul>

    <div class="tab-content" id="assetTabsContent">
        <!-- All Assets -->
        <div class="tab-pane fade show active" id="all">
            <div class="row g-4">
                {% for asset in assets %}
                <div class="col-md-4 col-lg-3">
                    <div class="card h-100 bg-dark border-secondary glass-effect hover-neon">
                        <div class="card-body">
                            <div class="d-flex justify-content-between mb-2">
                                <span class="badge bg-purple">{{ asset.get_asset_type_display }}</span>
                                <span class="text-secondary small">v{{ asset.version }}</span>
                            </div>
                            <h5 class="card-title text-white mb-1">{{ asset.name }}</h5>
                            <p class="text-secondary small mb-3">Projeto: {{ asset.project.title }}</p>
                            
                            <div class="border-top border-secondary pt-2">
                                <span class="text-cyan small"><i class="bi bi-gear"></i> {{ asset.current_stage }}</span>
                            </div>
                        </div>
                    </div>
                </div>
                {% empty %}
                <div class="col-12 text-center py-5">
                    <p class="text-secondary">Nenhum asset cadastrado ainda.</p>
                </div>
                {% endfor %}
            </div>
        </div>

        <!-- Personagens -->
        <div class="tab-pane fade" id="char">
            <div class="row g-4">
                {% for asset in asset_types.CHAR %}
                <div class="col-md-4 col-lg-3">
                    <!-- Similar card as above -->
                    <div class="card h-100 bg-dark border-purple glass-effect">
                        <div class="card-body">
                            <h5 class="text-white">{{ asset.name }}</h5>
                            <p class="text-secondary small">{{ asset.project.title }}</p>
                        </div>
                    </div>
                </div>
                {% endfor %}
            </div>
        </div>
        <!-- (Other tabs could be detailed further if needed) -->
    </div>
</div>

<style>
    .nav-pills .nav-link { color: white; border: 1px solid transparent; }
    .nav-pills .nav-link.active { background-color: transparent !important; border-color: var(--electric-cyan); color: var(--electric-cyan); }
    .hover-neon:hover { border-color: var(--electric-cyan) !important; box-shadow: 0 0 10px rgba(0,229,255,0.3); }
    .btn-outline-cyan { border: 1px solid var(--electric-cyan); }
    .btn-outline-purple { border: 1px solid var(--neon-purple); }
</style>
{% endblock %}
