/* Live AJAX Search Suggestions */
.live-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000 !important;
  max-height: 500px;
  overflow-y: auto;
  display: none;
  visibility: hidden;
  margin-top: 4px;
  width: 100%;
  min-width: 200px;
  max-width: 720px;
}

/* Hide Typeahead when live search is active */
.live-search-suggestions.active ~ .tt-menu,
.live-search-suggestions.active ~ .tt-dropdown-menu,
.search-wrapper:has(.live-search-suggestions.active) .tt-menu,
.search-wrapper:has(.live-search-suggestions.active) .tt-dropdown-menu {
  display: none !important;
  visibility: hidden !important;
}

.search-wrapper .live-search-suggestions,
.main-search-wrapper .live-search-suggestions {
  width: 100%;
}

.live-search-suggestions.active {
  display: block !important;
  visibility: visible !important;
}

.suggestions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  cursor: pointer;
  gap: 12px;
}

.suggestion-image {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  overflow: hidden;
  border-radius: 4px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.suggestion-image-placeholder {
  width: 100%;
  height: 100%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 10px;
}

.suggestion-image-placeholder::before {
  content: "📷";
  font-size: 24px;
  opacity: 0.5;
}

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

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: #f8f9fa;
  text-decoration: none;
}

.suggestion-content {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.suggestion-left {
  flex: 1;
  min-width: 0;
}

.suggestion-right {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.suggestion-name {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 4px;
  color: #333;
}

.suggestion-name strong {
  font-weight: 600;
  color: #007bff;
}

.suggestion-description {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.suggestion-meta {
  display: flex;
  align-items: center;
  font-size: 12px;
  margin-top: 4px;
}

.suggestion-artnr {
  color: #999;
}

.suggestion-price {
  font-weight: 700;
  color: #28a745;
  font-size: 18px;
  white-space: nowrap;
  margin-bottom: 2px;
}

.suggestion-availability {
  font-size: 12px;
  color: #28a745;
  font-weight: 500;
  white-space: nowrap;
}

.suggestion-loading,
.suggestion-error,
.suggestion-empty {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.suggestion-error {
  color: #dc3545;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .live-search-suggestions {
    max-height: 60vh;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    z-index: 99999 !important;
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin-top: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  
  .live-search-suggestions.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Ensure suggestions show above dropdown menu */
  .dropdown-menu.show ~ .live-search-suggestions,
  .dropdown-menu.show .live-search-suggestions,
  .search-wrapper-dropdown .live-search-suggestions {
    z-index: 99999 !important;
    position: fixed !important;
  }
  
  /* Prevent dropdown from closing when clicking suggestions */
  .live-search-suggestions.active {
    pointer-events: auto !important;
  }
  
  .suggestion-item {
    padding: 12px 16px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
  }
  
  .suggestion-item:active {
    background-color: #e9ecef;
  }
  
  .suggestion-name {
    font-size: 14px;
  }
  
  .suggestion-description {
    font-size: 12px;
  }
  
  .suggestion-price {
    font-size: 14px;
  }
  
  .suggestion-image {
    width: 50px;
    height: 50px;
  }
  
  /* Ensure suggestions are above everything on mobile */
  .search-wrapper .live-search-suggestions,
  .search-wrapper-dropdown .live-search-suggestions {
    position: fixed !important;
    z-index: 10000 !important;
  }
}
