/**
 * InstaPresse — correctifs UI mobile / checkout (TEST)
 * Palette logo (ordre) : rouge, rouge foncé, jaune, olive, vert, teal, bleu
 */

:root {
  --ip-logo-1: #D02931;
  --ip-logo-2: #A21A16;
  --ip-logo-3: #F3CD36;
  --ip-logo-4: #ACC114;
  --ip-logo-5: #009468;
  --ip-logo-6: #009DB3;
  --ip-logo-7: #134985;
  --ip-black: #1C1C1D;
}

/* ========== P1 — Boutons Woo : plus de mauve, CTA mobile repensé ========== */
.woocommerce #respond input#submit.alt,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #place_order,
.woocommerce-checkout #place_order {
  background-color: var(--ip-logo-1) !important;
  color: #fff !important;
  border-color: var(--ip-logo-1) !important;
}

.woocommerce #respond input#submit.alt:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover,
.woocommerce #place_order:hover,
.woocommerce #place_order:focus,
.woocommerce-checkout #place_order:hover,
.woocommerce-checkout #place_order:focus,
.woocommerce #respond input#submit.alt:focus,
.woocommerce a.button.alt:focus,
.woocommerce button.button.alt:focus,
.woocommerce input.button.alt:focus {
  background-color: var(--ip-logo-2) !important;
  color: #fff !important;
  border-color: var(--ip-logo-2) !important;
}

@media (max-width: 767px) {
  .woocommerce-checkout #payment .place-order {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .woocommerce-checkout #payment .place-order .woocommerce-terms-and-conditions-wrapper,
  .woocommerce-checkout #payment .place-order .form-row.terms {
    width: 100%;
    max-width: 100%;
    float: none !important;
    margin: 0 !important;
  }

  .woocommerce-checkout #place_order {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    height: auto !important;
    min-height: 48px !important;
    padding: 1rem 1.5rem !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    border-radius: 8px !important;
    margin: 0 !important;
  }

  .product-builder-single .product__cta-sticky .product__cta-sticky-button,
  .product-builder-single .product__cta-sticky .button,
  .product-builder-single .product__cta-sticky button {
    background-color: var(--ip-logo-5) !important;
    border-color: var(--ip-logo-5) !important;
    color: #fff !important;
    min-width: 0 !important;
    max-width: 100%;
    padding: 0.65rem 0.85rem !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
  }

  .product-builder-single .product__cta-sticky .product__cta-sticky-button:hover,
  .product-builder-single .product__cta-sticky .button:hover {
    background-color: #007a56 !important;
    border-color: #007a56 !important;
  }
}

/* ========== P2 — Menu : ronds couleur logo ========== */
.mobile__menu .menu-dot,
.mobile__menu span.menu-dot {
  display: inline-block !important;
  float: right;
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50% !important;
  border: 2px solid var(--ip-logo-1);
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: 0 !important;
  line-height: 0 !important;
  vertical-align: middle;
}

.mobile__menu .menu-dot--sm {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-width: 1.5px;
}

.mobile__menu .menu-dot--0 { border-color: var(--ip-logo-1) !important; }
.mobile__menu .menu-dot--1 { border-color: var(--ip-logo-2) !important; }
.mobile__menu .menu-dot--2 { border-color: var(--ip-logo-3) !important; }
.mobile__menu .menu-dot--3 { border-color: var(--ip-logo-4) !important; }
.mobile__menu .menu-dot--4 { border-color: var(--ip-logo-5) !important; }
.mobile__menu .menu-dot--5 { border-color: var(--ip-logo-6) !important; }
.mobile__menu .menu-dot--6 { border-color: var(--ip-logo-7) !important; }

/* Actif : noir + contour blanc intérieur */
.mobile__menu .mobile-menu-item.active > .mobile-menu-link .menu-dot,
.mobile__menu .mobile-menu-item.active .mobile-menu-toggle-submenu .menu-dot,
.mobile__menu .mobile-submenu-item.active > .mobile-submenu-link .menu-dot {
  background: var(--ip-black) !important;
  background-color: var(--ip-black) !important;
  border-color: var(--ip-black) !important;
  box-shadow: inset 0 0 0 2px #fff !important;
}

