/* Jida Recherche : fenêtre de recherche (maquette validée le 12/10/2026). */

.jrech {
  --jr-ink: #1F2A24;
  --jr-green: #254636;
  --jr-green-dark: #16301f;
  --jr-muted: #5D655F;
  --jr-line: #ECE7DE;
  --jr-line-2: #DCD6CB;
  --jr-field: #F4F1EB;
  --jr-cream: #FBF3E8;
  --jr-hover: #F7F4EE;
  --jr-coral-ink: #A23B14;
  --jr-coral-bg: #FDE6DA;
  position: fixed;
  inset: 0;
  z-index: 100000; /* au-dessus de la barre d'administration WordPress (99999) */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--jr-ink);
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
}
.jrech[hidden] { display: none; }
html.jrech-open, html.jrech-open body { overflow: hidden; }

.jrech *, .jrech *::before, .jrech *::after { box-sizing: border-box; }
.jrech button {
  font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0;
  text-transform: none; letter-spacing: normal; box-shadow: none; min-height: 0; min-width: 0;
  line-height: inherit; cursor: pointer; border-radius: 0; height: auto; width: auto;
}
.jrech a { color: inherit; text-decoration: none; box-shadow: none; }
.jrech ul { list-style: none; margin: 0; padding: 0; }
.jrech li { margin: 0; padding: 0; }
.jrech p { margin: 0; }
.jrech kbd {
  font: inherit; font-size: 12px; color: var(--jr-muted); background: #fff;
  border: 1px solid #D9D3C8; border-radius: 6px; padding: 2px 6px; box-shadow: none;
}
.jrech svg { flex-shrink: 0; }
.jrech :focus-visible { outline: 2px solid var(--jr-green); outline-offset: 2px; }

.jrech__backdrop { position: absolute; inset: 0; background: rgba(20, 32, 26, 0.48); }

.jrech__panel {
  position: absolute; top: 0; left: 0; right: 0;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border-radius: 0 0 24px 24px;
  padding: 28px 0 32px;
  box-shadow: 0 24px 60px rgba(20, 32, 26, 0.18);
}
.jrech__inner { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.jrech__status {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Barre de recherche */
.jrech__bar { display: flex; align-items: center; gap: 16px; margin: 0; }
.jrech__back { display: none; }
.jrech__field {
  flex: 1; min-width: 0; height: 60px; border-radius: 30px;
  background: var(--jr-field); border: 1.5px solid var(--jr-green);
  display: flex; align-items: center; gap: 12px; padding: 0 10px 0 22px;
  color: var(--jr-green);
}
.jrech .jrech__field input.jrech__input {
  flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  font: inherit; font-size: 20px; color: var(--jr-ink); line-height: normal;
  min-height: 0; max-width: none; width: auto;
  -webkit-appearance: none; appearance: none;
}
/* Les réglages du thème imposent une bordure de 5 px (verte au focus) à tous les champs de
   recherche, en !important : on l'annule dans la fenêtre. */
.jrech .jrech__field input.jrech__input,
.jrech .jrech__field input.jrech__input:focus {
  border: 0 !important; box-shadow: none !important; background: transparent !important; outline: none !important;
}
.jrech .jrech__input::placeholder { color: #7A817C; opacity: 1; }
.jrech .jrech__input::-webkit-search-cancel-button,
.jrech .jrech__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.jrech .jrech__clear {
  width: 40px; height: 40px; border-radius: 20px; background: #E6E1D7; color: var(--jr-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.jrech .jrech__clear[hidden] { display: none; }
.jrech .jrech__close {
  height: 48px; padding: 0 8px 0 14px; font-size: 15px;
  display: inline-flex; align-items: center; gap: 10px;
}

/* Grille : colonne de gauche (suggestions, rayons) + produits */
.jrech__body { margin-top: 28px; }
.jrech-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; }
.jrech-aside, .jrech-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.jrech-grid--results .jrech-main { gap: 14px; }
.jrech-sec { display: flex; flex-direction: column; gap: 4px; }

.jrech-label {
  font-family: "Archivo Black", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--jr-green);
  padding: 0 12px 8px; line-height: 1.2;
}
.jrech-main .jrech-label { padding-left: 0; padding-right: 0; }

.jrech .jrech-link {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; font-size: 16px; text-align: left;
}
.jrech .jrech-link svg { color: var(--jr-muted); }
.jrech .jrech-link:hover, .jrech .jrech-cat:hover { background: var(--jr-hover); }
.jrech .jrech-link strong { font-weight: 700; }

.jrech-recent { display: flex; align-items: center; gap: 4px; }
.jrech .jrech-recent__del {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--jr-muted); border-radius: 18px; flex-shrink: 0;
}
.jrech .jrech-recent__del:hover { background: var(--jr-hover); }

.jrech-cat {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px; font-size: 16px;
}
.jrech-cat.is-first { background: var(--jr-cream); }
.jrech-cat__count { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--jr-muted); white-space: nowrap; }
.jrech-cat__count svg, .jrech-tile svg, .jrech-chip svg { color: var(--jr-green); }

