/**
 * Autocomplete Dropdown Styles
 * Provides styling for equipment search autocomplete suggestions
 */

/* Autocomplete wrapper */
.autocomplete-wrapper {
  position: relative;
}

/* Autocomplete dropdown container */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 350px;
  width: max-content;
  max-width: 600px;
  background: #ffffff;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin-top: 4px;
  background-color: #1e1e1e;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Custom scrollbar for dropdown */
.autocomplete-dropdown::-webkit-scrollbar {
  width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
  background: #f8f8f8;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Individual autocomplete item */
.autocomplete-dropdown .autocomplete-item {
    padding: 10px 14px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #2a2a2a;
}


.autocomplete-item:first-child {
  border-radius: 6px 6px 0 0;
}

.autocomplete-item:last-child {
  border-bottom: none;
  border-radius: 0 0 6px 6px;
}

.autocomplete-dropdown .autocomplete-item:hover,
.autocomplete-dropdown .autocomplete-item.active {
    background-color: #2f2f2f;
    color: #ffffff;
}

.autocomplete-item.no-results {
  cursor: default;
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 16px;
}

.autocomplete-item.no-results:hover {
  background-color: transparent;
  color: #999;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .autocomplete-dropdown {
    min-width: 300px;
    max-width: calc(100vw - 40px);
    max-height: 280px;
  }

  .autocomplete-item {
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .autocomplete-dropdown {
    min-width: 250px;
    max-width: calc(100vw - 30px);
    max-height: 240px;
  }

  .autocomplete-item {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* Loading state */
.autocomplete-item.loading {
  text-align: center;
  color: #999;
  padding: 16px;
}

.autocomplete-item.loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--color-primary, #007bff);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Icon for search items */
.autocomplete-item::before {
  content: '\f002';
  font-family: 'Font Awesome 5 Pro';
  font-weight: 400;
  margin-right: 10px;
  color: #999;
  font-size: 13px;
}

.autocomplete-item:hover::before,
.autocomplete-item.active::before {
  color: var(--color-primary, #007bff);
}