/* Hb Free Shipping Progress - v1.1.0
   Cambia i colori qui sotto per adattarli al tema */
.hbfsp {
  --hbfsp-accent: #69C332;
  --hbfsp-accent-dark: #2E9E4F;
  --hbfsp-accent-light: #9BE35A;
  --hbfsp-hot: #F59E0B;
  --hbfsp-track: #E9EDF1;
  --hbfsp-text: #1F2937;
  --hbfsp-muted: #6B7280;
  --hbfsp-bg: #FFFFFF;
  --hbfsp-border: #E5E7EB;
  --hbfsp-from: 0;

  position: relative;
  margin: 0 0 1rem;
  padding: 10px 0px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hbfsp-border); /* separatore dalle righe dei totali */
  border-radius: 0;
  color: var(--hbfsp-text);
  overflow: visible;
}

/* ---------- testo ---------- */
.hbfsp__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.hbfsp__text { margin: 0; font-size: .95rem; line-height: 1.35; }
.hbfsp__amount { color: var(--hbfsp-accent-dark); font-variant-numeric: tabular-nums; }
.hbfsp__hot { color: var(--hbfsp-hot); font-weight: 700; }
.hbfsp__pct {
  flex: none; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: rgba(105, 195, 50, .14); color: var(--hbfsp-accent-dark); font-variant-numeric: tabular-nums;
}
.hbfsp__scale { display: flex; justify-content: space-between; margin-top: 25px; font-size: 0rem; color: var(--hbfsp-muted); }

/* ---------- barra ---------- */
.hbfsp__rail {
  position: relative; height: 12px; margin: 5px;
  background: var(--hbfsp-track); border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08);
}
.hbfsp__lane {
  position: absolute; inset: 0 auto 0 0; height: 100%;
  width: calc(var(--hbfsp-p) * 1%);
  animation: hbfsp-grow 1.3s cubic-bezier(.22, 1, .36, 1) both;
}
.hbfsp__fill {
  position: absolute; inset: 0; border-radius: 999px; overflow: hidden;
  background:
    repeating-linear-gradient(-45deg, rgba(255,255,255,.22) 0 10px, rgba(255,255,255,0) 10px 20px),
    linear-gradient(90deg, var(--hbfsp-accent-light), var(--hbfsp-accent) 55%, var(--hbfsp-accent-dark));
  background-size: 28px 28px, 100% 100%;
  animation: hbfsp-stripes 1s linear infinite;
  box-shadow: 0 0 14px rgba(105, 195, 50, .55);
}
.hbfsp__fill::after { /* riflesso che scorre */
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: hbfsp-shine 2.6s ease-in-out 1.2s infinite;
}

/* ---------- camioncino ---------- */
.hbfsp__truck {
  position: absolute; right: 0; top: 50%; width: 38px; height: 38px;
  transform: translate(50%, -50%);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff;
  background: linear-gradient(145deg, var(--hbfsp-accent), var(--hbfsp-accent-dark));
  border: 3px solid var(--hbfsp-bg);
  box-shadow: 0 4px 12px rgba(46, 158, 79, .45);
  animation: hbfsp-bob 1.6s ease-in-out infinite;
}
.hbfsp__truck svg { width: 18px; height: 18px; }
.hbfsp__truck::before { /* onda di pulsazione */
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--hbfsp-accent); opacity: 0;
  animation: hbfsp-pulse 2s ease-out infinite;
}

/* ---------- traguardo ---------- */
.hbfsp__goal {
  position: absolute; right: 0; top: 50%; width: 34px; height: 34px;
  transform: translate(50%, -50%);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--hbfsp-bg); color: var(--hbfsp-muted);
  border: 2px dashed #CBD5E1; z-index: 2;
}
.hbfsp__goal svg { width: 16px; height: 16px; }
.hbfsp__check { display: none; }
.hbfsp__lane { z-index: 3; }
.hbfsp.is-complete .hbfsp__lane { z-index: 1; }

/* ---------- quasi al traguardo ---------- */
.hbfsp.is-near .hbfsp__goal { color: var(--hbfsp-hot); border-color: var(--hbfsp-hot); animation: hbfsp-wiggle 1.4s ease-in-out infinite; }

/* ---------- completato ---------- */

.hbfsp.is-complete .hbfsp__goal {
  background: linear-gradient(145deg, var(--hbfsp-accent), var(--hbfsp-accent-dark));
  color: #fff; border: 3px solid var(--hbfsp-bg); box-shadow: 0 4px 12px rgba(46, 158, 79, .45);
  animation: hbfsp-pop .7s cubic-bezier(.34, 1.56, .64, 1) 1s both;
}
.hbfsp.is-complete .hbfsp__gift { display: none; }
.hbfsp.is-complete .hbfsp__check { display: block; }
.hbfsp.is-complete .hbfsp__truck { display: none; }
.hbfsp.is-complete .hbfsp__fill { animation: none; }
.hbfsp.is-complete .hbfsp__pct { background: var(--hbfsp-accent); color: #fff; }

/* ---------- coriandoli ---------- */
.hbfsp__confetti { position: absolute; right: 20px; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.hbfsp__confetti i {
  position: absolute; left: 0; top: 0; width: 7px; height: 11px; border-radius: 2px;
  background: var(--c); opacity: 0;
  animation: hbfsp-confetti 1.3s cubic-bezier(.15, .8, .3, 1) var(--d, 0s) forwards;
}

/* ---------- keyframes ---------- */
@keyframes hbfsp-grow    { from { width: calc(var(--hbfsp-from) * 1%); } to { width: calc(var(--hbfsp-p) * 1%); } }
@keyframes hbfsp-stripes { to { background-position: 28px 0, 0 0; } }
@keyframes hbfsp-shine   { 0% { left: -40%; } 60%, 100% { left: 110%; } }
@keyframes hbfsp-bob     { 0%, 100% { transform: translate(50%, -50%); } 50% { transform: translate(50%, calc(-50% - 3px)); } }
@keyframes hbfsp-pulse   { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes hbfsp-wiggle  { 0%, 100% { transform: translate(50%, -50%) rotate(0); } 25% { transform: translate(50%, -50%) rotate(-12deg); } 75% { transform: translate(50%, -50%) rotate(12deg); } }
@keyframes hbfsp-pop     { 0% { transform: translate(50%, -50%) scale(.4); } 100% { transform: translate(50%, -50%) scale(1.15); } }
@keyframes hbfsp-confetti {
  0%   { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(.7); opacity: 0; }
}

/* ---------- mobile ---------- */
@media (max-width: 575px) {
  .hbfsp { padding: 10px 0px; }
  .hbfsp__rail { margin: 0px; }
  .hbfsp__text { font-size: .88rem; }
  .hbfsp__confetti { right: 16px; }
}

/* ---------- chi preferisce meno movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .hbfsp *, .hbfsp *::before, .hbfsp *::after { animation: none !important; }
  .hbfsp__confetti { display: none; }
}
