/* ==================================================
   RECHERCHE AJAX COOP
   Beige : #E9BF80
   Marron : #431E0B
================================================== */

/* Le header et les conteneurs parents ne doivent pas couper le panneau. */
.elementor-location-header,
.elementor-location-header .elementor-element-d4df9e6,
.elementor-location-header .elementor-element-130b336,
.elementor-location-header .elementor-element-7432c91,
.elementor-location-header .elementor-widget-shortcode,
.elementor-location-header .elementor-widget-shortcode > .elementor-widget-container {
  overflow: visible !important;
}

.elementor-location-header {
  position: relative;
  z-index: 999990 !important;
}

/* Ne pas modifier la position du conteneur : Elementor conserve son position: fixed/sticky. */
.elementor-location-header .elementor-element-d4df9e6 {
  z-index: 999990 !important;
}

.paw-coop-search {
  --paw-search-width: 360px;
  --paw-search-panel-width: 430px;
  --coop-beige: #E9BF80;
  --coop-brown: #431E0B;
  --coop-cream: #FFF9F0;
  position: relative;
  z-index: 1000000 !important;
  width: 23px;
  height: 42px;
  color: #fff;
  font-family: inherit;
  isolation: isolate;
}

.paw-coop-search *,
.paw-coop-search *::before,
.paw-coop-search *::after {
  box-sizing: border-box;
}

.paw-coop-search__form {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
}

/* Loupe blanche, sans fond, y compris avec les styles globaux Elementor. */
.paw-coop-search__trigger,
.paw-coop-search__trigger:hover,
.paw-coop-search__trigger:focus,
.paw-coop-search__trigger:focus-visible,
.paw-coop-search__trigger:active,
.paw-coop-search__close,
.paw-coop-search__close:hover,
.paw-coop-search__close:focus,
.paw-coop-search__close:active {
  appearance: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
}

.paw-coop-search__trigger {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 23px;
  min-width: 23px;
  height: 42px;
  color: #fff !important;
  opacity: 1;
  transition: color 180ms ease, transform 180ms ease;
}

.paw-coop-search__trigger:hover,
.paw-coop-search__trigger:focus-visible {
  color: var(--coop-beige) !important;
  transform: scale(1.04);
}

.paw-coop-search__trigger svg {
  display: block;
  width: 23px;
  height: 25px;
  background: transparent !important;
}

.paw-coop-search__trigger svg path {
  fill: currentColor !important;
}

.paw-coop-search__field {
  position: absolute;
  top: 50%;
  right: 35px;
  z-index: 1000001 !important;
  width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transform-origin: right center;
  transition: width 360ms cubic-bezier(.22, 1, .36, 1), opacity 180ms ease;
}

.paw-coop-search.is-open .paw-coop-search__field {
  width: min(var(--paw-search-width), calc(100vw - 170px));
  opacity: 1;
  pointer-events: auto;
}

.paw-coop-search__input {
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 46px 0 17px;
  border: 1px solid var(--coop-beige);
  border-radius: 0;
  background: var(--coop-brown);
  color: #fff;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  letter-spacing: .01em;
  outline: none;
  box-shadow: 0 8px 30px rgba(67, 30, 11, .22);
}

.paw-coop-search__input::-webkit-search-cancel-button {
  display: none;
}

.paw-coop-search__input::placeholder {
  color: rgba(255, 255, 255, .7);
  opacity: 1;
}

.paw-coop-search__input:hover {
  border-color: #fff;
}

.paw-coop-search__input:focus {
  border-color: var(--coop-beige);
  background: var(--coop-brown);
  box-shadow: 0 0 0 2px rgba(233, 191, 128, .18), 0 10px 35px rgba(67, 30, 11, .28);
}

.paw-coop-search__close {
  position: absolute;
  top: 50%;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  color: var(--coop-beige) !important;
  transform: translateY(-50%);
}

.paw-coop-search__close:hover {
  color: #fff !important;
}

.paw-coop-search__close svg {
  display: block;
  width: 18px;
  height: 18px;
}

/* Panneau au premier plan. */
.paw-coop-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000002 !important;
  width: min(var(--paw-search-panel-width), calc(100vw - 30px));
  max-height: min(66vh, 540px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--coop-beige);
  background: var(--coop-cream);
  color: var(--coop-brown);
  box-shadow: 0 20px 55px rgba(67, 30, 11, .3);
  scrollbar-width: thin;
}

.paw-coop-search__panel[hidden] {
  display: none !important;
}

/* Aucun bloc Catégories ou Produits : les produits arrivent directement. */
.paw-coop-search__section-title,
.paw-coop-search__result--category {
  display: none !important;
}