.mobile__menu .mobile-submenu-item.active > .mobile-submenu-link .menu-dot--sm {
  box-shadow: inset 0 0 0 1.5px #fff !important;
}

/* Annuler le reset border-radius:0 du menu pour les dots */
.mobile__menu .menu-dot {
  border-radius: 50% !important;
}

/* ========== P3 / P5 — instaCookie plus subtil partout ========== */
.instacookie__fab {
  bottom: 72px !important;
  left: 10px !important;
  padding: 6px !important;
  gap: 0 !important;
  border-radius: 50% !important;
  width: 34px;
  height: 34px;
  justify-content: center;
  opacity: 0.42;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  background: rgba(28, 28, 29, 0.65) !important;
}

.instacookie__fab:hover,
.instacookie__fab:focus {
  opacity: 0.9;
  transform: none;
}

.instacookie__fab-label {
  display: none !important;
}

.instacookie__fab-icon svg {
  width: 16px;
  height: 16px;
}

/* Boutique / archives : pastille discrète */
body.post-type-archive-product .instacookie__fab,
body.tax-product_cat .instacookie__fab,
body.tax-product_tag .instacookie__fab,
body.woocommerce-shop .instacookie__fab {
  bottom: 72px !important;
  opacity: 0.38;
}

/* Panier : remonter la pastille pour ne pas masquer « Mettre à jour » */
body.woocommerce-cart .instacookie__fab {
  bottom: 118px !important;
  opacity: 0.35;
}

/* Checkout / produit : au-dessus des barres basses, sans écraser le sticky */
body.woocommerce-checkout .instacookie__fab {
  bottom: 100px !important;
  opacity: 0.38;
}

body.single-product .instacookie__fab {
  bottom: 108px !important;
  opacity: 0.38;
  /* Sous la barre sticky produit (z-index 1200) pour ne pas bloquer le CTA */
  z-index: 1190 !important;
}

/* ========== P4 — Description produit mobile style panier ========== */
@media (max-width: 768px) {
  .product-builder-single .product__header {
    background: #F4F4F4 !important;
    color: #2F2F2F !important;
    padding: 0.75rem 0.85rem !important;
    margin-bottom: 0.75rem !important;
    border-radius: 8px !important;
    border: 1px solid rgba(206, 206, 206, 0.5);
    box-shadow: none !important;
  }

  .product-builder-single .product__header-content h3 {
    color: #1C1C1D !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    margin: 0 0 0.35rem !important;
    text-align: left !important;
  }

  .product-builder-single .product__header .product-short-description,
  .product-builder-single .product__header .product-short-description * {
    color: #555 !important;
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
    font-weight: 400 !important;
  }

  .product-builder-single .product__header .product-short-description span,
  .product-builder-single .product__header .product-short-description strong {
    color: var(--ip-logo-1) !important;
    font-weight: 500 !important;
  }

  .product-builder-single .product__header .product__image img {
    max-width: 4.5rem !important;
    border-radius: 6px !important;
  }

  .product-builder-single .product__header-readmore {
    border: 1px solid rgba(208, 41, 49, 0.35) !important;
    background: #fff !important;
    color: var(--ip-logo-1) !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    margin-top: 0.4rem !important;
  }

  .product-builder-single .product__header-readmore:hover,
  .product-builder-single .product__header-readmore:focus {
    background: rgba(208, 41, 49, 0.06) !important;
    border-color: var(--ip-logo-1) !important;
    color: var(--ip-logo-1) !important;
  }

  .product-builder-single .product__header-content {
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "title image"
      "desc desc"
      "more more" !important;
    gap: 0.35rem 0.65rem !important;
  }

  .product-builder-single .product__header-readmore {
    grid-area: more;
    justify-self: start !important;
  }
}