/* Pastilles */
.jrech-chips { display: flex; gap: 8px; }
.jrech-chips--wrap { flex-wrap: wrap; padding: 0 4px; }
.jrech-chips--scroll { display: none; }
.jrech .jrech-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border-radius: 19px; border: 1px solid var(--jr-line-2); font-size: 14px; white-space: nowrap; flex-shrink: 0;
}
.jrech .jrech-chip:hover { border-color: var(--jr-green); }
.jrech .jrech-chip--accent { background: var(--jr-cream); border-color: var(--jr-cream); font-weight: 600; }

/* Rayons (ouverture, aucun résultat) */
.jrech-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.jrech-tile {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 56px; padding: 0 18px; border-radius: 14px; background: var(--jr-cream);
  font-size: 16px; font-weight: 600;
}
.jrech-tile:hover { background: #F6E8D6; }

/* En-tête de la liste, messages */
.jrech-head { display: flex; align-items: baseline; justify-content: space-between; }
.jrech-head .jrech-label { padding-bottom: 0; }
.jrech-head__count { font-size: 14px; color: var(--jr-muted); }
.jrech-note {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 12px 14px; border-radius: 12px; background: var(--jr-cream); font-size: 14px;
}
.jrech .jrech-note__link { font-size: 13px; color: var(--jr-green); text-decoration: underline; }

/* Produits */
.jrech-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.jrech-items .jrech-item:nth-child(n+7) { display: none; }
.jrech-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 16px; border: 1px solid var(--jr-line); background: #fff;
}
/* Ordinateur : le bouton se cale en bas à droite, le nom garde toute la largeur. Produit au
   panier : le sélecteur de quantité passe sur sa propre ligne, à droite. */
.jrech-items .jrech-item__img { width: 76px; height: 76px; }
.jrech-action { display: flex; flex-shrink: 0; align-self: center; }
.jrech-items .jrech-item .jrech-action { position: absolute; right: 12px; bottom: 12px; }
.jrech-items .jrech-price { padding-right: 44px; }
.jrech-items .jrech-item.has-qty { flex-wrap: wrap; row-gap: 8px; }
.jrech-items .jrech-item.has-qty .jrech-action { position: static; width: 100%; justify-content: flex-end; }
.jrech-items .jrech-item.has-qty .jrech-price { padding-right: 0; }

