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

<div class="p-3" id="reschedule-onsite-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 Onsite Interview" %} for **{{ candidate.name }}**
            </h5>
            <p class="text-muted mb-0 small">{% trans "Job" %}: {{ job.title }}</p>
            <p class="text-muted mb-0 small">{% trans "Location Type" %}: <span class="badge bg-info">{% trans "Onsite" %}</span></p>
        </div>
    </div>

    <div>
        <form method="post" id="updateOnsiteMeeting" 
              action="{% url 'reschedule_onsite_meeting' job.slug candidate.pk meeting.pk %}">
            {% csrf_token %}
            
            <hr style="border-top: 1px solid var(--kaauh-border); margin-bottom: 1.5rem;">

            {# --- STATUS FIELD (Now Visible and Selectable) --- #}
            <div class="mb-3">
                <label for="{{ form.status.id_for_label }}" class="form-label small">
                    <i class="fas fa-info-circle me-1"></i> {% trans "Meeting Status" %}
                </label>
                {{ form.status|add_class:"form-select" }}
                {% for error in form.status.errors %}
                    <div class="text-danger small mt-1">{{ error }}</div>
                {% endfor %}
            </div>
            
            <div class="row">
                {# --- TOPIC FIELD --- #}
                <div class="col-md-7">
                    <div class="mb-3">
                        <label for="{{ form.topic.id_for_label }}" class="form-label small">
                            <i class="fas fa-tag me-1"></i> {% 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>

                {# --- ROOM NUMBER FIELD --- #}
                <div class="col-md-5">
                    <div class="mb-3">
                        <label for="{{ form.room_number.id_for_label }}" class="form-label small">
                            <i class="fas fa-door-open me-1"></i> {% trans "Room Number/Name" %}
                        </label>
                        {{ form.room_number|add_class:"form-control" }}
                        {% for error in form.room_number.errors %}
                            <div class="text-danger small mt-1">{{ error }}</div>
                        {% endfor %}
                    </div>
                </div>
            </div>


            {# --- ADDRESS FIELD --- #}
            <div class="mb-3">
                <label for="{{ form.physical_address.id_for_label }}" class="form-label small">
                    <i class="fas fa-map-marker-alt me-1"></i> {% trans "Physical Address" %}
                </label>
                {{ form.physical_address|add_class:"form-control" }}
                {% for error in form.physical_address.errors %}
                    <div class="text-danger small mt-1">{{ error }}</div>
                {% endfor %}
            </div>
            
            <hr style="border-top: 1px solid var(--kaauh-border); margin-top: 1.5rem; margin-bottom: 1.5rem;">

            <div class="row">
                {# --- START TIME FIELD --- #}
                <div class="col-md-7">
                    <div class="mb-3">
                        <label for="{{ form.start_time.id_for_label }}" class="form-label small">
                            <i class="fas fa-clock me-1"></i> {% 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>

                {# --- DURATION FIELD --- #}
                <div class="col-md-5">
                    <div class="mb-3">
                        <label for="{{ form.duration.id_for_label }}" class="form-label small">
                            <i class="fas fa-hourglass-half me-1"></i> {% 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>

            <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>