{% extends "base.html" %}

{% block title %}{{ page_title }}{% endblock %}
{% block meta_description %}{{ meta_description }}{% endblock %}

{% block content %}
<section class="form-hero">
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-lg-9">
        <span class="eyebrow">Offer intake</span>
        <h1>Add a normalized job offer</h1>
        <p class="lead">This manual intake mirrors the future scraper output: one source, one cleaned offer, ready for search and review.</p>
      </div>
    </div>
  </div>
</section>
<section class="section-pad pt-0">
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-lg-10">
        <form class="app-form glass-card" method="post" novalidate>
          {% csrf_token %}
          {% include "core/partials/form_errors.html" with form=form %}
          <div class="row g-4">
            {% for field in form %}
            <div class="col-md-{% if field.name == 'description' %}12{% elif field.name == 'remote' or field.name == 'is_active' %}6 check-column{% else %}6{% endif %}">
              {% if field.field.widget.input_type == 'checkbox' %}
              <div class="form-check form-switch mt-4">
                {{ field }}
                <label class="form-check-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
              </div>
              {% else %}
              <label class="form-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
              {{ field }}
              {% endif %}
              {% if field.help_text %}<div class="form-text">{{ field.help_text }}</div>{% endif %}
              {% for error in field.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
            </div>
            {% endfor %}
          </div>
          <div class="d-flex flex-wrap gap-3 mt-4">
            <button class="btn btn-accent btn-lg rounded-pill px-4" type="submit">Save offer</button>
            <a class="btn btn-outline-dark btn-lg rounded-pill px-4" href="{% url 'job_list' %}">Cancel</a>
          </div>
        </form>
      </div>
    </div>
  </div>
</section>
{% endblock %}
