/**
 * Search Autocomplete Styles
 * Desktop dropdown + Mobile drawer
 */

/* Desktop Dropdown */
.search-autocomplete-dropdown {
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: none;
  background: white;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f0f0f0;
}

.search-result-item:first-child {
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.search-result-item:last-child {
  border-bottom: none;
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
}

.search-result-item:hover,
.search-result-focused {
  background-color: #fef3f0;
}

.search-result-image {
  width: 80px;
  height: 80px;
  border-radius: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e5e5;
  font-size: 2rem;
  order: 2;
}

.search-result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-placeholder {
  font-size: 1.5rem;
}

.search-result-info {
  flex: 1;
  min-width: 0;
  order: 1;
}

.search-result-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-name strong {
  color: var(--razo-orange, #F97316);
  font-weight: 600;
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
}

.search-result-category {
  color: #666;
}

.search-result-price {
  color: var(--razo-orange, #F97316);
  font-weight: 600;
}

.search-result-action {
  order: 3;
  flex-shrink: 0;
}

.search-result-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.search-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-stock-ok {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-stock-low {
  background-color: #fee2e2;
  color: #991b1b;
}

.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
}

.search-no-results-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.search-no-results-text {
  color: #666;
  font-size: 0.9375rem;
}

/* Mobile Drawer */
.search-autocomplete-drawer {
  transition: opacity 0.3s ease;
  opacity: 0;
}

.search-autocomplete-drawer.search-drawer-open {
  opacity: 1;
}

.search-drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.search-drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 85%;
  max-width: 400px;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.search-drawer-open .search-drawer-content {
  transform: translateX(0);
}

.search-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #e5e5e5;
  background: white;
}

.search-drawer-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: #1a1a1a;
}

.search-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
  color: #666;
}

.search-drawer-close:hover {
  background: #e5e5e5;
}

.search-drawer-results {
  flex: 1;
  overflow-y: auto;
}

.search-result-item-mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: none;
  background: white;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f0f0f0;
}

.search-result-item-mobile:active {
  background-color: #fef3f0;
}

.search-result-item-mobile .search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-item-mobile .search-result-name {
  font-size: 1rem;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 0.375rem;
  line-height: 1.4;
}

.search-result-item-mobile .search-result-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.search-result-item-mobile .search-result-meta span {
  color: #666;
}

.search-result-item-mobile .search-result-price {
  color: var(--razo-orange, #F97316);
  font-weight: 600;
}

.search-result-item-mobile .bi-chevron-right {
  color: #ccc;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Scrollbar styles */
.search-autocomplete-dropdown::-webkit-scrollbar,
.search-drawer-results::-webkit-scrollbar {
  width: 6px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-track,
.search-drawer-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-autocomplete-dropdown::-webkit-scrollbar-thumb,
.search-drawer-results::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-thumb:hover,
.search-drawer-results::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .search-drawer-content {
    width: 90%;
  }
}

@media (min-width: 768px) {
  .search-autocomplete-drawer {
    display: none !important;
  }
}
