{% load i18n %}

{% if field.use_fieldset %}
  <fieldset>
  {% if field.label %}{{ field.legend_tag }}{% endif %}
{% endif %}
<div class="mb-6">
  <div class="flex items-start">
    <div class="flex items-center h-5">

      {{ field }}

      {% if field.label %}
      <label for="{{ field.auto_id }}" class="ms-2 text-sm font-medium cursor-pointer
        {% if field.errors %} text-red-700 dark:text-red-500
        {% else %} text-gray-900 dark:text-gray-300 {% endif %}"
      >
          {{ field.label }}
        </label>
        {% endif %}
        {% if field.help_text %}
          <button
            type="button"
            {% if field.auto_id %} data-tooltip-target="id_{{ field.auto_id }}_helptext"{% endif %}
            data-tooltip-style="dark"
            class="ml-1 -mt-4">
            <svg aria-hidden="true"
            class="w-4 h-4 text-gray-400 hover:text-gray-900 dark:text-gray-500 dark:hover:text-white"
            fill="currentColor" viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
            <path fill-rule="evenodd"
              d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z"
              clip-rule="evenodd"></path>
            </svg>
            <span class="sr-only">{% translate 'Show information' %}</span>
          </button>
          <div role="tooltip"
            {% if field.auto_id %} id="id_{{ field.auto_id }}_helptext"{% endif %}
            class="inline-block absolute invisible z-10 py-2 px-3 max-w-sm text-xs font-normal text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
            {{ field.help_text|safe }}
            <div class="tooltip-arrow" data-popper-arrow></div>
          </div>
        {% endif %}
    </div>
  </div>

  {% if field.errors %}
  <div class="mt-2 text-xs text-red-600 dark:text-red-500">
    {{ field.errors }}
  </div>
  {% endif %}
</div>

{% if field.use_fieldset %}
</fieldset>
{% endif %}
