/* ============================================
   SEARCH AUTOCOMPLETE ENHANCEMENTS
   ============================================ */

/* Force all parent containers to allow overflow */
.header_middle,
.header_middle_advnc_search,
.search_form_wrapper,
.top-search,
.form-search,
.box-search,
.box-search.pre_line {
  position: relative !important;
  overflow: visible !important;
}

.search-suggestions {
  position: fixed !important;
  background: #ffffff !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  z-index: 999999 !important;
  display: none !important;
  border: 1px solid #e5e5e5 !important;
  margin-top: 8px;
}

.search-suggestions.active {
  display: block !important;
  max-height: 500px;
  overflow-y: auto !important;
  animation: slideDown 0.2s ease-out;
}

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

.box-suggestions {
  padding: 4px;
}

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

.box-suggestions li {
  display: flex;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 8px;
  margin: 4px;
}

.box-suggestions li:hover {
  background: #f8f9fa;
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.box-suggestions .thumb {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  margin-right: 12px;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0f0f0;
}

.box-suggestions .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.box-suggestions .info-product {
  flex: 1;
  min-width: 0;
}

.box-suggestions .item_title {
  font-size: 14px;
  font-weight: 500;
  color: #2c2c2c;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}

.box-suggestions .price {
  display: flex;
  align-items: center;
  gap: 8px;
}

.box-suggestions .price .sale {
  font-size: 16px;
  font-weight: 700;
  color: #ff6b35;
}

.discount-badge-small {
  background: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 100%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(255, 107, 53, 0.2);
}

.search-loading {
  text-align: center;
  padding: 24px 16px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.no-results {
  text-align: center;
  padding: 32px 16px;
  color: #999;
  font-size: 14px;
  font-weight: 500;
}

/* Search Input Enhancement */
.box-search .form_control:focus {
  outline: none;
  border-color: #ff6b35 !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1) !important;
}

/* Custom Scrollbar for Suggestions */
.search-suggestions::-webkit-scrollbar {
  width: 8px;
}

.search-suggestions::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb {
  background: #d8d8d8;
  border-radius: 4px;
  border: 2px solid #ffffff;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
  background: #b8b8b8;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .search-suggestions {
    border-radius: 8px !important;
    max-width: calc(100vw - 32px) !important;
  }

  .search-suggestions.active {
    max-height: 400px;
  }

  .box-suggestions .thumb {
    width: 60px;
    height: 60px;
    margin-right: 10px;
  }

  .box-suggestions li {
    padding: 10px;
  }

  .box-suggestions .item_title {
    font-size: 13px;
    line-height: 1.4;
  }

  .box-suggestions .price .sale {
    font-size: 15px;
  }

  .discount-badge-small {
    font-size: 10px;
    padding: 3px 6px;
  }
}

@media (max-width: 576px) {
  .search-suggestions.active {
    max-height: 350px;
  }

  .box-suggestions .thumb {
    width: 55px;
    height: 55px;
  }

  .box-suggestions .item_title {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .box-suggestions .price .sale {
    font-size: 14px;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.search-loading {
  animation: pulse 1.5s ease-in-out infinite;
}
