{# Step 5: Timeline #}
<form hx-post="{{ url_for('leads.quote_step', step=5) }}"
      hx-target="#quote-step" hx-swap="innerHTML">
  <input type="hidden" name="_accumulated" value='{{ data | tojson }}'>
  <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

  <h2 class="q-step-title">{{ t.q5_heading }}</h2>
  <p class="q-step-sub">{{ t.q5_subheading }}</p>

  <div class="q-field-group">
    <span class="q-label">{{ t.q5_timeline_label }} <span class="required">*</span></span>
    {% if 'timeline' in errors %}<p class="q-error-hint">{{ t.q5_error_timeline }}</p>{% endif %}
    <div class="q-pills">
      {% for val, label in [('asap', t.q5_timeline_asap), ('3-6mo', t.q5_timeline_3_6), ('6-12mo', t.q5_timeline_6_12), ('12+mo', t.q5_timeline_12_plus)] %}
      <label><input type="radio" name="timeline" value="{{ val }}" {{ 'checked' if data.get('timeline') == val }}><span class="q-pill">{{ label }}</span></label>
      {% endfor %}
    </div>
  </div>

  <div class="q-field-group">
    <label class="q-label" for="budget_estimate">{{ t.q5_budget_label }}</label>
    <input type="number" id="budget_estimate" name="budget_estimate" class="q-input" placeholder="e.g. 500000" min="0" step="10000" value="{{ data.get('budget_estimate', '') }}">
  </div>

  <div class="q-nav">
    <button type="button" class="q-btn-back"
            hx-get="{{ url_for('leads.quote_step', step=4, _accumulated=data | tojson) }}"
            hx-target="#quote-step" hx-swap="innerHTML">{{ t.q_btn_back }}</button>
    <button type="submit" class="q-btn-next">{{ t.q_btn_next }}</button>
  </div>
</form>

<div id="q-progress" hx-swap-oob="innerHTML">
  <div class="q-progress__meta">
    <span class="q-progress__label">{{ steps[step - 1].title }}</span>
    <span class="q-progress__count">{{ t.q_step_counter | tformat(step=step, total=steps|length) }}</span>
  </div>
  <div class="q-progress__track">
    <div class="q-progress__fill" style="width: {{ (step / steps|length * 100) | round }}%"></div>
  </div>
</div>
