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

{% block title %}Add Media - {{ project.title }}{% endblock %}

{% block content %}
<h1><i class="fas fa-images"></i> Add media — {{ project.title }}</h1>
<p><a href="{% url 'library:project_detail' project.slug %}">&larr; Back to project</a></p>

<form method="post" class="card project-form" id="asset-form">
    {% csrf_token %}

    <div class="upload-zone" data-upload="media">
        <div class="drop-zone" role="button" tabindex="0">
            <div class="drop-zone-inner">
                <i class="fas fa-cloud-upload-alt drop-zone-icon"></i>
                <p class="drop-zone-text">Drag &amp; drop media here</p>
                <p class="drop-zone-sub">or click to browse — images, videos or gifs, several at once</p>
            </div>
        </div>
        <input type="file" id="media-input" accept="image/*,video/*" multiple hidden>
        <div class="upload-batch" id="media-batch" hidden>
            <i class="fas fa-circle-notch fa-spin"></i>
            <span class="upload-batch-status" id="media-batch-status"></span>
        </div>
        <div class="file-preview-grid" id="media-preview"></div>
    </div>

    <div class="form-actions">
        <button type="submit" class="btn btn-primary"><i class="fas fa-check"></i> Add to gallery</button>
    </div>
</form>

{{ pending_uploads|json_script:'packs-pending-uploads' }}
{% endblock %}

{% block extra_js %}
<script src="{% static 'js/uploads.js' %}"></script>
<script src="{% static 'js/asset_upload.js' %}"></script>
{% endblock %}
