{% load static i18n %}
{% load widget_tweaks %}

<div class="p-3" id="reschedule-meeting-form">
    <div class="d-flex justify-content-between align-items-center mb-3">
        <div>
            <h5 class="mb-1" style="color: var(--kaauh-teal-dark); font-weight: 700;">
                <i class="fas fa-redo-alt me-1"></i>
                {% trans "Update Interview" %} for {{ candidate.name }}
            </h5>
            <p class="text-muted mb-0 small">{% trans "Job" %}: {{ job.title }}</p>
             {% if has_future_meeting %}
                <div class="alert alert-info mt-2 mb-0 p-2 small" role="alert">
                    <i class="fas fa-info-circle me-1"></i>
                    {% trans "You are updating the existing meeting schedule." %}
                </div>
            {% endif %}
        </div>
    </div>

    <div>
        <form method="post" id="updateMeeting" action="{% url 'reschedule_meeting_for_candidate' job.slug candidate.pk meeting.pk %}">
            {% csrf_token %}

            <div class="mb-3">
                <label for="{{ form.topic.id_for_label }}" class="form-label small">
                    {% trans "Meeting Topic" %}
                </label>
                {{ form.topic|add_class:"form-control" }}
                {% for error in form.topic.errors %}
                    <div class="text-danger small mt-1">{{ error }}</div>
                {% endfor %}
            </div>

            <div class="row">
                <div class="col-md-7">
                    <div class="mb-3">
                        <label for="{{ form.start_time.id_for_label }}" class="form-label small">
                            {% trans "Start Time" %} (Date & Time)
                        </label>
                        {{ form.start_time|add_class:"form-control" }}
                        {% for error in form.start_time.errors %}
                            <div class="text-danger small mt-1">{{ error }}</div>
                        {% endfor %}
                    </div>
                </div>

                <div class="col-md-5">
                    <div class="mb-3">
                        <label for="{{ form.duration.id_for_label }}" class="form-label small">
                            {% trans "Duration (minutes)" %}
                        </label>
                        {{ form.duration|add_class:"form-control" }}
                        {% for error in form.duration.errors %}
                            <div class="text-danger small mt-1">{{ error }}</div>
                        {% endfor %}
                    </div>
                </div>
            </div>

            <hr style="border-top: 1px solid var(--kaauh-border); margin-top: 1.5rem; margin-bottom: 1.5rem;">

            <div class="d-flex justify-content-end gap-2">
                <button type="submit" class="btn btn-main-action btn-sm">
                    <i class="fas fa-save me-1"></i> {% trans "Update Meeting" %}
                </button>
            </div>
        </form>
    </div>
</div>