/* JCBike - Precio en oferta animado (6 estilos) */

/* ---------- Comunes ---------- */
.jcpa .jcpa-new {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Tachado que se dibuja en directo (estilos 1 y 6) */
.jcpa .regular-price.jcpa-old {
  position: relative;
  display: inline-block;
  text-decoration: none !important;
}
.jcpa .regular-price.jcpa-old::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: 52%;
  height: 2px;
  background: var(--jcpa-strike, #c0392b);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}
.jcpa .regular-price.jcpa-go::after {
  animation: jcpa-strike .5s .1s cubic-bezier(.6, 0, .3, 1) forwards;
}
.jcpa .regular-price.jcpa-go {
  animation: jcpa-fade .3s .55s forwards;
}

/* ---------- 1 · Tachado en directo: el precio nuevo entra de un salto ---------- */
.jcpa .jcpa-new.jcpa-pre {
  opacity: 0;
  transform: translateY(8px) scale(.9);
}
.jcpa .jcpa-new.jcpa-pre.jcpa-pop {
  animation: jcpa-pop .5s .6s cubic-bezier(.2, 1.4, .4, 1) forwards;
}

/* ---------- 3 · Destello dorado ---------- */
.jcpa .jcpa-new.jcpa-shine {
  background: linear-gradient(100deg,
      var(--jcpa-base, #96693a) 0%, var(--jcpa-base, #96693a) 42%,
      #f3d29a 50%,
      var(--jcpa-base, #96693a) 58%, var(--jcpa-base, #96693a) 100%) 100% 0 / 300% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: jcpa-shine 1.4s .2s ease-in-out 2 forwards;
}

/* ---------- 5 · Latido del precio ---------- */
.jcpa .jcpa-new.jcpa-beatprice {
  animation: jcpa-beatprice 3.2s ease-in-out 3;
}

/* ---------- 6 · Combinado: rebote al terminar la cuenta ---------- */
.jcpa .jcpa-new.jcpa-land {
  animation: jcpa-land .45s cubic-bezier(.2, 1.4, .4, 1);
}

/* ---------- "Te ahorras X €" ---------- */
.jcpa-saving {
  opacity: 0;
  line-height: 1.3;
  white-space: nowrap;
}
.jcpa-saving.jcpa-show {
  animation: jcpa-in .4s forwards;
}

/* 6 · recuadro */
.jcpa-saving-box {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 10px;
  border: 1px solid var(--jcpa-saving, #96693a);
  color: var(--jcpa-saving, #96693a);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  transform: translateY(6px);
}

/* 2 · texto */
.jcpa-saving-text {
  display: block;
  margin-top: 6px;
  color: var(--jcpa-strike, #c0392b);
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .03em;
  transform: translateY(4px);
}

/* 4 · cinta roja que entra deslizando y se balancea */
.jcpa-saving-ribbon {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--jcpa-strike, #c0392b);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  transform: translateX(-60px);
}
.jcpa-saving-ribbon.jcpa-show {
  animation: jcpa-slide .55s cubic-bezier(.2, 1.2, .4, 1) forwards, jcpa-nudge 2.4s 1s ease-in-out 2;
}

/* En los listados, la etiqueta va centrada debajo del precio */
.jcpa-saving.jcpa-saving-block {
  display: table;
  margin-left: auto;
  margin-right: auto;
  font-size: .75rem;
}

/* ---------- Insignia del descuento: late una vez al terminar ---------- */
.product-flag.jcpa-beat,
.product-flags .discount.jcpa-beat {
  animation: jcpa-beat 1.2s ease-in-out 1;
}

/* ---------- Keyframes ---------- */
@keyframes jcpa-strike { to { transform: scaleX(1); } }
@keyframes jcpa-fade { to { opacity: .55; } }
@keyframes jcpa-in { to { opacity: 1; transform: none; } }
@keyframes jcpa-pop { to { opacity: 1; transform: none; } }
@keyframes jcpa-shine { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes jcpa-land { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes jcpa-slide { to { opacity: 1; transform: none; } }
@keyframes jcpa-nudge {
  0%, 80%, 100% { transform: none; }
  85% { transform: rotate(-3deg) scale(1.05); }
  92% { transform: rotate(3deg) scale(1.05); }
}
@keyframes jcpa-beatprice {
  0%, 70%, 100% { transform: scale(1); }
  78% { transform: scale(1.12); }
  86% { transform: scale(.98); }
  93% { transform: scale(1.05); }
}
@keyframes jcpa-beat {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.15); }
  40% { transform: scale(.97); }
  60% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .jcpa *, .product-flag.jcpa-beat { animation: none !important; }
  .jcpa-saving { opacity: 1; transform: none; }
}
