/**
 * Boutons Electropo — style glassmorphism identique à electropo.fr (Next.js)
 * Source : src/app/globals.css lignes 843-1075
 *
 * 4 classes principales :
 *  - .btn-glass       → glass neutre (secondary, arrows)
 *  - .btn-glass-primary → cyan CTA principal (hero, forms)
 *  - .btn-glass-dark  → silver (add-to-cart default sur produits non-froid)
 *  - .btn-snow        → snow (add-to-cart pour produits froid : climatiseurs, ventilateurs, déshumidificateurs)
 *
 * Aliases WooCommerce ajoutés en bas pour bind aux boutons WC standards.
 */

/* Base glass — neutral (for arrows, secondary buttons on light bg) */
.btn-glass {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.42) 100%);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10), 0 6px 20px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.80), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  cursor: pointer;
  color: #0A2F43;
  font-weight: 600;
}
.btn-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.35) 0%, transparent 55%);
  pointer-events: none;
  border-radius: inherit;
}
.btn-glass:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.55) 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13), 0 8px 28px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.90), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}
.btn-glass:active { transform: scale(0.97); }

/* Primary glass — teal tint (main CTAs) */
.btn-glass-primary {
  position: relative;
  background: linear-gradient(145deg, rgba(8, 170, 197, 0.85) 0%, rgba(6, 154, 179, 0.95) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.30);
  box-shadow: 0 4px 16px rgba(8, 170, 197, 0.40), 0 8px 28px rgba(8, 170, 197, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  color: white;
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  cursor: pointer;
  font-weight: 600;
}
.btn-glass-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.25) 0%, transparent 55%);
  pointer-events: none;
  border-radius: inherit;
}
.btn-glass-primary:hover {
  background: linear-gradient(145deg, rgba(8, 170, 197, 0.95) 0%, rgba(6, 154, 179, 1) 100%);
  box-shadow: 0 6px 24px rgba(8, 170, 197, 0.55), 0 12px 36px rgba(8, 170, 197, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.50), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}
.btn-glass-primary:active { transform: scale(0.97); }

/* Silver glass — luminous silver (add-to-cart default) */
.btn-glass-dark {
  position: relative;
  background: linear-gradient(145deg, rgba(245, 247, 250, 0.95) 0%, rgba(210, 218, 228, 0.85) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 6px 20px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  cursor: pointer;
  font-weight: 600;
}
.btn-glass-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.40) 0%, transparent 55%);
  pointer-events: none;
  border-radius: inherit;
}
.btn-glass-dark:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 1) 0%, rgba(225, 232, 240, 0.95) 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10), 0 8px 28px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.90), inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}
.btn-glass-dark:active { transform: scale(0.97); }

/* Snow glass — luminous ice with animated shimmer (add-to-cart for cold products) */
.btn-snow {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(220, 240, 250, 0.92) 50%, rgba(200, 225, 240, 0.95) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 8px rgba(100, 150, 200, 0.15), 0 6px 20px rgba(100, 150, 200, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(100, 150, 200, 0.08);
  color: #052B40;
  transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  cursor: pointer;
  font-weight: 600;
}
.btn-snow::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.55) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}
.btn-snow::after {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: linear-gradient(60deg, transparent 40%, rgba(255, 255, 255, 0.65) 50%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
  animation: snowShimmer 4s ease-in-out infinite;
}
@keyframes snowShimmer {
  0%, 100% { transform: translate(0, 0); opacity: 0; }
  50% { transform: translate(30%, 30%); opacity: 1; }
}
.btn-snow > * { position: relative; z-index: 1; }
.btn-snow span { position: relative; z-index: 1; }
.btn-snow:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 1) 0%, rgba(230, 245, 255, 1) 50%, rgba(210, 235, 250, 1) 100%);
  box-shadow: 0 4px 16px rgba(100, 150, 200, 0.25), 0 10px 32px rgba(100, 150, 200, 0.15), inset 0 1px 0 rgba(255, 255, 255, 1), inset 0 -1px 0 rgba(100, 150, 200, 0.08);
  transform: translateY(-1px);
}
.btn-snow:active { transform: scale(0.97); }

/* ═════════════════════════════════════════════════════════════════════
   ALIAS WooCommerce — bind boutons WC standards aux classes glass
   ═════════════════════════════════════════════════════════════════════ */

