/* --- Tabs --- */
[data-savon-tabs] .xai-tab-line-container {
  position: relative;
  height: 4px;
  width: 100%;
  margin-bottom: 16px;
  overflow: visible;
}
[data-savon-tabs] .xai-tab-line-bg {
  position: absolute;
  top: 1px;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background-color: rgba(196, 106, 103, 0.45);
}
[data-savon-tabs] .xai-tab-line-active,
[data-savon-tabs] .xai-tab-line-hover {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  border-radius: 2px;
  background-color: #613337;
  transition: width 200ms ease, left 200ms ease, opacity 200ms ease;
  pointer-events: none;
}
[data-savon-tabs] .xai-tab-line-hover {
  opacity: 0;
}
[data-savon-tabs] .xai-tab-line-active {
  opacity: 1;
}
[data-savon-tabs] .savon-tab-button {
  color: rgba(196, 106, 103, 0.65);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 5px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}
[data-savon-tabs] .savon-tab-button.is-active,
[data-savon-tabs] .savon-tab-button[aria-selected="true"],
[data-savon-tabs] .savon-tab-button:hover {
  color: #613337;
}
[data-savon-tabs] .savon-tab-button:focus-visible {
  outline: 2px solid rgba(97, 51, 55, 0.45);
  outline-offset: 3px;
  box-shadow: none;
}
[data-savon-tabs] .savon-tab-pane[hidden] {
  display: none !important;
}
[data-savon-tabs] .savon-tab-pane p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}
[data-savon-tabs] .savon-tab-pane p:last-child {
  margin-bottom: 0;
}
[data-savon-tabs] .savon-tab-pane ul,
[data-savon-tabs] .savon-tab-pane ol {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}
[data-savon-tabs] .savon-tab-pane li {
  margin-bottom: 0.25rem;
}

[data-herbal-tabs] .xai-tab-line-container {
  position: relative;
  height: 4px;
  width: 100%;
  margin-bottom: 16px;
  overflow: visible;
}
[data-herbal-tabs] .xai-tab-line-bg {
  position: absolute;
  top: 1px;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background-color: rgba(53, 109, 91, 0.35);
}
[data-herbal-tabs] .xai-tab-line-active,
[data-herbal-tabs] .xai-tab-line-hover {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  border-radius: 2px;
  background-color: #2f6d5c;
  transition: width 200ms ease, left 200ms ease, opacity 200ms ease;
  pointer-events: none;
}
[data-herbal-tabs] .xai-tab-line-hover {
  opacity: 0;
}
[data-herbal-tabs] .xai-tab-line-active {
  opacity: 1;
}
[data-herbal-tabs] .herbal-tab-button {
  color: rgba(47, 109, 92, 0.65);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 5px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}
[data-herbal-tabs] .herbal-tab-button.is-active,
[data-herbal-tabs] .herbal-tab-button[aria-selected="true"],
[data-herbal-tabs] .herbal-tab-button:hover {
  color: #2f6d5c;
}
[data-herbal-tabs] .herbal-tab-button:focus-visible {
  outline: 2px solid rgba(47, 109, 92, 0.45);
  outline-offset: 3px;
  box-shadow: none;
}
[data-herbal-tabs] .herbal-tab-pane[hidden] {
  display: none !important;
}
[data-herbal-tabs] .herbal-tab-pane p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}
[data-herbal-tabs] .herbal-tab-pane p:last-child {
  margin-bottom: 0;
}
[data-herbal-tabs] .herbal-tab-pane ul,
[data-herbal-tabs] .herbal-tab-pane ol {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}
[data-herbal-tabs] .herbal-tab-pane li {
  margin-bottom: 0.25rem;
}

