/* ================================================================
   Recherche pièces détachées — styles isolés (préfixe axed-search-*)
   ================================================================ */

/* Conteneur principal */
.axed-search-wrap {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  font-family: inherit;
}

/* Input wrapper */
.axed-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 0.5rem;
  transition: border-color 0.2s;
  overflow: hidden;
}
.axed-search-input-wrap:focus-within {
  border-color: var(--bleu, #023a66);
  box-shadow: 0 0 0 3px rgba(2, 58, 102, 0.12);
}

/* Icône loupe */
.axed-search-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.85rem;
  flex-shrink: 0;
  color: #94a3b8;
}

/* Input */
.axed-search-input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 0.85rem 0.75rem;
  font-size: 1rem;
  background: transparent;
  color: #1e293b;
}
.axed-search-input::placeholder {
  color: #94a3b8;
}

/* Bouton clear */
.axed-search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-right: 0.5rem;
  border: 0;
  background: #f1f5f9;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  color: #64748b;
  flex-shrink: 0;
}
.axed-search-clear:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* ================================================================
   Résultats dropdown
   ================================================================ */
.axed-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 400px;
  overflow-y: auto;
  z-index: 9999;
}

/* Fix #20 : le cover block WP coupe le dropdown avec overflow:hidden */
.wp-block-cover:has(.axed-search-wrap) {
  overflow: visible;
}
.wp-block-cover:has(.axed-search-wrap) .wp-block-cover__inner-container {
  overflow: visible;
}

/* Item résultat */
.axed-search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  color: #1e293b;
  transition: background-color 0.15s;
  border-bottom: 1px solid #f1f5f9;
}
.axed-search-item:last-child {
  border-bottom: 0;
}
.axed-search-item:hover,
.axed-search-item.active {
  background: #f8fafc;
}

/* Thumbnail */
.axed-search-thumb {
  width: 48px;
  height: 48px;
  border-radius: 0.35rem;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}
.axed-search-no-img {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Info texte */
.axed-search-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.axed-search-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.axed-search-ref {
  font-size: 0.8rem;
  color: #64748b;
}

/* Loading & empty */
.axed-search-loading,
.axed-search-empty {
  padding: 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

/* ================================================================
   Preview éditeur Gutenberg
   ================================================================ */
.axed-search-preview .axed-search-input {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 600px) {
  .axed-search-wrap {
    max-width: 100%;
  }
  .axed-search-results {
    max-height: 60vh;
  }
  .axed-search-thumb {
    width: 40px;
    height: 40px;
  }
}

/* ================================================================
   Template single pièce détachée
   Layout produit : image à gauche, infos à droite
   ================================================================ */
.axed-single-piece {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Layout 2 colonnes */
.axed-piece-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* Galerie images */
.axed-piece-gallery {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.axed-piece-main-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
}
.axed-piece-main-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
.axed-piece-no-image {
  background: #f1f5f9;
}

/* Miniatures */
.axed-piece-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.axed-piece-thumb-item {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 0.35rem;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
  opacity: 0.7;
}
.axed-piece-thumb-item:hover {
  opacity: 1;
  border-color: #94a3b8;
}
.axed-piece-thumb-item.active {
  border-color: var(--bleu, #023a66);
  opacity: 1;
}

/* Détails produit */
.axed-piece-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
}
.axed-piece-ref {
  font-size: 0.85rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.axed-piece-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #475569;
  margin: 0;
}

/* Prix */
.axed-piece-price {
  padding: 1rem 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  margin: 0.5rem 0;
}
.axed-piece-price-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bleu, #023a66);
}

/* Actions */
.axed-piece-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.axed-piece-actions .btn {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .axed-piece-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .axed-piece-thumb-item {
    width: 60px;
    height: 60px;
  }
  .axed-piece-actions {
    flex-direction: column;
  }
  .axed-piece-actions .btn {
    width: 100%;
    text-align: center;
  }
}