/* Bouton "Ajouter au panier" WooCommerce (page produit single) */
.woocommerce .single_add_to_cart_button,
.woocommerce-page .single_add_to_cart_button,
.single_add_to_cart_button,
button[name="add-to-cart"] {
  position: relative;
  background: linear-gradient(145deg, rgba(8, 170, 197, 0.85) 0%, rgba(6, 154, 179, 0.95) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.30) !important;
  box-shadow: 0 4px 16px rgba(8, 170, 197, 0.40), 0 8px 28px rgba(8, 170, 197, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12) !important;
  color: white !important;
  font-weight: 600 !important;
  padding: 14px 28px !important;
  border-radius: 9999px !important;
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer;
}
.woocommerce .single_add_to_cart_button:hover,
.single_add_to_cart_button:hover,
button[name="add-to-cart"]:hover {
  background: linear-gradient(145deg, rgba(8, 170, 197, 0.95) 0%, rgba(6, 154, 179, 1) 100%) !important;
  box-shadow: 0 6px 24px rgba(8, 170, 197, 0.55), 0 12px 36px rgba(8, 170, 197, 0.25) !important;
  transform: translateY(-1px);
}
.woocommerce .single_add_to_cart_button:active,
.single_add_to_cart_button:active { transform: scale(0.97); }

/* Bouton "Ajouter au panier" sur cards produits (archive / catalogue) */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button,
.add_to_cart_button,
.product .button.product_type_simple,
.product .button.product_type_variable {
  position: relative;
  background: linear-gradient(145deg, rgba(245, 247, 250, 0.95) 0%, rgba(210, 218, 228, 0.85) 100%) !important;
  backdrop-filter: blur(20px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 6px 20px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(0, 0, 0, 0.05) !important;
  color: #1a1a1a !important;
  font-weight: 600 !important;
  padding: 10px 20px !important;
  border-radius: 9999px !important;
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  width: 100%;
  display: block;
  text-align: center;
}
.woocommerce ul.products li.product .button:hover,
.add_to_cart_button:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 1) 0%, rgba(225, 232, 240, 0.95) 100%) !important;
  transform: translateY(-1px);
}

/* Bouton state "ajouté au panier" (WC feedback) */
.woocommerce ul.products li.product .added_to_cart,
.added_to_cart {
  background: linear-gradient(145deg, rgba(37, 169, 107, 0.9), rgba(30, 145, 90, 0.95)) !important;
  color: white !important;
  border-radius: 9999px !important;
  padding: 10px 20px !important;
  font-weight: 600 !important;
  border: none !important;
}

/* Bouton disabled (out of stock, coming soon) */
.woocommerce ul.products li.product .button.disabled,
.woocommerce .button.disabled,
button[disabled],
.single_add_to_cart_button.disabled {
  background: #F5F5F7 !important;
  color: #6e6e73 !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
  box-shadow: none !important;
}

/* Bouton "Voir le panier" / autres CTA secondaires WC */
.woocommerce .cart .button,
.woocommerce-message .button,
.woocommerce-info .button,
.checkout-button {
  position: relative;
  background: linear-gradient(145deg, rgba(8, 170, 197, 0.85) 0%, rgba(6, 154, 179, 0.95) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.30) !important;
  color: white !important;
  font-weight: 600 !important;
  padding: 12px 24px !important;
  border-radius: 9999px !important;
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* Bouton "Continuer les achats" / retour */
.woocommerce-cart .return-to-shop .button,
.wc-backward {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.42) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  color: #0A2F43 !important;
  font-weight: 600 !important;
  padding: 10px 20px !important;
  border-radius: 9999px !important;
}

/* Boutons quantité +/- WC */
.woocommerce .quantity .qty {
  border-radius: 9999px !important;
  border: 1px solid #E4EDF2 !important;
  padding: 6px 12px !important;
}

/* Touch target minimum WCAG 2.5.5 sur mobile */
@media (max-width: 768px) {
  .woocommerce .single_add_to_cart_button,
  .single_add_to_cart_button,
  .add_to_cart_button,
  .woocommerce .button,
  .btn-glass,
  .btn-glass-primary,
  .btn-glass-dark,
  .btn-snow {
    min-height: 44px;
    font-size: 14px !important;
  }
  .woocommerce .single_add_to_cart_button {
    width: 100%;
    padding: 14px 20px !important;
  }
}

