<editable-form id="skills" class="block">
  <form
    id="form-skills"
    hx-post="{{ form.post_url }}"
    hx-target="#skills"
    hx-swap="outerHTML"
    class="bg-white rounded-lg p-6 border border-slate-300 shadow-sm space-y-6"
  >
    <input id="form-skills-badges" type="hidden" data-field="badges" name="badges" value="{{ form.badges_as_json }}">

    <div class="flex items-center justify-between mb-6">
      <div class="flex items-center space-x-2">
        <div class="w-3 h-3 bg-blue-500 rounded-full"></div>
        <span class="text-sm font-medium text-slate-600">Editing Skills</span>
      </div>
      <span class="text-xs text-slate-500 bg-slate-200 px-2 py-1 rounded-full">Draft</span>
    </div>

    <div>
      <label class="block text-sm font-medium text-slate-700 mb-2">Skills & Technologies</label>
      <p class="text-sm text-slate-500 mb-4">Add skills one by one. Type a skill and click Add.</p>
      <div class="min-h-[120px] bg-white rounded-lg px-4 py-3 border border-slate-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200">
        <badge-editor
          input-field-id="form-skills-badges"
          ul-class="skills-badges-container"
          li-class="skill-badge"
          span-class="skill-name"
        ></badge-editor>
      </div>
      {% for error in form.badges.errors %}
        <p class="mt-2 text-sm text-red-600 bg-red-50 p-2 rounded-lg">{{ error|escape }}</p>
      {% endfor %}
    </div>

    <div class="flex items-center justify-end pt-6 border-t border-slate-200">
      <button
        id="submit-skills"
        type="submit"
        class="inline-flex items-center px-6 py-3 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white font-semibold rounded-xl shadow-lg hover:shadow-xl transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
      >
        <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
          <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path>
        </svg>
        Save Skills
      </button>
    </div>
  </form>
</editable-form>