/**
 * Fiche produit — correctif layout (theme Lettery Child).
 * Charge uniquement sur is_product() via inc/woocommerce-single.php.
 * Ne pas recolorer le bouton express Stripe/Link (volontairement conserve).
 */

/* Conteneur : contient les flottants Woo + evite le debordement horizontal */
.single-product .mil-content-frame {
  overflow: hidden;
}

.single-product .product {
  max-width: 100%;
  overflow: hidden;
}

/* Grille image / resume : 2 colonnes contenues, stack sur mobile */
.woocommerce div.product div.images,
.woocommerce div.product div.summary {
  box-sizing: border-box;
  max-width: 100%;
}

@media screen and (min-width: 769px) {
  /* Colonne images resserree (40% au lieu de 47%, plafond 500px).
     La "ligne de flottaison" (div.images + div.summary) se termine plus
     haut : l'image produit est plus petite, le contenu sous le produit
     remonte d'autant. L'espace libere revient au resume (55%). */
  .woocommerce div.product div.images {
    width: 40%;
    max-width: 500px;
    float: left;
    margin-right: 5%;
  }
  .woocommerce div.product div.summary {
    width: 55%;
    float: right;
  }
  /* clearfix : le contenu sous le produit (tabs, up-sells) repasse en dessous */
  .woocommerce div.product::after {
    content: " ";
    display: table;
    clear: both;
  }
}

/* Tablette : colonne images un peu plus large (l'image reste lisible),
   resume 50% pour ne pas squeezer le select / le stepper. */
@media screen and (min-width: 769px) and (max-width: 1199px) {
  .woocommerce div.product div.images {
    width: 45%;
    max-width: none;
    margin-right: 5%;
  }
  .woocommerce div.product div.summary {
    width: 50%;
  }
}

@media screen and (max-width: 768px) {
  .woocommerce div.product div.images,
  .woocommerce div.product div.summary {
    width: 100%;
    float: none;
    margin-right: 0;
  }
}

.woocommerce div.product div.images img {
  max-width: 100%;
  height: auto;
}

.woocommerce div.product div.images .flex-viewport,
.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
  max-width: 100%;
}

/* Titre : ne plus etre rogne par le header fixe / overflow */
.single-product .product_title {
  line-height: 1.05;
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 100%;
}

/* Select variation natif : relooke propre (fond blanc, bordure complete,
   fleche custom, focus vert). Le plugin ajax-variable garde le dessus. */
.single-product table.variations {
  width: 100%;
}

.single-product table.variations th.label {
  display: block;
  padding: 0 0 8px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 15px;
  color: #291d1c;
}

.single-product table.variations td.value {
  display: block;
  width: 100%;
  padding: 0 0 16px;
}

.single-product .variations select,
.woocommerce div.product form.cart .variations select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: 52px;
  padding: 0 44px 0 18px;
  font-size: 16px;
  font-family: "Outfit", sans-serif;
  color: #291d1c;
  background-color: #fff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23291d1c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.single-product .variations select:focus,
.woocommerce div.product form.cart .variations select:focus {
  outline: none;
  border-color: #4eac52;
  box-shadow: 0 0 0 1px #4eac52;
}

/* Quantite fiche produit : stepper - / + identique au bloc carte produits
   (plugin custom-tresor) : boutons 52x48, bordure #4eac52, radius 4px,
   hover vert. Le groupe reste compact, pas en pleine largeur.
   WooCommerce float le .quantity (form.cart div.quantity) : on annule le
   float pour que le bouton d'achat passe bien en dessous. */
.single-product form.cart div.quantity,
.single-product .woocommerce-variation-add-to-cart div.quantity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  float: none !important;
  gap: 10px;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 !important;
}

.single-product .quantity .tresor-qty-label {
  flex: 0 0 100%;
  display: block;
  padding: 0;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 15px;
  color: #291d1c;
}

.single-product .quantity .tresor-qty-btn,
.single-product .quantity .tresor-qty-input {
  width: 52px;
  height: 48px;
  border: 1px solid #4eac52;
  border-radius: 4px;
  background: #fff;
  color: #291D1C;
  font-family: Montserrat, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.single-product button.tresor-qty-btn {
  cursor: pointer;
}

.single-product button.tresor-qty-btn:hover {
  background: #4eac52;
  color: #fff;
}

.single-product .quantity .tresor-qty-input {
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.single-product .quantity .tresor-qty-input::-webkit-outer-spin-button,
.single-product .quantity .tresor-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Prix (total quantite) sous le stepper : markup WooCommerce reutilise
   (classes .woocommerce-Price-amount) => meme typographie que le reste
   du site, suffixe " TTC" compris. */
.single-product .tresor-single-price {
  padding: 30px 0;
}

/* WooCommerce affiche le prix unitaire de la variation au-dessus du stepper :
   on le masque, le prix est desormais sous le stepper (total quantite). */
.single-product .woocommerce-variation-price {
  display: none;
}

/* Bouton express Stripe/Link : contenu sans changer ses couleurs.
   Le bouton gardait width:100% + marges dans un conteneur non contraint,
   d'ou le debordement plein ecran vu en capture. */
.single-product #wcpay-payment-request-wrapper,
.single-product #wcpay-express-checkout-wrapper,
.single-product #wcpay-express-checkout-element,
.single-product .wcpay-express-checkout,
.single-product .stripe-express-checkout,
.single-product .wc-stripe-express-checkout {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
  overflow: hidden;
  margin-left: 0;
  margin-right: 0;
}

.single-product #wcpay-express-checkout-wrapper iframe,
.single-product .wcpay-express-checkout iframe {
  max-width: 100% !important;
}

/* Le formulaire d'ajout panier reste dans la colonne resume */
.single-product .woocommerce-variation-add-to-cart,
.single-product form.cart {
  max-width: 100%;
  box-sizing: border-box;
}

/* Fiche produit : bouton Ajouter / Acheter => bouton icone panier (maquette).
   Le libelle textuel reste dans le DOM (font-size:0) pour l'accessibilite.
   icone = SVG custom-tresor (assets/svg/cart.svg) injecte en PHP via
   --tresor-single-cart-icon-url, affichee en mask-image + currentColor
   pour suivre la couleur (normal/hover).
   Taille reglable : Customizer "Fiche produit Trésor" => --tresor-single-cart-icon-size. */
.single-product div.product form.cart .single_add_to_cart_button {
  width: min(300px, 100%) !important;
  height: 56px !important;
  min-height: 56px;
  padding: 0 !important;
  margin-top: 10px;
  font-size: 0 !important;
  line-height: 0;
  letter-spacing: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  color: #291d1c;
}

.single-product div.product form.cart .single_add_to_cart_button::before {
  content: "";
  width: var(--tresor-single-cart-icon-size, 22px);
  height: var(--tresor-single-cart-icon-size, 22px);
  background-color: currentColor;
  -webkit-mask-image: var(--tresor-single-cart-icon-url, none);
  mask-image: var(--tresor-single-cart-icon-url, none);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.single-product div.product form.cart .single_add_to_cart_button:hover {
  color: #fff;
}

.single-product div.product form.cart .single_add_to_cart_button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