/* ═════════════════════════════════════════════════════════════════════
   GRID CATALOGUE — reproduction exacte electropo.fr Next.js
   Référence : grid grid-cols-2 sm:grid-cols-3 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 md:gap-4
   ═════════════════════════════════════════════════════════════════════ */

/* Layout 2 colonnes desktop : sidebar 280px + grid produits */
.catalogue-layout,
.woocommerce .catalogue-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 1024px) {
  .catalogue-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
  }
}

/* Grid produits : 2/3/3/4/5 breakpoints comme Next.js */
.woocommerce ul.products,
.woocommerce-page ul.products,
ul.products,
.products {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
@media (min-width: 640px) {
  .woocommerce ul.products, ul.products, .products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }
}
@media (min-width: 768px) {
  .woocommerce ul.products, ul.products, .products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 1024px) {
  .woocommerce ul.products, ul.products, .products {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 1280px) {
  .woocommerce ul.products, ul.products, .products {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

/* Card produit : reset Storefront + reproduction ProductCard.tsx */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
ul.products li.product {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  clear: none !important;
  background: #ffffff;
  border: 1px solid #E4EDF2;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex !important;
  flex-direction: column;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.woocommerce ul.products li.product:hover {
  box-shadow: 0 8px 24px rgba(8, 62, 94, 0.08);
  transform: translateY(-2px);
}

/* Image produit : ratio ~1.4:1 (padding-top 72% comme ProductCard.tsx) */
.woocommerce ul.products li.product a img,
.woocommerce ul.products li.product img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1.4 / 1 !important;
  object-fit: contain !important;
  padding: 16px !important;
  background: #F5F5F7 !important;
  margin: 0 !important;
  transition: transform 0.5s ease;
}
.woocommerce ul.products li.product:hover img {
  transform: scale(1.06);
}

/* Contenu card : padding + gap */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2,
.woocommerce ul.products li.product h3 {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #1d1d1f !important;
  line-height: 1.35 !important;
  padding: 12px 16px 4px !important;
  margin: 0 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Prix */
.woocommerce ul.products li.product .price {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
  padding: 4px 16px !important;
  margin: 0 !important;
}
.woocommerce ul.products li.product .price ins {
  color: #E85E47 !important;
  text-decoration: none !important;
}
.woocommerce ul.products li.product .price del {
  font-size: 12px !important;
  color: #6e6e73 !important;
  font-weight: 400 !important;
}

/* Stock */
.woocommerce ul.products li.product .stock,
.woocommerce ul.products li.product .in-stock {
  font-size: 11px !important;
  font-weight: 500 !important;
  color: #25A96B !important;
  padding: 0 16px !important;
}
.woocommerce ul.products li.product .out-of-stock {
  color: #E85E47 !important;
}

/* Bouton "Ajouter au panier" en bas de card (déjà stylé par section aliases WC) */
.woocommerce ul.products li.product .button {
  margin: 8px 16px 16px !important;
  padding: 10px 16px !important;
  font-size: 13px !important;
  width: calc(100% - 32px);
}

/* Badge classe énergie */
.woocommerce ul.products li.product .energy-badge,
.woocommerce ul.products li.product .badge-energy {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: #00A550;
}

/* ═════════════════════════════════════════════════════════════════════
   PATCH FINAL 2026-09-01 — font-size boutons cards produit
   Match exact ProductCard.tsx : text-[clamp(9px,2.4vw,13px)]
   ═════════════════════════════════════════════════════════════════════ */

/* Bouton "Ajouter au panier" sur cards catalogue — font fluide */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button,
.add_to_cart_button,
.ep-card-btn,
.ep-card-btn--add-to-cart {
  font-size: clamp(9px, 2.4vw, 13px) !important;
  padding: 10px 16px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Mobile : garder clamp au lieu de forcer 14px */
@media (max-width: 768px) {
  .woocommerce ul.products li.product .button,
  .add_to_cart_button,
  .ep-card-btn,
  .ep-card-btn--add-to-cart {
    font-size: clamp(9px, 2.4vw, 13px) !important;
    padding: 8px 12px !important;
    min-height: 40px;
  }
}

/* Small phones (<380px) : encore plus compact */
@media (max-width: 380px) {
  .ep-card-btn,
  .ep-card-btn--add-to-cart,
  .woocommerce ul.products li.product .button {
    font-size: 10px !important;
    padding: 7px 8px !important;
  }
}
