/* Company Autocomplete Styles */
.autocomplete-container {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-top: 4px;
}

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background-color: #f8fafc;
}

.autocomplete-item.selected,
.autocomplete-item.bg-blue-50 {
  background-color: #eff6ff;
  border-left: 3px solid #3b82f6;
}

.autocomplete-item .company-name {
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}

.autocomplete-item .company-details {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 14px;
  color: #6b7280;
}

.autocomplete-item .company-location {
  font-size: 13px;
  color: #9ca3af;
}

.autocomplete-item .company-numbers {
  font-size: 12px;
  color: #6b7280;
  text-align: right;
  line-height: 1.3;
}

.autocomplete-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}

.autocomplete-rating .star {
  width: 14px;
  height: 14px;
}

.autocomplete-loading {
  padding: 16px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.autocomplete-no-results {
  padding: 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  font-style: italic;
}

/* Highlight matching text */
.autocomplete-item mark {
  background-color: #fef3c7;
  color: #d97706;
  font-weight: 600;
  padding: 1px 2px;
  border-radius: 2px;
}

/* Input focus styles when autocomplete is active */
.autocomplete-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive improvements */
@media (max-width: 640px) {
  .autocomplete-dropdown {
    left: -4px;
    right: -4px;
    margin-top: 2px;
  }
  
  .autocomplete-item {
    padding: 10px 12px;
  }
  
  .autocomplete-item .company-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .autocomplete-item .company-numbers {
    text-align: left;
  }
}

/* Animation for dropdown appearance */
.autocomplete-dropdown.fade-in {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

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

/* Keyboard navigation indicator */
.autocomplete-item.keyboard-selected {
  background-color: #dbeafe;
  border-left-color: #2563eb;
}

/* Loading spinner */
.autocomplete-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Search icon in input */
.autocomplete-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

/* Company type badges */
.company-type-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.company-type-carrier {
  background-color: #dbeafe;
  color: #1e40af;
}

.company-type-broker {
  background-color: #d1fae5;
  color: #065f46;
}

/* Enhanced rating display */
.rating-summary {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.rating-count {
  color: #6b7280;
  font-weight: 400;
}

/* Accessibility improvements */
.autocomplete-dropdown[role="listbox"] {
  /* Already styled above */
}

.autocomplete-item[role="option"] {
  /* Already styled above */
}

.autocomplete-item[aria-selected="true"] {
  background-color: #eff6ff;
  border-left: 3px solid #3b82f6;
}

/* Focus trap styling */
.autocomplete-item:focus {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .autocomplete-item:hover {
    background-color: #000;
    color: #fff;
  }
  
  .autocomplete-item.selected {
    background-color: #0066cc;
    color: #fff;
  }
}