.paw-coop-search__result {
  position: relative;
  display: grid;
  align-items: center;
  width: 100%;
  color: var(--coop-brown);
  text-decoration: none;
  border-bottom: 1px solid rgba(67, 30, 11, .1);
  transition: background-color 160ms ease, color 160ms ease;
}

.paw-coop-search__result:hover,
.paw-coop-search__result.is-active {
  background: var(--coop-brown);
  color: #fff;
}

.paw-coop-search__result--product {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 13px;
  min-height: 76px;
  padding: 9px 15px;
}

.paw-coop-search__product-image {
  display: block;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(67, 30, 11, .08);
  background: rgba(233, 191, 128, .22);
  object-fit: cover;
}

.paw-coop-search__product-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.paw-coop-search__product-name {
  overflow: hidden;
  color: var(--coop-brown);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paw-coop-search__product-category {
  margin-top: 4px;
  overflow: hidden;
  color: rgba(67, 30, 11, .58);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paw-coop-search__product-price {
  padding-left: 10px;
  color: var(--coop-brown);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
}

.paw-coop-search__product-price del {
  display: block;
  margin-bottom: 2px;
  color: rgba(67, 30, 11, .45);
  font-size: 10px;
  font-weight: 400;
}

.paw-coop-search__product-price ins {
  color: inherit;
  text-decoration: none;
}

.paw-coop-search__result:hover .paw-coop-search__product-name,
.paw-coop-search__result.is-active .paw-coop-search__product-name {
  color: #fff;
}

.paw-coop-search__result:hover .paw-coop-search__product-category,
.paw-coop-search__result.is-active .paw-coop-search__product-category {
  color: rgba(255, 255, 255, .68);
}

.paw-coop-search__result:hover .paw-coop-search__product-price,
.paw-coop-search__result:hover .paw-coop-search__product-price ins,
.paw-coop-search__result.is-active .paw-coop-search__product-price,
.paw-coop-search__result.is-active .paw-coop-search__product-price ins {
  color: var(--coop-beige);
}

.paw-coop-search__result:hover .paw-coop-search__product-price del,
.paw-coop-search__result.is-active .paw-coop-search__product-price del {
  color: rgba(255, 255, 255, .55);
}

.paw-coop-search__view-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 12px 15px;
  border-top: 1px solid var(--coop-beige);
  background: var(--coop-brown);
  color: var(--coop-beige);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .06em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 160ms ease, color 160ms ease;
}

.paw-coop-search__view-all::after {
  content: "→";
  margin-left: 15px;
  font-size: 15px;
  font-weight: 400;
}

.paw-coop-search__view-all:hover,
.paw-coop-search__view-all.is-active {
  background: var(--coop-beige);
  color: var(--coop-brown);
}

.paw-coop-search__message {
  min-height: 74px;
  padding: 27px 20px;
  background: var(--coop-cream);
  color: var(--coop-brown);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.paw-coop-search__message.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 9px;
  border: 1px solid rgba(67, 30, 11, .2);
  border-top-color: var(--coop-brown);
  border-radius: 50%;
  vertical-align: -3px;
  animation: paw-coop-search-spin .7s linear infinite;
}

.paw-coop-search__trigger:focus-visible,
.paw-coop-search__close:focus-visible,
.paw-coop-search__input:focus-visible,
.paw-coop-search__result:focus-visible,
.paw-coop-search__view-all:focus-visible {
  outline: 2px solid var(--coop-beige);
  outline-offset: 2px;
}

@keyframes paw-coop-search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
  .paw-coop-search {
    position: relative;
  }

  .paw-coop-search__field,
  .paw-coop-search.is-open .paw-coop-search__field {
    position: fixed;
    top: var(--paw-search-mobile-top, 76px);
    right: 15px;
    left: 15px;
    z-index: 1000001 !important;
    width: auto;
    transform: none;
  }

  .paw-coop-search__input {
    height: 48px;
    font-size: 14px;
  }

  .paw-coop-search__panel {
    right: 0;
    left: 0;
    width: auto;
    max-height: min(62vh, 470px);
  }

  .paw-coop-search__result--product {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 10px;
    padding-right: 13px;
    padding-left: 13px;
  }

  .paw-coop-search__product-image {
    width: 52px;
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .paw-coop-search__field,
  .paw-coop-search__trigger,
  .paw-coop-search__result,
  .paw-coop-search__view-all {
    transition: none;
  }

  .paw-coop-search__message.is-loading::before {
    animation-duration: 1.4s;
  }
}
