/* ============================================
   MOXIE SEARCH MODULE v2 — moxiesearch.css
   Rendu dynamique 2 ou 3 colonnes
   ============================================ */

/* ── Widget wrapper ── */
.moxie-search {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1001;
}

/* ── Bouton loupe ── */
.moxie-search__trigger {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 7px;
  color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background .15s, color .15s;
  line-height: 1;
}
.moxie-search__trigger:hover { background: #f5f5f5; }
.moxie-search--open .moxie-search__trigger { color: #c1d101; }

/* ── Overlay expandable ── */
.moxie-search__overlay {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 0;
  overflow: hidden;
  transition: width .28s cubic-bezier(.4,0,.2,1);
  z-index: 500;
}
.moxie-search__overlay--open {
  width: 560px;
  overflow: visible;
}

/* ── Boîte de saisie ── */
.moxie-search__box {
  display: flex;
  align-items: center;
  background: #fff;
  border: .5px solid #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
  height: 42px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  white-space: nowrap;
}

/* ── Select catégorie ── */
.moxie-search__cat {
  border: none !important;
  background: #f5f5f5;
  font-size: 12px;
  color: #555;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  outline: none;
  min-width: 150px;
  max-width: 150px;
  border-radius: 0 !important;
  font-family: inherit;
  flex-shrink: 0;
  border-right: .5px solid #e5e5e5 !important;
  box-shadow: none !important;
}

/* ── Formulaire ── */
.moxie-search__form {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ── Input ── */
.moxie-search__input {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  font-size: 13px !important;
  padding: 0 12px !important;
  height: 100%;
  flex: 1;
  outline: none;
  color: #0a0a0a;
  min-width: 0;
  font-family: inherit;
}
.moxie-search__input::placeholder { color: #bbb; }

/* ── Bouton submit ── */
.moxie-search__submit {
  background: transparent;
  border: none;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .15s;
  line-height: 1;
}
.moxie-search__submit:hover { color: #c1d101; }

/* ── Bouton fermer ── */
.moxie-search__close {
  background: transparent;
  border: none;
  border-left: .5px solid #e5e5e5;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  color: #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .15s;
  line-height: 1;
}
.moxie-search__close:hover { color: #0a0a0a; }

/* ============================================
   DROPDOWN RÉSULTATS
   ============================================ */

.moxie-search__results {
  position: fixed;
  top: auto;
  right: 10px;
  left: auto;
  width: min(800px, calc(100vw - 20px));
  background: #fff;
  border: .5px solid #e5e5e5;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  overflow: hidden;
  display: none;
  z-index: 2000;
}
.moxie-search__results--visible { display: block; }

/* ── Grille dynamique ── */
.moxie-sr__grid {
  display: grid;
  gap: 0;
  min-height: 200px;
}

/* 3 colonnes : modèles + catégories + produits */
.moxie-sr__grid--3col {
  grid-template-columns: 210px 220px 1fr;
}

/* 2 colonnes : catégories + produits (pas de modèles) */
.moxie-sr__grid--2col {
  grid-template-columns: 260px 1fr;
}

/* ── Colonne générique ── */
.moxie-sr__col {
  padding: 16px 0;
  border-right: .5px solid #f0f0f0;
}
.moxie-sr__col:last-child { border-right: none; }

.moxie-sr__col-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #aaa;
  padding: 0 16px 10px;
}

/* ── Col Modèles ── */
.moxie-sr__model {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  font-size: 13px;
  color: #333;
  text-decoration: none;
  transition: background .1s, color .1s;
}
.moxie-sr__model:hover {
  background: #f9f9f9;
  color: #0a0a0a;
  text-decoration: none;
}
.moxie-sr__model-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  flex-shrink: 0;
  padding: 4px;
  border: .5px solid #f0f0f0;
}
.moxie-sr__model-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #f5f5f5;
  flex-shrink: 0;
  display: block;
}

/* ── Col Catégories ── */
.moxie-sr__cat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  text-decoration: none;
  transition: background .1s;
}
.moxie-sr__cat-item:hover {
  background: #f9f9f9;
  text-decoration: none;
}
.moxie-sr__cat-img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.moxie-sr__cat-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.moxie-sr__cat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.moxie-sr__cat-name {
  font-size: 13px;
  font-weight: 500;
  color: #0a0a0a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Col Produits ── */
.moxie-sr__col--products { padding: 16px 0; }

.moxie-sr__product {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 16px;
  text-decoration: none;
  transition: background .1s;
}
.moxie-sr__product:hover {
  background: #f9f9f9;
  text-decoration: none;
}
.moxie-sr__product-img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
}
.moxie-sr__product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.moxie-sr__product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}
.moxie-sr__product-name {
  font-size: 12px;
  color: #333;
  line-height: 1.45;
  /* 3 lignes max */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.moxie-sr__product-price {
  font-size: 13px;
  font-weight: 600;
  color: #0a0a0a;
}

/* ── Highlight ── */
mark {
  background: transparent;
  color: #c1d101;
  font-weight: 700;
  padding: 0;
}

/* ── Footer ── */
.moxie-sr__footer {
  border-top: .5px solid #f0f0f0;
  padding: 10px 16px;
  background: #fafafa;
  display: flex;
  justify-content: flex-end;
}
.moxie-sr__all-link {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  text-decoration: none;
  transition: color .15s;
}
.moxie-sr__all-link:hover { color: #0a0a0a; text-decoration: none; }

/* ── Loading / empty ── */
.moxie-sr__loading,
.moxie-sr__empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: #aaa;
}
.moxie-sr__loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e5e5;
  border-top-color: #c1d101;
  border-radius: 50%;
  animation: moxie-spin .7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
@keyframes moxie-spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 992px) {
  .moxie-search__overlay--open { width: calc(100vw - 24px); right: -12px; }
  .moxie-search__results { width: 100%; }
  .moxie-sr__grid--3col,
  .moxie-sr__grid--2col { grid-template-columns: 1fr 1fr; }
  .moxie-sr__grid--3col .moxie-sr__col:first-child { display: none; }
}

@media (max-width: 576px) {
  .moxie-sr__grid--3col,
  .moxie-sr__grid--2col { grid-template-columns: 1fr; }
}