/* ========== Panier mobile : titre / détails / upload / qté / update ========== */
@media (max-width: 767px) {
  .woocommerce-cart table.cart td.product-name,
  .woocommerce-cart table.shop_table td.product-name {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0.55rem;
    text-align: left !important;
  }

  /* mobile-responsive.css pose le label via ::after (pas ::before) */
  .woocommerce-cart table.cart td.product-name::before,
  .woocommerce-cart table.shop_table td.product-name::before,
  .woocommerce-cart table.cart td.product-name::after,
  .woocommerce-cart table.shop_table td.product-name::after {
    content: none !important;
    display: none !important;
  }

  .woocommerce-cart td.product-name > a {
    display: block;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: left !important;
  }

  .woocommerce-cart td.product-name .c-cart__details,
  .woocommerce-cart td.product-name .instapresse-cart-item-upload {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    flex: 0 0 auto;
  }

  .woocommerce-cart td.product-name .instapresse-cart-item-upload__row {
    grid-template-columns: 1fr !important;
    row-gap: 0.5rem;
  }

  /* Qté Instaprix visible (sold individually) */
  .woocommerce-cart td.product-quantity {
    align-items: center !important;
  }

  .woocommerce-cart td.product-quantity .quantity {
    display: none;
  }

  .woocommerce-cart td.product-quantity input.qty[type="hidden"] + .instapresse-cart-qty,
  .woocommerce-cart .instapresse-cart-qty {
    display: inline-block;
    font-size: 1rem;
    font-weight: 700;
    color: #1C1C1D;
    line-height: 1.2;
  }

  /* « Mettre à jour le panier » pleine largeur, hors collision cookie */
  .woocommerce-cart table.cart td.actions,
  .woocommerce-cart table.shop_table td.actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem;
    padding-bottom: 1.5rem !important;
  }

  .woocommerce-cart table.cart td.actions::before,
  .woocommerce-cart table.cart td.actions::after,
  .woocommerce-cart table.shop_table td.actions::before,
  .woocommerce-cart table.shop_table td.actions::after {
    content: none !important;
    display: none !important;
  }

  .woocommerce-cart button[name="update_cart"],
  .woocommerce-cart button[name="update_cart"].button {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0.85rem 1.25rem !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
  }
}

/* ========== Boutique : dégradés scroll ne passent plus sur le bouton actif ========== */
@media screen and (max-width: 991px) {
  .product-family-filter__container::before,
  .product-family-filter__container::after {
    display: none !important;
    content: none !important;
  }

  .product-family-filter__container {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }

  .family-filter-btn {
    position: relative;
    z-index: 2;
  }

  .family-filter-btn.active {
    background-color: #D02931 !important;
    color: #fff !important;
    border-color: #D02931 !important;
  }
}

/* ========== P6 — bandeau coupon checkout déjà retiré en PHP ========== */
.woocommerce-checkout .woocommerce-form-coupon-toggle {
  display: none !important;
}

/* ========== Checkout : ligne produit (titre dessus, boîte pleine largeur) ========== */
.woocommerce-checkout-review-order-table .instapresse-checkout-item-summary {
  display: none !important; /* doublon retiré */
}

.woocommerce-checkout-review-order-table td.product-name {
  display: block !important;
  width: 100%;
}

.woocommerce-checkout-review-order-table td.product-name::before,
.woocommerce-checkout-review-order-table td.product-name::after {
  content: none !important;
  display: none !important;
}

