/**
 * SUPER Z-INDEX BOUTONS - PRIORITÉ ABSOLUE SUR TOUT
 * Garantit que TOUS les boutons produits sont cliquables au-dessus de TOUT
 * Y compris modals, popups, overlays, etc.
 */

/* ===== Z-INDEX ULTRA-SUPRÊME POUR BOUTONS PRODUITS ===== */

/* BOUTON AJOUTER AU PANIER - PRIORITÉ ABSOLUE */
button[data-button-action="add-to-cart"],
.btn.add-to-cart,
.add-to-cart,
.product-add-to-cart button,
.product-add-to-cart .btn {
  z-index: 999999999 !important;
  position: relative !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* TOUS LES BOUTONS PRODUITS SUPÉRIEURS À TOUT */
.product-actions button,
.product-actions .btn,
.product-quantity button,
.product-quantity .btn,
.product-variants button,
.product-variants .btn,
.product-variants select,
.product-variants input,
#quantity_wanted,
input[name="qty"],
input[type="number"],
input[type="submit"],
input[type="button"] {
  z-index: 888888888 !important;
  position: relative !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* TOUS LES BOUTONS GÉNÉRIQUES AU-DESSUS DE TOUT */
button,
.btn,
input[type="submit"],
input[type="button"],
input[type="reset"],
.button,
[role="button"] {
  z-index: 777777777 !important;
  position: relative !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* CONTENEURS PRODUITS PRIORITAIRES */
.product-add-to-cart,
.product-actions,
.product-quantity,
.qty,
.add,
.product-variants,
.product-customization,
.product-discounts {
  z-index: 666666666 !important;
  position: relative !important;
  pointer-events: auto !important;
}

/* IMAGES PRODUITS CLIQUABLES */
.product-images,
.product-images img,
.product-images .thumb,
.images-container .thumb,
.js-thumb,
.thumb-container,
.layer[data-toggle="modal"] {
  z-index: 555555555 !important;
  position: relative !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* ===== FORCER ÉLÉMENTS BLOQUANTS EN ARRIÈRE-PLAN ===== */

/* H2 ET MODALS EN ARRIÈRE-PLAN */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
p.h1, p.h2, p.h3, p.h4, p.h5, p.h6 {
  z-index: 1 !important;
  position: relative !important;
}

/* MODALS ET POPUPS EN ARRIÈRE-PLAN */
.modal,
.modal-dialog,
.modal-content,
.modal-header,
.modal-body,
.modal-footer,
.modal-backdrop,
.product-comment-modal,
.popup,
.overlay,
.exit-intent-popup {
  z-index: 10000 !important;
  position: relative !important;
}

/* MOBILE MENU EN ARRIÈRE-PLAN */
.mobile-menu,
#mobile-menu,
.mobile-nav {
  z-index: 200 !important;
  position: relative !important;
}

/* ===== CORRECTIONS SPÉCIALES POUR CONFLITS ===== */

/* S'ASSURER QUE LES BOUTONS NE SONT JAMAIS MASQUÉS */
.product-add-to-cart *,
.product-actions *,
.product-quantity * {
  pointer-events: auto !important;
}

/* ÉLIMINER OVERLAYS BLOQUANTS */
body::before,
body::after,
.page-content::before,
.page-content::after,
.container::before,
.container::after,
.row::before,
.row::after {
  pointer-events: none !important;
  z-index: -1 !important;
}

/* CORRIGER MODALS INVISIBLES MAIS ACTIVES */
.modal:not(.show),
.modal.fade:not(.show),
.modal[aria-hidden="true"] {
  pointer-events: none !important;
  z-index: -999 !important;
}

.modal:not(.show) *,
.modal.fade:not(.show) *,
.modal[aria-hidden="true"] * {
  pointer-events: none !important;
}

/* ===== BOUTONS MODALS AUSSI PRIORITAIRES ===== */

/* BOUTONS DANS MODALS CLIQUABLES */
.modal.show button,
.modal.show .btn,
.modal:not([aria-hidden="true"]) button,
.modal:not([aria-hidden="true"]) .btn {
  z-index: 999999998 !important;
  position: relative !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* ===== CORRECTIONS POUR JAVASCRIPT ===== */

/* S'ASSURER QUE LES ÉVÉNEMENTS JS FONCTIONNENT */
button[data-button-action],
[data-toggle],
[data-target],
[data-dismiss],
.js-product-add-to-cart,
.js-product-add-to-cart *,
[onclick] {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: inherit !important;
}

/* ===== DEBUG ET VISIBILITÉ FORCÉE ===== */

/* FORCER VISIBILITÉ COMPLÈTE DES BOUTONS PRODUITS */
.product-add-to-cart,
.product-add-to-cart button,
.product-add-to-cart .btn,
button[data-button-action="add-to-cart"] {
  display: block !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  transform: none !important;
  clip: auto !important;
  clip-path: none !important;
  overflow: visible !important;
}

/* ÉLIMINER MASQUAGE POTENTIEL */
.product-add-to-cart {
  max-height: none !important;
  height: auto !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

/* ===== PRIORITÉ ABSOLUE STYLE BOUTONS ===== */

/* BOUTON AJOUTER AU PANIER STYLE GARANTI */
button[data-button-action="add-to-cart"] {
  background: linear-gradient(135deg, #8b7355 0%, #a68a6f 100%) !important;
  color: white !important;
  border: none !important;
  padding: 12px 24px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.2) !important;
}

button[data-button-action="add-to-cart"]:hover {
  background: linear-gradient(135deg, #a68a6f 0%, #6d5a42 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(139, 115, 85, 0.3) !important;
}

/* ===== RESPONSIVE PRIORITÉ ===== */

@media (max-width: 768px) {
  /* BOUTONS MOBILES ENCORE PLUS PRIORITAIRES */
  button[data-button-action="add-to-cart"],
  .product-add-to-cart button,
  .product-actions button {
    z-index: 9999999999 !important;
    position: relative !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-touch-callout: default !important;
    -webkit-user-select: auto !important;
    user-select: auto !important;
  }
}

/* ===== NOTES TECHNIQUES ===== */

/*
Z-INDEX HIÉRARCHIE APPLIQUÉE :

999999999 - Bouton ajouter au panier (PRIORITÉ ABSOLUE)
888888888 - Boutons produits (quantité, variantes)
777777777 - Tous boutons génériques
666666666 - Conteneurs produits
555555555 - Images cliquables produits
999999998 - Boutons dans modals actives
10000     - Modals et popups
200       - Mobile menu
1         - H2 et éléments texte
-1        - Overlays ::before/::after
-999      - Modals cachées

CETTE HIÉRARCHIE GARANTIT :
✅ Boutons produits TOUJOURS cliquables
✅ Modals fonctionnelles mais non-bloquantes
✅ H2 ne bloquent plus jamais
✅ Popups en arrière-plan approprié
✅ Mobile touch optimisé
*/