/* Sélecteur de quantité : même dessin que le panier latéral (Jida Panier). */
.jrech-qty {
  display: flex; align-items: center; gap: 4px; padding: 3px;
  border: 1px solid #ECE4D8; border-radius: 22px; background: #fff;
}
.jrech .jrech-qty__btn {
  position: relative; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.jrech .jrech-qty__btn::after { content: ""; position: absolute; inset: -5px; }
.jrech .jrech-qty__minus { color: var(--jr-green); }
.jrech .jrech-qty__minus:hover { background: #F5EFE6; }
.jrech .jrech-qty__plus { background: var(--jr-green); color: #fff; }
.jrech .jrech-qty__plus:hover { background: #2E5542; }
.jrech .jrech-qty__btn:disabled { opacity: 0.35; cursor: default; }
.jrech-qty__val { min-width: 18px; text-align: center; font-size: 15px; font-weight: 700; color: var(--jr-ink); }
.jrech-item:hover, .jrech-item.is-active { background: var(--jr-hover); border-color: #CFC7B8; }
.jrech-item__link { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.jrech-item__img {
  width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
  background: var(--jr-field); display: block;
}
.jrech-item.is-out .jrech-item__img { opacity: 0.55; }
.jrech-item__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.jrech-item__name {
  font-size: 15px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.jrech-item__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--jr-muted); }
.jrech-rating { display: inline-flex; align-items: center; gap: 4px; }
.jrech-rating strong { color: var(--jr-ink); font-weight: 600; }
.jrech-price { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; }
.jrech-price strong { font-size: 16px; font-weight: 700; color: var(--jr-ink); }
.jrech-price strong.is-muted { color: var(--jr-muted); }
.jrech-price del { font-size: 13px; color: var(--jr-muted); }
.jrech-price__from { font-size: 13px; font-weight: 400; }
.jrech-pill {
  font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--jr-coral-ink); background: var(--jr-coral-bg);
  border-radius: 6px; padding: 3px 7px; white-space: nowrap;
}
.jrech-pill--out { color: #4A524C; background: #ECE8E1; }
.jrech-item__error { position: absolute; left: 12px; right: 12px; bottom: 4px; font-size: 12px; color: #B42318; text-align: right; }
.jrech-item.has-qty .jrech-item__error { position: static; width: 100%; }

.jrech .jrech-btn {
  width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0; align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--jr-green); color: #fff; transition: background 0.15s;
}
.jrech .jrech-btn:hover { background: var(--jr-green-dark); color: #fff; }
.jrech .jrech-btn--ghost { background: #fff; color: var(--jr-green); border: 1.5px solid var(--jr-green); }
.jrech .jrech-btn--ghost:hover { background: var(--jr-hover); color: var(--jr-green); }
.jrech .jrech-btn--choose { width: auto; padding: 0 14px; font-size: 14px; font-weight: 600; }
.jrech .jrech-add.is-busy { opacity: 0.6; cursor: progress; }
.jrech .jrech-add.is-done { background: #2F7A4F; }

.jrech-item--ghost { border-color: transparent; }
.jrech-item--ghost .jrech-item__body { flex: 1; gap: 8px; }
.jrech-item--ghost .jrech-item__body span { display: block; height: 12px; border-radius: 6px; background: var(--jr-field); }
.jrech-item--ghost .jrech-item__body span:first-child { width: 80%; }
.jrech-item--ghost .jrech-item__body span:last-child { width: 45%; }

/* Meilleures ventes : cartes en colonne sur ordinateur */
.jrech-best { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.jrech-best .jrech-item { flex-direction: column; align-items: stretch; padding: 0; border: 0; background: none; gap: 10px; }
.jrech-best .jrech-item:hover { background: none; }
.jrech-best .jrech-item__link { flex-direction: column; align-items: stretch; gap: 8px; }
.jrech-best .jrech-item__img { width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 14px; }
.jrech-best .jrech-price { padding-right: 48px; min-height: 40px; }
.jrech-best .jrech-action { position: absolute; right: 0; bottom: 0; }
.jrech-best .jrech-item.has-qty .jrech-action { position: static; justify-content: flex-end; }
.jrech-best .jrech-item.has-qty .jrech-price { padding-right: 0; min-height: 0; }

/* Pied : raccourcis, confirmation d'ajout, tous les résultats */
.jrech-foot { margin-top: 24px; margin-left: 308px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.jrech-foot__hint { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--jr-muted); }
.jrech-foot__hint kbd:nth-of-type(3) { margin-left: 10px; }
.jrech-foot__added { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #2F7A4F; min-width: 0; }
.jrech-foot__added[hidden] { display: none; }
.jrech-foot__added span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--jr-ink); }
.jrech-foot:has(.jrech-foot__added:not([hidden])) .jrech-foot__hint { display: none; }
.jrech .jrech-foot__cart { color: var(--jr-green); text-decoration: underline; font-size: 14px; white-space: nowrap; }
.jrech-all {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--jr-green); color: #fff !important; font-size: 15px; font-weight: 600;
  padding: 14px 24px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.jrech-all:hover { background: var(--jr-green-dark); }

/* Aucun résultat */
.jrech-empty { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.jrech-empty__title { font-size: 20px; font-weight: 700; }
.jrech-empty__text { color: var(--jr-muted); }
.jrech-empty .jrech-chips--wrap { padding: 0; }
.jrech-empty .jrech-sec { margin-top: 12px; }
.jrech-empty .jrech-label { padding-left: 0; }

/* Tablette */
@media (max-width: 1099px) and (min-width: 768px) {
  .jrech-grid { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
  .jrech-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jrech-best { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jrech-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jrech-foot { margin-left: 252px; }
  .jrech-foot__hint { display: none; }
}

/* Mobile : plein écran, liste, bouton « Voir les produits » toujours visible */
@media (max-width: 767px) {
  .jrech__backdrop { display: none; }
  .jrech__panel {
    inset: 0; bottom: 0; height: 100%; max-height: none; border-radius: 0; padding: 0;
    display: flex; flex-direction: column; overflow: hidden; box-shadow: none;
  }
  .jrech__inner { width: 100%; height: 100%; display: flex; flex-direction: column; }
  .jrech__bar { gap: 8px; padding: 14px 16px 12px 8px; padding-top: max(14px, env(safe-area-inset-top)); }
  .jrech .jrech__back { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; flex-shrink: 0; }
  .jrech .jrech__close { display: none; }
  .jrech__field { height: 48px; border-radius: 24px; padding: 0 4px 0 16px; gap: 10px; }
  .jrech__field > svg { width: 18px; height: 18px; }
  .jrech .jrech__field input.jrech__input { font-size: 17px; }
  .jrech .jrech__clear { background: transparent; }

  .jrech__body { margin-top: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .jrech.has-query .jrech__body { padding-bottom: 96px; }
  .jrech-grid { display: block; }
  .jrech-grid--results .jrech-aside { display: none; }
  .jrech-grid--home { padding: 18px 16px 24px; }
  .jrech-grid--home .jrech-aside, .jrech-grid--home .jrech-main { gap: 22px; }
  .jrech-grid--home .jrech-main { margin-top: 22px; }
  .jrech-label { font-size: 12px; padding: 0 0 8px; }
  .jrech .jrech-link { padding: 0; height: 44px; border-radius: 0; }
  .jrech .jrech-link:hover { background: none; }
  .jrech .jrech-recent__del { width: 44px; height: 44px; }
  .jrech-chips--wrap { padding: 0; }
  .jrech .jrech-chip { height: 40px; font-size: 15px; }
  .jrech-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .jrech-tile { height: 52px; padding: 0 14px; border-radius: 12px; font-size: 15px; }

  .jrech-grid--results .jrech-main { gap: 0; }
  .jrech-chips--scroll {
    display: flex; overflow-x: auto; padding: 2px 16px 14px; border-bottom: 1px solid #EEE9E0;
    scrollbar-width: none;
  }
  .jrech-chips--scroll::-webkit-scrollbar { display: none; }
  .jrech .jrech-chips--scroll .jrech-chip { font-size: 14px; height: 38px; }
  .jrech-note { margin: 2px 16px 12px; }
  .jrech-head { padding: 14px 16px 4px; }
  .jrech-head .jrech-label { font-size: 12px; }
  .jrech-head__count { font-size: 13px; }

  .jrech-items { display: block; padding: 0 16px; }
  .jrech-items .jrech-item .jrech-action { position: static; }
  .jrech-items .jrech-item.has-qty { flex-wrap: nowrap; }
  .jrech-items .jrech-item.has-qty .jrech-action { width: auto; }
  .jrech-items .jrech-price { padding-right: 0; }
  .jrech-items .jrech-item:nth-child(n+7) { display: flex; }
  .jrech-item {
    border: 0; border-bottom: 1px solid #EEE9E0; border-radius: 0; padding: 10px 0; background: none;
  }
  .jrech-item:hover, .jrech-item.is-active { background: none; }
  .jrech-item__link { gap: 12px; }
  .jrech-item__img, .jrech-items .jrech-item__img { width: 68px; height: 68px; border-radius: 10px; }
  .jrech-item__body { gap: 3px; }
  .jrech-price strong { font-size: 15px; }
  .jrech-pill { padding: 2px 6px; }
  .jrech .jrech-btn { width: 44px; height: 44px; border-radius: 22px; }
  .jrech .jrech-btn--choose { width: auto; }

  .jrech-best { display: block; }
  .jrech-best .jrech-item { flex-direction: row; align-items: center; border-bottom: 0; border-top: 1px solid #EEE9E0; padding: 10px 0; gap: 12px; }
  .jrech-best .jrech-item:nth-child(n+4) { display: none; }
  .jrech-best .jrech-item__link { flex-direction: row; align-items: center; gap: 12px; }
  .jrech-best .jrech-item__img { width: 64px; height: 64px; border-radius: 10px; aspect-ratio: auto; }
  .jrech-best .jrech-item__meta { display: none; }
  .jrech-best .jrech-price { padding-right: 0; min-height: 0; }
  .jrech-best .jrech-action { position: static; }

  .jrech-foot {
    position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
    padding: 12px 16px; padding-bottom: max(26px, env(safe-area-inset-bottom));
    background: #fff; box-shadow: 0 -8px 24px rgba(20, 32, 26, 0.08);
    flex-direction: column; align-items: stretch; gap: 8px;
  }
  .jrech-foot__hint { display: none; }
  .jrech-foot__added { justify-content: center; font-size: 13px; }
  .jrech-all { height: 52px; border-radius: 26px; font-size: 16px; padding: 0 20px; }

  .jrech-empty { padding: 18px 16px; }
}
