/**
 * Brucepilot B2B — Incitations (cart, checkout, mini-cart).
 *
 * Takes the theme font and text colour. The accent is the theme's button
 * colour (read by incentives.js on the cart and checkout), else the block
 * theme's primary colour, else the text colour. Restyle without touching
 * this file:
 *
 *   .bp-nudges { --bp-nudge-accent: #7a5c2e; --bp-nudge-radius: 6px; }
 */

.bp-nudges {
  --bp-nudge-accent: var(--bp-nudge-theme-accent, var(--wp--preset--color--primary, currentColor));
  --bp-nudge-accent-contrast: var(--bp-nudge-theme-contrast, #fff);
  --bp-nudge-success: #1f8a4c;
  --bp-nudge-line: rgba(0, 0, 0, 0.1);
  --bp-nudge-soft: rgba(0, 0, 0, 0.025);
  --bp-nudge-radius: 12px;
  --bp-nudge-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  display: grid;
  gap: 10px;
  margin: 0 0 1.5em;
  color: inherit;
  font-size: 0.95em;
  line-height: 1.45;
}
@supports (color: color-mix(in srgb, red 50%, transparent)) {
  .bp-nudges {
    --bp-nudge-line: color-mix(in srgb, currentColor 13%, transparent);
    --bp-nudge-soft: color-mix(in srgb, var(--bp-nudge-accent) 6%, transparent);
  }
}
.bp-nudges:empty { display: none; }

/* One message */
.bp-nudge {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--bp-nudge-line);
  border-radius: var(--bp-nudge-radius);
  background: var(--bp-nudge-soft);
  box-sizing: border-box;
}
.bp-nudges .bp-nudge__msg { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; font-size: 1em; }
.bp-nudge__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bp-nudge-soft);
  box-shadow: inset 0 0 0 1px var(--bp-nudge-line);
  color: var(--bp-nudge-accent);
}
.bp-nudge__icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bp-nudge__text { flex: 1; min-width: 0; }
.bp-nudge__text strong { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Progress */
.bp-nudge__track {
  display: block;
  height: 6px;
  margin: 10px 0 0 40px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bp-nudge-line);
}
.bp-nudge__fill {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: var(--bp-nudge-accent);
  transition: width 0.6s var(--bp-nudge-ease), background-color 0.3s;
}

/* Goal reached */
.bp-nudge.is-success { border-color: rgba(31, 138, 76, 0.28); background: rgba(31, 138, 76, 0.07); }
.bp-nudge.is-success .bp-nudge__icon { background: var(--bp-nudge-success); box-shadow: none; color: #fff; }
.bp-nudge.is-success .bp-nudge__icon svg { stroke-width: 2.4; }
.bp-nudge.is-success .bp-nudge__text { color: var(--bp-nudge-success); font-weight: 600; }
.bp-nudge.is-success .bp-nudge__fill { background: var(--bp-nudge-success); }

/* Buttons: "+4", "Ajouter" */
.bp-nudges .bp-nudge__cta,
.bp-nudges .bp-nudge-card__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 34px;
  margin: 0;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--bp-nudge-accent);
  color: var(--bp-nudge-accent-contrast);
  font: inherit;
  font-size: 0.9em;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.15s var(--bp-nudge-ease), opacity 0.15s, box-shadow 0.2s;
}
.bp-nudges .bp-nudge__cta:hover,
.bp-nudges .bp-nudge-card__add:hover { box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.45); transform: translateY(-1px); color: var(--bp-nudge-accent-contrast); }
.bp-nudges .bp-nudge__cta:focus-visible,
.bp-nudges .bp-nudge-card__add:focus-visible { outline: 2px solid var(--bp-nudge-accent); outline-offset: 2px; }
.bp-nudges .is-busy { opacity: 0.6; pointer-events: none; }
.bp-nudges .is-done { background: var(--bp-nudge-success); color: #fff; }

/* Suggestions */
.bp-nudge--cards { padding: 14px; background: transparent; }
.bp-nudges .bp-nudge__title {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  color: inherit;
  font-family: inherit;
  font-size: 0.78em;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.bp-nudges .bp-nudge__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bp-nudge-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; }
.bp-nudge-card::before, .bp-nudge-card::marker { content: none; }
.bp-nudges .bp-nudge-card__photo {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--bp-nudge-line);
  border-radius: calc(var(--bp-nudge-radius) - 2px);
  background: var(--bp-nudge-soft);
}
.bp-nudges .bp-nudge-card__photo img { display: block; width: 100%; height: 100%; margin: 0; object-fit: cover; transition: transform 0.4s var(--bp-nudge-ease); }
.bp-nudge-card:hover .bp-nudge-card__photo img { transform: scale(1.04); }
.bp-nudges .bp-nudge-card__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  color: inherit;
  font-size: 0.88em;
  line-height: 1.35;
  text-decoration: none;
}
.bp-nudges .bp-nudge-card__name:hover { text-decoration: underline; }
.bp-nudge-card__price { font-size: 0.9em; font-weight: 600; font-variant-numeric: tabular-nums; }
.bp-nudge-card__price del { opacity: 0.55; font-weight: 400; }
.bp-nudge-card__price ins { text-decoration: none; }
.bp-nudges .bp-nudge-card__add { width: 100%; margin-top: auto; background: transparent; color: var(--bp-nudge-accent); box-shadow: inset 0 0 0 1.5px var(--bp-nudge-accent); }
.bp-nudges .bp-nudge-card__add:hover { background: var(--bp-nudge-accent); color: var(--bp-nudge-accent-contrast); box-shadow: inset 0 0 0 1.5px var(--bp-nudge-accent); }

/* Mini-cart: compact */
.bp-nudges--mini { gap: 8px; margin: 0 0 12px; font-size: 0.85em; }
.bp-nudges--mini .bp-nudge { padding: 9px 10px; }
.bp-nudges--mini .bp-nudge__icon { width: 24px; height: 24px; }
.bp-nudges--mini .bp-nudge__icon svg { width: 13px; height: 13px; }
.bp-nudges--mini .bp-nudge__track { height: 4px; margin: 7px 0 0 34px; }

/* Cart and checkout blocks sit in the block width. */
.bp-nudges--block-cart, .bp-nudges--block-checkout { max-width: var(--wp--style--global--wide-size, 1200px); margin-left: auto; margin-right: auto; }

@media (max-width: 600px) {
  .bp-nudge { padding: 10px 12px; }
  .bp-nudge__track { margin-left: 0; }
  .bp-nudges .bp-nudge__msg { flex-wrap: wrap; }
  .bp-nudge__text { flex-basis: calc(100% - 40px); }
  .bp-nudges .bp-nudge__msg .bp-nudge__cta { margin-left: 40px; }
  .bp-nudges .bp-nudge__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .bp-nudge__fill, .bp-nudge-card__photo img, .bp-nudges .bp-nudge__cta, .bp-nudges .bp-nudge-card__add { transition: none; }
}

.bp-nudge__error { color: #b42318; font-weight: 600; }
