/* Celebração do cupom aplicado — ver assets/js/coupon-fx.js */

.cfx-canvas { position: fixed; inset: 0; z-index: 400; width: 100vw; height: 100vh; pointer-events: none; }

.cfx-layer {
  position: fixed; inset: 0; z-index: 390;
  display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--brand-ink) 0%, transparent);
  transition: background .35s var(--ease-out);
  cursor: pointer;
}
.cfx-layer.in { background: color-mix(in srgb, var(--brand-ink) 38%, transparent); }
.cfx-layer.out { background: transparent; transition-duration: .3s; }

.cfx-ticket {
  position: relative; overflow: hidden;
  display: flex; align-items: stretch;
  width: min(380px, 100%);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(-40px) rotate(-6deg) scale(.85);
}
.cfx-layer.in .cfx-ticket { animation: cfx-drop .7s var(--ease-out) forwards; }
.cfx-layer.out .cfx-ticket { animation: cfx-leave .35s ease-in forwards; }

/* lado colorido do bilhete, com o picote */
.cfx-left {
  position: relative;
  display: grid; place-items: center;
  flex: 0 0 96px;
  background: linear-gradient(160deg, var(--brand), var(--brand-deep));
  color: #fff;
}
.cfx-left::after {
  content: ""; position: absolute; top: 8px; bottom: 8px; right: -1px; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--surface) 0 6px, transparent 6px 12px);
}
.cfx-ticket::before, .cfx-ticket::after {
  /* os "furinhos" do picote em cima e embaixo */
  content: ""; position: absolute; left: 87px; width: 18px; height: 18px; border-radius: 50%;
  background: color-mix(in srgb, var(--brand-ink) 38%, var(--bg));
  z-index: 1;
}
.cfx-ticket::before { top: -9px; }
.cfx-ticket::after { bottom: -9px; }

.cfx-ic {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.16);
  animation: cfx-pop .6s .35s var(--ease-out) both;
}
.cfx-ic .i { width: 26px; height: 26px; color: var(--accent-2); }

.cfx-right { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; min-width: 0; }
.cfx-right small {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand);
}
.cfx-code {
  font-family: var(--font-display); font-size: 22px; letter-spacing: .02em;
  overflow-wrap: anywhere;
  animation: cfx-stamp .5s .45s var(--ease-out) both;
}
.cfx-save { font-size: 14px; color: var(--text-2); }
.cfx-save strong { color: var(--brand); font-variant-numeric: tabular-nums; }

/* brilho que atravessa o bilhete */
.cfx-shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: cfx-shine 1.1s .55s ease-out both;
}

/* linha de desconto no resumo */
.ck-row.discount.cfx-row { position: relative; border-radius: var(--r-xs); animation: cfx-row 1.6s .5s var(--ease-out) both; }
.ck-row.discount.cfx-row span:last-child { display: inline-block; animation: cfx-pop .6s .7s var(--ease-out) both; }

/* campo do cupom: aplicado e erro */
.ck-coupon.cfx-applied input { border-color: var(--brand); box-shadow: var(--ring); }
.ck-coupon.cfx-shake { animation: cfx-shake .45s ease-in-out; }
.ck-coupon.cfx-shake input { border-color: var(--danger); }

@keyframes cfx-drop {
  0%   { opacity: 0; transform: translateY(-40px) rotate(-6deg) scale(.85); }
  60%  { opacity: 1; transform: translateY(6px) rotate(1.5deg) scale(1.02); }
  100% { opacity: 1; transform: none; }
}
@keyframes cfx-leave { to { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes cfx-pop {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes cfx-stamp {
  0% { transform: scale(1.6); opacity: 0; letter-spacing: .3em; }
  100% { transform: none; opacity: 1; }
}
@keyframes cfx-shine { to { transform: translateX(120%); } }
@keyframes cfx-row {
  0%, 100% { background: transparent; box-shadow: none; }
  25%, 60% { background: var(--brand-tint); box-shadow: 0 0 0 6px var(--brand-tint); }
}
@keyframes cfx-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .cfx-layer.in .cfx-ticket { animation: none; opacity: 1; transform: none; }
  .cfx-ic, .cfx-code, .cfx-shine, .ck-row.discount.cfx-row,
  .ck-row.discount.cfx-row span:last-child, .ck-coupon.cfx-shake { animation: none; }
}

/* "Remover cupom" — carrinho e checkout */
.ck-coupon-remove {
  display: inline-block; margin: 6px 0 0; padding: 0;
  border: 0; background: none; cursor: pointer;
  font-size: 12.5px; color: var(--muted); text-decoration: underline;
}
.ck-coupon-remove:hover { color: var(--danger); }

/* Regra do cupom (ex.: ODOUSBLACK: 20% no Pix ou 15% no cartão e boleto) */
.ck-coupon-note {
  margin: 6px 0 10px; padding: 8px 10px;
  border-radius: var(--r-xs);
  background: var(--brand-tint); color: var(--text-2);
  font-size: 12.5px; line-height: 1.45;
}
.ck-coupon-note b { color: var(--brand); }
