/* =========================
   OVERLAY FLOU
========================= */

#searchmodal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  display: none;
}

#searchmodal-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   MODALE
========================= */

.searchmodal {
  width: 80vw;
  height: 80vh;
  background: #f7f5ef;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =========================
   BARRE DE RECHERCHE FIXE
========================= */

.searchmodal-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f7f5ef;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #e4e0d6;
}

/* INPUT + LOUPE */

.searchmodal-input-wrapper {
  position: relative;
  flex: 1;
}

.searchmodal-input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border-radius: 999px;
  border: 1px solid #d8d3c7;
  font-size: 15px;
  background: #fff;
}

/* LOUPE */

.searchmodal-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23707070'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-4.35-4.35m0 0A7.5 7.5 0 103.5 3.5a7.5 7.5 0 0013.15 13.15z'/%3E%3C/svg%3E") no-repeat center;
}

/* BOUTONS */

.searchmodal-close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
}

.searchmodal-filters-btn {
  display: none;
  background: var(--nursery-green);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* =========================
   BODY
========================= */

.searchmodal-body {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

/* =========================
   COLONNE CATÉGORIES
========================= */

#searchmodal-categories {
  background: #fbfaf6;
  border-right: 1px solid #e4e0d6;
  overflow-y: auto;
  padding: 16px;
}

/* PILLS CATÉGORIES */

.category-pill {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: #e5efe9;
  color: var(--nursery-green);
  margin: 4px;
  cursor: pointer;
  transition: all .2s;
  font-size: 14px;
}

.category-pill:hover,
.category-pill.active {
  background: var(--nursery-green);
  color: #fff;
}

/* =========================
   RESULTATS
========================= */

#searchmodal-results {
  overflow-y: auto;
  padding: 16px;
}

/* ===============================
   DESKTOP PRODUCT GRID
=============================== */

@media (min-width: 992px) {

  #searchmodal-results,
  #searchmodal-results .modal-product-grid,
  #searchmodal-results .products,
  #searchmodal-results .product-list {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px;
  }

  .js-product.product {
    width: calc(33% - 12px);
  }

  #searchmodal-results article.product-miniature {
    flex: 0 0 200px;
    max-width: 200px;
    margin: 0;
  }

  #searchmodal-results article.product-miniature > * {
    width: 100%;
  }
}

/* ===============================
   FILTRES ACTIFS
=============================== */

#searchmodal-active-filters {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  flex-wrap: wrap;
}

.searchmodal-filter-chip {
  background: var(--nursery-green);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.searchmodal-filter-chip .filter-remove {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 991px) {

  .searchmodal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  /* 🔧 FIX INPUT MOBILE (champ coupé) */
  .searchmodal-top {
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .searchmodal-input-wrapper input {
    height: 42px;
    padding: 8px 14px 8px 42px;
    font-size: 15px;
  }

  .searchmodal-close,
  .searchmodal-filters-btn {
    height: 42px;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .searchmodal-body {
    grid-template-columns: 1fr;
  }

  #searchmodal-categories {
    display: none;
  }

  #searchmodal-categories.open {
    display: block;
    position: fixed;
    inset: 0;
    background: #f7f5ef;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
  }

  .searchmodal-filters-btn {
    display: inline-flex;
  }

  #searchmodal-results {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .js-product.product {
    width: calc(50% - 14px);
    margin: 0.4rem;
  }
}
/* ===============================
   PRODUCT CARDS – SEARCH MODAL
=============================== */

#searchmodal-results .js-product.product {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
  display: flex;
  flex-direction: column;
}

/* Image produit */
#searchmodal-results .js-product.product img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Contenu */
#searchmodal-results .js-product.product .product-description,
#searchmodal-results .js-product.product .product-description-short {
  padding: 12px 14px;
  flex: 1;
}

/* Nom produit */
#searchmodal-results .js-product.product .product-title,
#searchmodal-results .js-product.product h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
  color: #2d2d2d;
}

/* Prix */
#searchmodal-results .js-product.product .price,
#searchmodal-results .js-product.product .product-price {
  font-weight: 700;
  color: var(--nursery-green);
  font-size: 15px;
}

/* Hover desktop */
@media (hover: hover) {
  #searchmodal-results .js-product.product:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
    border-color: var(--nursery-green);
  }
}

/* Tap feedback mobile */
@media (hover: none) {
  #searchmodal-results .js-product.product:active {
    transform: scale(0.98);
  }
}

