{% extends 'base.html' %}

{% block title %}
    Define Form for {{ job.title }}
{% endblock %}

{% block content %}
<div class="container my-5">
    <div class="row justify-content-center">
        <div class="col-lg-8 col-md-10">
            
            <div class="card shadow-lg border-0 p-4 p-md-5">
                
                <h2 class="card-title text-center mb-4 text-primary">
                    🛠️ New Application Form Configuration
                </h2>
                
                <p class="text-center text-muted mb-4 border-bottom pb-3">
                    You are creating a new form structure for job: <strong>{{ job.title }}</strong>
                </p>
                
                <form method="post" novalidate>
                    {% csrf_token %}

                    <fieldset class="mb-5">
                        <legend class="h5 mb-3 text-secondary">Form Metadata</legend>

                        <div class="form-group mb-4">
                            <label for="{{ form.name.id_for_label }}" class="form-label required">
                                Form Name
                            </label>
                            {# The field should already have form-control applied from the backend #}
                            {{ form.name }}
                            
                            {% if form.name.errors %}
                                <div class="text-danger small mt-1">{{ form.name.errors }}</div>
                            {% endif %}
                        </div>

                        <div class="form-group mb-4">
                            <label for="{{ form.description.id_for_label }}" class="form-label">
                                Description
                            </label>
                            {# The field should already have form-control applied from the backend #}
                            {{ form.description}}
                            
                            {% if form.description.errors %}
                                <div class="text-danger small mt-1">{{ form.description.errors }}</div>
                            {% endif %}
                        </div>
                    </fieldset>

                    <div class="d-flex justify-content-end gap-3 pt-3">
                        <a href="{% url 'applicant:job_forms_list' job.internal_job_id %}" 
                           class="btn btn-outline-secondary">
                            Cancel
                        </a>
                        <button type="submit" class="btn btn-primary btn-lg">
                            Create Form & Continue &rarr;
                        </button>
                    </div>

                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}