/* ============================================================
   SP Theme — Recherche produit (sp-search.css)
   À inclure APRÈS main.css
   ============================================================ */


/* ────────────────────────────────────────────────────────────
   Modal overlay
   ──────────────────────────────────────────────────────────── */
#smodal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 14, 22, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 1rem;
  /* Animation */
  opacity: 0;
  transition: opacity 0.25s ease;
}
#smodal.sp-modal-open {
  opacity: 1;
}


/* ────────────────────────────────────────────────────────────
   Boîte centrale
   ──────────────────────────────────────────────────────────── */
.sp-search-box {
  background: #fff;
  border-radius: 18px;
  width: min(580px, 94vw);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  /* Animation depuis le haut */
  transform: translateY(-16px);
  transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}
#smodal.sp-modal-open .sp-search-box {
  transform: translateY(0);
}


/* ────────────────────────────────────────────────────────────
   Ligne de saisie
   ──────────────────────────────────────────────────────────── */
.sp-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1.5px solid #e5e7eb;
  transition: border-color 0.2s;
}
.sp-search-input-wrap:focus-within {
  border-color: #10b981;
}

.sp-search-icon {
  width: 18px;
  height: 18px;
  color: #9ca3af;
  flex-shrink: 0;
}

.sp-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  color: #0f1923;
  background: transparent;
  min-width: 0;
}
.sp-search-input::placeholder { color: #9ca3af; }

/* Spinner */
.sp-search-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.sp-search-spinner.hidden { display: none; }
.sp-spin-ring {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: sp-spin 0.7s linear infinite;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* Bouton clear */
.sp-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sp-search-clear.hidden { display: none; }
.sp-search-clear:hover  { background: #e5e7eb; color: #111827; }
.sp-search-clear svg    { width: 12px; height: 12px; }

.sp-search-kbd {
  font-family: inherit;
  font-size: 0.6rem;
  font-weight: 600;
  color: #9ca3af;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.08rem 0.32rem;
  white-space: nowrap;
  flex-shrink: 0;
}


/* ────────────────────────────────────────────────────────────
   Zone résultats
   ──────────────────────────────────────────────────────────── */
.sp-search-results {
  max-height: 54vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
}
.sp-search-results::-webkit-scrollbar { width: 4px; }
.sp-search-results::-webkit-scrollbar-track { background: transparent; }
.sp-search-results::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
.sp-search-results.hidden { display: none; }


/* ── Liste des résultats ── */
.sp-sr-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.sp-sr-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 0;
}
.sp-sr-item:hover,
.sp-sr-item.sp-sr-focused {
  background: #f0fdf4;
}

/* Miniature */
.sp-sr-img {
  flex-shrink: 0;
  width: 52px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-sr-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sp-sr-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-sr-img-placeholder svg {
  width: 22px;
  height: 22px;
  color: #d1d5db;
}

/* Titre + prix */
.sp-sr-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.sp-sr-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f1923;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-sr-price {
  font-size: 0.78rem;
  font-weight: 700;
  color: #10b981;
}

/* Flèche */
.sp-sr-arrow {
  width: 16px;
  height: 16px;
  color: #9ca3af;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.sp-sr-item:hover .sp-sr-arrow,
.sp-sr-item.sp-sr-focused .sp-sr-arrow {
  opacity: 1;
  transform: translateX(3px);
}

/* ── Lien "voir tous" ── */
.sp-sr-all-link {
  display: block;
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #10b981;
  text-align: center;
  border-top: 1px solid #f3f4f6;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.sp-sr-all-link:hover { background: #f0fdf4; color: #059669; }

/* ── État vide ── */
.sp-sr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 1.5rem;
  gap: 0.6rem;
  text-align: center;
}
.sp-sr-empty svg {
  width: 36px;
  height: 36px;
  color: #d1d5db;
}
.sp-sr-empty p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
}
.sp-sr-empty strong { color: #0f1923; }
.sp-sr-empty .sp-sr-all {
  font-size: 0.8rem;
  font-weight: 700;
  color: #10b981;
  text-decoration: none;
}
.sp-sr-empty .sp-sr-all:hover { color: #059669; }

/* ── Erreur ── */
.sp-sr-error {
  padding: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #dc2626;
}


/* ────────────────────────────────────────────────────────────
   Footer modal : raccourcis clavier
   ──────────────────────────────────────────────────────────── */
.sp-search-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid #f3f4f6;
  background: #f9fafb;
}
.sp-search-hint {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: #9ca3af;
  font-weight: 500;
}
.sp-search-hint kbd {
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.05rem 0.28rem;
  color: #6b7280;
  box-shadow: 0 1px 0 #d1d5db;
}


/* ────────────────────────────────────────────────────────────
   Recherche MOBILE (dans le drawer #mob)
   ──────────────────────────────────────────────────────────── */
#mob-sresults {
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#mob-sresults.hidden { display: none; }

.sp-mob-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sp-mob-list li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  text-decoration: none;
  color: #0f1923;
  font-size: 0.82rem;
  font-weight: 600;
  border-bottom: 1px solid #f3f4f6;
  transition: color 0.15s;
}
.sp-mob-list li:last-child a { border-bottom: none; }
.sp-mob-list li a:hover { color: #10b981; }

.sp-mob-img {
  width: 40px;
  height: 34px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  flex-shrink: 0;
}
.sp-mob-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sp-mob-img-ph {
  width: 100%;
  height: 100%;
  background: #e5e7eb;
}

.sp-mob-all {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.77rem;
  font-weight: 700;
  color: #10b981;
  text-decoration: none;
  text-align: right;
}
.sp-mob-all:hover { color: #059669; }

.sp-mob-searching,
.sp-mob-empty,
.sp-mob-error {
  font-size: 0.8rem;
  color: #6b7280;
  padding: 0.5rem 0;
}
.sp-mob-empty strong { color: #0f1923; }
.sp-mob-error { color: #dc2626; }
