<div id="resp_buscar_inmuebles">
  <ul class="list-listings" id="ordered-properties">
    <% unless @properties && (@properties.size > 0 ) %>
      <div class="text-center" style="padding: 40px 0;">
        <%= icon(:search, size: :xl, class: "text-muted") %>
        <h4 style="text-transform: none; margin-bottom: 20px;">
          <%= t "noResultsForSearch" %>
        </h4>
        <p class="text-muted">
          <%= t "tryChangingFilters", default: "Try changing your filters" %>
        </p>
        <button class="btn btn-primary" onclick="clearSearchFilters()">
          <%= icon(:refresh) %> <%= t "clearFilters", default: "Clear Filters" %>
        </button>
        <script>
          function clearSearchFilters() {
            var form = document.querySelector('form.form-light') || document.querySelector('form.simple_form');
            if (form) {
              // Reset standard form elements
              form.reset();
              // Clear hidden inputs (for custom select components)
              form.querySelectorAll('input[type=hidden]').forEach(function(input) {
                if (input.name && input.name.startsWith('search[')) {
                  input.value = '';
                }
              });
              // Uncheck checkboxes
              form.querySelectorAll('input[type=checkbox]').forEach(function(cb) {
                cb.checked = false;
              });
              // Reset select elements
              form.querySelectorAll('select').forEach(function(select) {
                select.selectedIndex = 0;
                // Trigger change event for any custom select listeners
                select.dispatchEvent(new Event('change', { bubbles: true }));
              });
              // Submit the form using Rails UJS
              form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
            }
          }
        </script>
      </div>
    <% end %>
    <% @properties.each_with_index do |property, index| %>
      <%= render :partial => '/pwb/search/search_result_item', :locals => { property: property, index: index } %>
    <% end %>
  </ul>
  <!-- PAGINATION & FILTERS -->
  <div class="wp-block default product-list-filters light-gray" style="display:none;">
    <ul class="pagination pagination pull-left">
      <li><a href="#" hidefocus="true">«</a></li>
      <li class="active"><a href="#" hidefocus="true">1</a></li>
      <li><a href="#" hidefocus="true">2</a></li>
      <li><a href="#" hidefocus="true">3</a></li>
      <li><a href="#" hidefocus="true">4</a></li>
      <li><a href="#" hidefocus="true">5</a></li>
      <li><a href="#" hidefocus="true">»</a></li>
    </ul>
  </div>
</div>
