{% load i18n %}
<tr class="link-row">
  <td>
    <input type="checkbox" name="selected_links" value="{{ link.id }}" aria-label="{% trans 'Select link' %} {{ link.alias }}" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
  </td>
  <td>
    <a href="{% url 'redirect_to_original' link.alias %}" target="_blank" rel="noopener noreferrer" class="alias-link">{{ link.alias }}</a>
  </td>
  <td class="hidden sm:table-cell">
    {% if '{' in link.original_url|default:'' and '}' in link.original_url|default:'' %}
      <span class="badge badge-template"><i class="fas fa-magic" aria-hidden="true"></i>{% trans "Template" %}</span>
    {% elif link.link_type == 'LINK' %}
      <span class="badge badge-link"><i class="fas fa-link" aria-hidden="true"></i>{% trans "Link" %}</span>
    {% elif link.link_type == 'ACTION' %}
      <span class="badge badge-action"><i class="fas fa-bolt" aria-hidden="true"></i>{% trans "Action" %}</span>
    {% else %}
      <span class="badge badge-custom"><i class="fas fa-code" aria-hidden="true"></i>{% trans "Custom" %}</span>
    {% endif %}
  </td>
  <td class="hidden md:table-cell">
    <div class="url-cell" title="{{ link.original_url }}">
      <a href="{% url 'redirect_to_original' link.alias %}" target="_blank" rel="noopener noreferrer">{{ link.original_url }}</a>
    </div>
  </td>
  <td class="clicks-cell hidden sm:table-cell">{{ link.click_count }}</td>
  <td>
    <div class="flex items-center gap-1">
      <a href="{% url 'link_detail' link.id %}" class="icon-btn blue" title="{% trans 'View Details' %}" aria-label="{% trans 'View Details' %}">
        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
        </svg>
      </a>
      <a href="{% url 'link_update' link.id %}" class="icon-btn green" title="{% trans 'Edit' %}" aria-label="{% trans 'Edit' %}">
        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
        </svg>
      </a>
      <a href="{% url 'link_delete' link.id %}" class="icon-btn red" title="{% trans 'Delete' %}" aria-label="{% trans 'Delete' %}">
        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
        </svg>
      </a>
    </div>
  </td>
</tr>