/* --- Buy box --- */
.mytheme-buy-box {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.mytheme-buy-box__header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mytheme-buy-box__header-top {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.mytheme-buy-box__title {
  font-size: clamp(2.1rem, 3vw, 2.8rem);
  font-weight: 600;
  color: #1f1f1f;
  flex: 1;
  min-width: 0;
}

.mytheme-buy-box__excerpt {
  font-size: 1rem;
  line-height: 1.7;
  color: #5a5a5a;
}

.mytheme-buy-box__price {
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.mytheme-buy-box__price-amount,
.mytheme-buy-box__price .price,
.mytheme-buy-box__price [data-price-display],
.mytheme-buy-box__price-amount .woocommerce-Price-amount,
.mytheme-buy-box__price-amount span {
  font-size: clamp(1.35rem, 2vw, 1.65rem) !important;
  font-weight: 600;
  color: #613337;
  display: inline-block;
  line-height: 1.2;
}

.mytheme-buy-box__price-amount *,
.mytheme-buy-box__price .price * {
  font-size: inherit !important;
}

.mytheme-buy-box__stock {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #d64545;
}

.mytheme-buy-box__variants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.mytheme-buy-box__variant-select {
  width: 100%;
  border: 1.5px solid rgba(97, 51, 55, 0.28);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #613337;
  background: #fff;
}

.mytheme-buy-box__variant-select:focus {
  outline: none;
  border-color: rgba(97, 51, 55, 0.65);
  box-shadow: 0 0 0 3px rgba(97, 51, 55, 0.12);
}

.mytheme-buy-box-variant {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1.5px solid rgba(97, 51, 55, 0.28);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #613337;
  background: #fff;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.mytheme-buy-box-variant__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid currentColor;
  position: relative;
}

.mytheme-buy-box-variant__dot::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transition: opacity 150ms ease;
}

.mytheme-buy-box-variant.is-active {
  border-color: #613337;
  background: rgba(97, 51, 55, 0.08);
}

.mytheme-buy-box-variant.is-active .mytheme-buy-box-variant__dot::after {
  opacity: 1;
}

.mytheme-buy-box-variant:hover:not(:disabled) {
  border-color: #c46a67;
  color: #c46a67;
}

.mytheme-buy-box-variant:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mytheme-buy-box__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mytheme-buy-box__quantity {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid rgba(97, 51, 55, 0.22);
  border-radius: 999px;
  overflow: hidden;
  width: fit-content;
  background: #fff;
  margin: 0 auto;
}

.mytheme-buy-box__quantity input[type="number"] {
  width: 60px;
  border: 0;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  background: transparent;
  padding: 0.65rem 0;
  color: #613337;
  appearance: textfield;
  -moz-appearance: textfield;
}

.mytheme-buy-box__quantity input[type="number"]:focus-visible {
  outline: none;
}

.mytheme-buy-box__quantity input::-webkit-outer-spin-button,
.mytheme-buy-box__quantity input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mytheme-buy-box__quantity .quantity-button {
  border: 0;
  background: transparent;
  color: #613337;
  font-size: 1.25rem;
  font-weight: 600;
  width: 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease, color 150ms ease;
}

.mytheme-buy-box__quantity .quantity-button:hover {
  background: rgba(196, 106, 103, 0.14);
  color: #c46a67;
}

.mytheme-buy-box__submit {
  width: 100%;
  border: none;
  border-radius: 0.85rem;
  background: #613337;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 1rem 1.5rem;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.mytheme-buy-box__submit:hover:not(:disabled) {
  background: #c46a67;
  box-shadow: 0 12px 20px rgba(196, 106, 103, 0.25);
  transform: translateY(-1px);
}

.mytheme-buy-box__submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- WooCommerce variation overrides --- */
.woocommerce div.product form.cart .variations,
form.variations_form .variations,
.variations_form table.variations {
  width: 100% !important;
  margin: 0 0 1.25rem 0 !important;
  border: 0 !important;
  border-collapse: separate !important;
  background: transparent !important;
}
.woocommerce div.product form.cart .variations tr,
form.variations_form .variations tr,
.variations_form table.variations tbody tr {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}
.woocommerce div.product form.cart .variations td,
form.variations_form .variations td,
.variations_form table.variations tbody td {
  border: 0 !important;
  padding: 0 !important;
}
.woocommerce div.product form.cart .variations .label,
form.variations_form .variations .label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: #613337;
  margin-bottom: 0.35rem;
}
.woocommerce div.product form.cart .variations select,
form.variations_form .variations select {
  width: 100%;
  border: 0;
  border-bottom: 2px solid rgba(97, 51, 55, 0.3);
  background: transparent;
  padding: 0.6rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: #613337;
  transition: border-color 150ms ease, color 150ms ease;
  appearance: none;
}
.woocommerce div.product form.cart .variations select:focus,
form.variations_form .variations select:focus {
  border-color: rgba(97, 51, 55, 0.85);
  outline: none;
}
.woocommerce div.product form.cart .variations .value,
form.variations_form .variations .value {
  position: relative;
}
.woocommerce div.product form.cart .variations .value::after,
form.variations_form .variations .value::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(97, 51, 55, 0.65);
  pointer-events: none;
}
.woocommerce div.product form.cart .single_add_to_cart_button,
form.variations_form .single_add_to_cart_button {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(120deg, #613337, #7a3d39);
  color: #fff;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  border: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.woocommerce div.product form.cart .single_add_to_cart_button:hover,
form.variations_form .single_add_to_cart_button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(97, 51, 55, 0.28);
}
.variations_form .quantity,
.woocommerce div.product form.cart .quantity {
  display: none !important;
}
.variations_form .reset_variations {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(97, 51, 55, 0.6);
  margin-top: 0.35rem;
}
.variations_form .reset_variations:hover {
  color: #613337;
}

/* --- Mobile-only styles --- */
@media (max-width: 1023px) {
  /* Centrer les variants (sélecteur de poids) sur mobile */
  .mytheme-buy-box__variants {
    justify-content: center;
  }

  /* Centrer les boutons de quantité (plus/moins) sur mobile */
  .mytheme-buy-box__form {
    align-items: center;
  }

  .mytheme-buy-box__quantity {
    margin-left: auto;
    margin-right: auto;
  }

  /* Réorganiser l'ordre des éléments sur mobile pour single-product-herbal et single-product-savon */
  /* Le conteneur principal devient grid sur mobile avec grid-template-areas */
  .product-layout {
    display: grid;
    grid-template-areas:
      "category"
      "image"
      "buybox"
      "additional";
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Utiliser display: contents pour que les enfants de product-info-wrapper deviennent des enfants directs de product-layout */
  .product-info-wrapper {
    display: contents;
  }

  /* Restaurer l'espacement vertical perdu avec display: contents (space-y-8 = 2rem) */
  /* Tous les enfants directs de product-layout sauf le dernier */
  .product-layout > .product-category,
  .product-layout > .mytheme-buy-box,
  .product-layout > div:not(.product-category):not(.product-image-wrapper):not(.mytheme-buy-box) {
    margin-bottom: 2rem;
  }

  .product-layout > *:last-child {
    margin-bottom: 0;
  }

  /* Catégorie en premier - grid-area: category */
  .product-layout .product-category {
    grid-area: category;
  }

  /* Image en deuxième - grid-area: image */
  .product-layout .product-image-wrapper {
    grid-area: image;
  }

  /* Buy box en troisième - grid-area: buybox */
  .product-layout .mytheme-buy-box {
    grid-area: buybox;
  }

  /* Pour savon : les divs avec ingrédients, types de peau, parfum */
  .product-layout > div.grid.gap-4:not(.product-additional-info),
  .product-layout > div.rounded-2xl[class*="bg-primary"],
  .product-layout > div.rounded-2xl.border {
    order: 4 !important;
  }
  
  /* Tous les autres divs enfants directs qui ne sont pas déjà définis */
  /* MAIS on exclut explicitement product-additional-info pour éviter les conflits */
  .product-layout > div:not(.product-category):not(.product-image-wrapper):not(.mytheme-buy-box):not(.product-additional-info):not(.space-y-6):not(.space-y-8) {
    order: 4 !important;
  }

  /* IMPORTANT : product-additional-info DOIT être en DERNIER - grid-area: additional */
  /* Pour herbal : la div avec "Bienfaits principaux" et "Rituel de préparation" */
  .product-layout > .product-additional-info,
  .product-layout .product-additional-info,
  .product-additional-info.grid.gap-4,
  .product-additional-info {
    grid-area: additional;
  }
  
  /* Pour les autres éléments (savon), utiliser order comme fallback */
  .product-layout > div.grid.gap-4:not(.product-additional-info),
  .product-layout > div.rounded-2xl[class*="bg-primary"],
  .product-layout > div.rounded-2xl.border {
    grid-area: additional;
  }
  
  .product-layout > div:not(.product-category):not(.product-image-wrapper):not(.mytheme-buy-box):not(.product-additional-info):not(.space-y-6):not(.space-y-8) {
    grid-area: additional;
  }
}

