/**
 * Hugo Search Component Styles
 * Modern, responsive search interface for electronic components
 */

.search-container {
  position: relative;
  width: 100%;
}

.search-results-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-results-container::-webkit-scrollbar {
  width: 6px;
}

.search-results-container::-webkit-scrollbar-track {
  background: #f9fafb;
}

.search-results-container::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.search-result-item {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

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

.search-result-item:hover,
.search-result-item.selected {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-left: 4px solid #1C3563;
  padding-left: 16px;
}

.search-result-item.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, #1C3563 0%, #1245a8 100%);
}

.search-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.search-result-mpn {
  font-weight: 700;
  font-size: 16px;
  color: #1C3563;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.search-result-brand {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

.search-result-title {
  font-size: 14px;
  color: #374151;
  margin-bottom: 8px;
  line-height: 1.4;
}

.search-result-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}

.search-result-category {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: #4338ca;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.search-result-stock {
  color: #059669;
  font-weight: 500;
}

.search-result-price {
  color: #dc2626;
  font-weight: 700;
  font-size: 14px;
}

.search-result-relevance {
  font-size: 12px;
  margin-left: 8px;
}

.search-result-relevance.high {
  color: #059669;
}

.search-result-relevance.medium {
  color: #d97706;
}

.search-result-relevance.low {
  color: #6b7280;
}

.search-result-series {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.search-result-package {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: #0c4a6e;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.search-no-results {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
}

.search-no-results p:first-child {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.search-no-results p:last-child {
  font-size: 14px;
  color: #9ca3af;
}

/* Search input enhancements */
.search-input-enhanced {
  position: relative;
}

.search-input-enhanced input {
  padding-right: 50px !important;
}

.search-input-enhanced::after {
  content: '🔍';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.6;
  pointer-events: none;
}

/* Loading state */
.search-loading {
  padding: 20px;
  text-align: center;
  color: #6b7280;
}

.search-loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #1C3563;
  border-radius: 50%;
  animation: search-spin 1s linear infinite;
  margin-left: 10px;
}

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

/* Responsive design */
@media (max-width: 768px) {
  .search-results-container {
    max-height: 300px;
    border-radius: 0 0 8px 8px;
  }
  
  .search-result-item {
    padding: 12px 16px;
  }
  
  .search-result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .search-result-meta {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .search-result-category {
    order: 1;
  }
  
  .search-result-stock {
    order: 2;
  }
  
  .search-result-price {
    order: 3;
  }
}

@media (max-width: 480px) {
  .search-result-mpn {
    font-size: 15px;
  }
  
  .search-result-title {
    font-size: 13px;
  }
  
  .search-result-meta {
    font-size: 12px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .search-results-container {
    background: #1f2937;
    border-color: #374151;
  }
  
  .search-result-item {
    border-bottom-color: #374151;
  }
  
  .search-result-item:hover,
  .search-result-item.selected {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
  }
  
  .search-result-mpn {
    color: #60a5fa;
  }
  
  .search-result-title {
    color: #e5e7eb;
  }
  
  .search-result-brand {
    color: #9ca3af;
  }
  
  .search-result-category {
    background: linear-gradient(135deg, #3730a3 0%, #4338ca 100%);
    color: #c7d2fe;
  }
  
  .search-result-stock {
    color: #34d399;
  }
  
  .search-result-price {
    color: #f87171;
  }
  
  .search-no-results {
    color: #9ca3af;
  }
  
  .search-no-results p:first-child {
    color: #d1d5db;
  }
  
  .search-no-results p:last-child {
    color: #6b7280;
  }
}