#ajaxsmartsearch-wrapper {
  position: relative;
  max-width: 100vw;
  width: 100%;
  margin: 0 auto;
  font-family: 'Montserrat', sans-serif;
}
#ajaxsmartsearch-form {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 24px auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border-radius: 50px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid #e0e0e0;
}

#ajaxsmartsearch-form:focus-within {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-color: #c0c0c0;
  transform: translateY(-1px);
}
#ajaxsmartsearch-input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 50px 0 0 50px;
  font-size: 1.1em;
  font-family: 'Montserrat', sans-serif;
  outline: none;
  background: #f9f9f9;
}
#ajaxsmartsearch-form button {
  background: #f0f0f0;
  color: #555;
  border: none;
  border-radius: 0 50px 50px 0;
  padding: 14px 24px;
  cursor: pointer;
  font-size: 1.1em;
  transition: all 0.2s ease;
  font-family: 'Montserrat', sans-serif;
}

#ajaxsmartsearch-form button:hover {
  background: #e5e5e5;
}
#ajaxsmartsearch-popup {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  width: 100%;
  max-width: 900px;
  margin: 10px auto 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  z-index: 10000;
  box-shadow: 0 4px 32px rgba(0,0,0,0.13);
  padding: 24px 16px 32px 16px;
  display: none;
  max-height: 85vh;
  overflow-y: auto;
}
.ajaxsmartsearch-popup-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 16px;
  justify-content: center;
}

/* Container pour les 8 premiers produits (2 lignes de 4) */
.ajaxsmartsearch-visible-products {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 16px;
  justify-content: center;
  width: 100%;
  padding-bottom: 10px; /* Ajoutez ici vos styles personnalisés */

  /* Réduit l'espace vertical entre la croix et les vignettes */
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.ajaxsmartsearch-close-wrapper {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  position: sticky;
  top: 0;
  right: 0;
  z-index: 2000;
  background: inherit;
}

/* Container pour les produits supplémentaires */

/* Diagnostic : forcer l'affichage du popup */
#ajaxsmartsearch-popup {
  display: block !important;
}

.ajaxsmartsearch-more-products {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 16px;
  justify-content: center;
  width: 100%;
  margin-top: 5px;
}
.ajaxsmartsearch-result-item {
  flex: 0 0 calc(25% - 16px); /* Fixe à exactement 25% moins la marge */
  width: calc(25% - 16px); /* Largeur fixe pour garantir 4 par ligne */
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 14px 10px 14px 10px;
  text-align: center;
  border: 1px solid #ececec;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  margin-bottom: 5px;
  min-width: 0; /* Empêche le dépassement */
}
.ajaxsmartsearch-result-item a {
  text-decoration: none !important;
  color: #222;
  display: block;
  width: 100%;
  border-bottom: none !important;
}
.ajaxsmartsearch-result-item:hover {
  background: #fff;
  border-color: #ddd;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transform: scale(1.05) translateY(-3px);
  z-index: 5;
}

.ajaxsmartsearch-result-item a:hover {
  background: transparent;
}
.ajaxsmartsearch-product-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 8px;
  transition: width 0.2s, height 0.2s;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.ajaxsmartsearch-product-name {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: 4px;
  height: 2.4em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  font-family: 'Montserrat', sans-serif;
  position: relative;
  cursor: help;
}

/* Tooltip pour le nom du produit */
.ajaxsmartsearch-product-name:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.85em;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}
.ajaxsmartsearch-product-price {
  color: #BB0A5F;
  font-size: 1.3em;
  font-weight: 700;
  margin-top: 4px;
  font-family: 'Montserrat', sans-serif;
}
.ajaxsmartsearch-product-manufacturer {
  color: #777;
  font-size: 0.9em;
  margin-top: 2px;
  font-family: 'Montserrat', sans-serif;
  font-style: italic;
}

.ajaxsmartsearch-loading, .ajaxsmartsearch-no-results, .ajaxsmartsearch-error {
  padding: 32px;
  text-align: center;
  color: #888;
  font-size: 1.1em;
}
@media (max-width: 900px) {
  .ajaxsmartsearch-result-item {
    flex: 0 1 calc(50% - 12px);
  }
  #ajaxsmartsearch-popup {
    width: 99vw;
    left: 0;
    right: 0;
    max-width: 99vw;
    padding: 18px 4px 18px 4px;
  }
}
@media (max-width: 600px) {
  .ajaxsmartsearch-result-item {
    flex: 0 1 calc(100% - 6px);
    min-width: 160px;
  }
  #ajaxsmartsearch-popup {
    padding: 8px 2px 8px 2px;
    top: 60px;
    max-width: 99vw;
  }
  .ajaxsmartsearch-product-img {
    width: 80px;
    height: 80px;
  }
}