.instapresse-checkout-line {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.instapresse-checkout-line__title {
  display: block;
  width: 100%;
  /* padding-bas = 1/3 du padding-haut */
  padding-top: 0.75rem;
  padding-bottom: 0.25rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1C1C1D;
  overflow-wrap: anywhere;
  word-break: normal;
}

.woocommerce-checkout-review-order-table .c-cart__details {
  display: block !important;
  float: none !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(206, 206, 206, 0.5);
  background: #F4F4F4;
  font-size: 0.78rem;
  line-height: 1.45;
  box-sizing: border-box;
}

.woocommerce-checkout-review-order-table .c-cart__details--compact {
  color: #444;
  font-weight: 500;
}

.woocommerce-checkout-review-order-table .c-cart__details span {
  color: var(--ip-logo-1);
  font-weight: 500;
}

/* Sticky produit : lisible, cookie au-dessus sans masquer */
@media (max-width: 768px) {
  .product-builder-single .product__cta-sticky.is-active {
    z-index: 1200;
  }

  .product-builder-single .product__cta-sticky .product__cta-sticky-price,
  .product-builder-single .product__cta-sticky .product__cta-sticky-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-builder-single .product__cta-sticky .product__cta-sticky-meta {
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  .woocommerce-checkout-review-order-table tr.cart_item {
    display: block;
  }

  .woocommerce-checkout-review-order-table tr.cart_item td.product-name,
  .woocommerce-checkout-review-order-table tr.cart_item td.product-total {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
  }

  .woocommerce-checkout-review-order-table tr.cart_item td.product-total {
    padding-top: 0.35rem;
    padding-bottom: 0.75rem;
  }

  .instapresse-checkout-line__title {
    padding-top: 0.9rem;
    padding-bottom: 0.3rem; /* 1/3 */
  }
}

/* ========== Checkout : Infos commande — titre hors carte, carte pleine largeur ========== */
.instaprix-checkout-order-details-wrap {
  width: 100%;
  margin: 0.85rem 0 0.65rem;
}

.instaprix-checkout-order-details-wrap > .instaprix-checkout-order-details__title {
  margin: 0;
  padding-top: 0.9rem;
  padding-bottom: 0.3rem; /* 1/3 du haut */
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: #222;
}

.instaprix-checkout-order-details-wrap > .instaprix-checkout-order-details__intro {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #666;
}

.instaprix-checkout-order-details-wrap .instaprix-checkout-order-details {
  width: 100%;
  margin: 0;
  padding: 0.85rem;
  box-sizing: border-box;
  background: rgba(0, 157, 179, 0.04);
  border: 1px solid rgba(0, 157, 179, 0.22);
  border-left: 3px solid #009DB3;
  border-radius: 5px;
}

.instaprix-checkout-order-details-wrap .instaprix-checkout-order-details__header {
  display: none; /* titre déplacé au-dessus */
}

@media (max-width: 767px) {
  .instaprix-checkout-order-details-wrap .instaprix-checkout-order-details {
    border-radius: 0;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border-left: none;
    border-right: none;
  }
}

/* ========== Loader 7 couleurs (viewport) ========== */
.ip-loader-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.ip-loader-dots--floating {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  z-index: 100012;
  pointer-events: none;
}

.ip-loader-dots__dot {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.35;
  transform: translateX(0) scale(0.85);
  animation: ip-loader-conveyor 1.05s ease-in-out infinite;
}

.ip-loader-dots__dot--1 { animation-delay: 0s; }
.ip-loader-dots__dot--2 { animation-delay: 0.08s; }
.ip-loader-dots__dot--3 { animation-delay: 0.16s; }
.ip-loader-dots__dot--4 { animation-delay: 0.24s; }
.ip-loader-dots__dot--5 { animation-delay: 0.32s; }
.ip-loader-dots__dot--6 { animation-delay: 0.4s; }
.ip-loader-dots__dot--7 { animation-delay: 0.48s; }

@keyframes ip-loader-conveyor {
  0%,
  100% {
    transform: translateX(0) scale(0.8);
    opacity: 0.3;
  }
  40% {
    transform: translateX(7px) scale(1.15);
    opacity: 1;
  }
  70% {
    transform: translateX(12px) scale(0.95);
    opacity: 0.55;
  }
}

/* blockUI Woo — forcer viewport + masquer ancien spinner */
.woocommerce-checkout .blockUI.blockOverlay,
.woocommerce-cart .blockUI.blockOverlay,
.woocommerce .blockUI.blockOverlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(255, 255, 255, 0.55) !important;
  z-index: 100010 !important;
}

.woocommerce-checkout .blockUI.blockMsg,
.woocommerce-cart .blockUI.blockMsg,
.woocommerce .blockUI.blockMsg {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  z-index: 100011 !important;
  width: auto !important;
}

.woocommerce-checkout .blockUI.blockOverlay::before,
.woocommerce-cart .blockUI.blockOverlay::before,
.woocommerce .blockUI.blockOverlay::before,
.blockUI.blockOverlay::before {
  display: none !important;
  content: none !important;
  animation: none !important;
}

/* c-loading produit : pastilles au lieu du ring */
.c-loading .c-loading__inner {
  display: none !important;
}

.c-loading .ip-loader-dots {
  position: relative;
  z-index: 1001;
}
