/* ============================================
   ROUTE D'OR — Super Recherche CSS
   Design type Doofinder/Algolia
   ============================================ */

/* ── Conteneur principal ── */
.ro-search {
  position: relative;
  width: 100%;
  z-index: 450;
}

/* ── Formulaire ── */
.ro-search__form {
  width: 100%;
}

.ro-search__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ro-search__icon-search {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ro-gray, #878787);
  pointer-events: none;
  z-index: 1;
}

.ro-search__input {
  width: 100%;
  padding: 12px 90px 12px 44px;
  border: 2px solid var(--ro-border, #e0dbd3);
  border-radius: var(--ro-radius-full, 9999px);
  background-color: var(--ro-white, #fff);
  font-family: var(--ro-font-body, 'Inter', sans-serif);
  font-size: 14px;
  color: var(--ro-text, #392d24);
  outline: none;
  transition: all 250ms ease;
}

.ro-search__input:focus {
  border-color: var(--ro-gold, #ffd304);
  box-shadow: 0 0 0 3px rgba(255, 211, 4, 0.2);
}

.ro-search__input::placeholder {
  color: var(--ro-gray, #878787);
}

/* Bouton effacer */
.ro-search__clear {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ro-gray, #878787);
  border-radius: 50%;
  transition: all 200ms ease;
  padding: 0;
}

.ro-search__clear:hover {
  background-color: var(--ro-beige, #ece6da);
  color: var(--ro-brown, #392d24);
}

/* Bouton submit */
.ro-search__submit {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: var(--ro-radius-full, 9999px);
  background-color: var(--ro-gold, #ffd304);
  color: var(--ro-brown, #392d24);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms ease;
  border: none;
  cursor: pointer;
  padding: 0;
}

.ro-search__submit:hover {
  background-color: var(--ro-gold-dark, #e6be00);
}

/* ── Dropdown des résultats ── */
.ro-search__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(57, 45, 36, 0.18), 0 4px 12px rgba(57, 45, 36, 0.08);
  border: 1px solid var(--ro-border-light, #eeebe5);
  max-height: 480px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 200ms ease;
  pointer-events: none;
}

.ro-search__dropdown[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Loading ── */
.ro-search__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--ro-gray, #878787);
  font-size: 14px;
}

.ro-search__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--ro-border, #e0dbd3);
  border-top-color: var(--ro-gold, #ffd304);
  border-radius: 50%;
  animation: roSearchSpin 0.6s linear infinite;
}

@keyframes roSearchSpin {
  to { transform: rotate(360deg); }
}

/* ── Résultats ── */
.ro-search__results {
  padding: 4px 0;
}

/* Item de résultat */
.ro-search__result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--ro-brown, #392d24);
  transition: background-color 150ms ease;
  border-bottom: 1px solid var(--ro-border-light, #eeebe5);
}

.ro-search__result-item:last-child {
  border-bottom: none;
}

.ro-search__result-item:hover,
.ro-search__result-item.is-focused {
  background-color: var(--ro-beige-light, #f5f0e8);
}

/* Image produit */
.ro-search__result-img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--ro-gray-light, #f5f5f5);
  border: 1px solid var(--ro-border-light, #eeebe5);
}

.ro-search__result-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ro-search__result-img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ro-gray, #878787);
}

/* Infos produit */
.ro-search__result-info {
  flex: 1;
  min-width: 0;
}

.ro-search__result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ro-brown, #392d24);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 2px;
}

.ro-search__result-name mark {
  background-color: rgba(255, 211, 4, 0.3);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.ro-search__result-ref {
  font-size: 11px;
  color: var(--ro-gray, #878787);
  margin: 0;
}

/* Prix */
.ro-search__result-price {
  flex-shrink: 0;
  text-align: right;
}

.ro-search__result-price-current {
  font-size: 15px;
  font-weight: 700;
  color: var(--ro-brown, #392d24);
  display: block;
}

.ro-search__result-price-old {
  font-size: 12px;
  color: var(--ro-gray, #878787);
  text-decoration: line-through;
  display: block;
}

/* ── Aucun résultat ── */
.ro-search__no-results {
  padding: 32px 24px;
  text-align: center;
  color: var(--ro-gray, #878787);
}

.ro-search__no-results svg {
  margin-bottom: 8px;
  opacity: 0.5;
}

.ro-search__no-results p {
  margin: 0;
  font-size: 14px;
}

/* ── Footer (voir tous les résultats) ── */
.ro-search__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--ro-border-light, #eeebe5);
  text-align: center;
}

.ro-search__see-all {
  display: inline-block;
  padding: 8px 20px;
  background-color: var(--ro-gold, #ffd304);
  color: var(--ro-brown, #392d24);
  border-radius: var(--ro-radius-full, 9999px);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 200ms ease;
}

.ro-search__see-all:hover {
  background-color: var(--ro-gold-dark, #e6be00);
  transform: translateY(-1px);
}

/* ── Masquer le search_widget de ps_searchbar quand ro_searchbar est actif ── */
.ro-header__search #search_widget {
  display: none;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .ro-search__input {
    font-size: 16px; /* Évite le zoom iOS */
    padding: 10px 80px 10px 40px;
  }
  
  .ro-search__dropdown {
    border-radius: 8px;
    max-height: 60vh;
  }
  
  .ro-search__result-img {
    width: 48px;
    height: 48px;
  }
}
