/* BCX Theme, add-to-cart toast + badge bump, v1.3.0 */

/* ─── Toast ──────────────────────────────────────────────────────── */
.bcx-cart-toast {
  position: fixed;
  bottom: 16px; left: 16px; right: 16px;
  max-width: 520px;
  margin: 0 auto;
  background: #0F172A;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.30);
  z-index: 99999;
  display: flex; align-items: center; gap: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  animation: bcx-toast-in 0.3s ease-out;
}
.bcx-cart-toast-out {
  animation: bcx-toast-out 0.25s ease-in forwards;
}
@keyframes bcx-toast-in {
  from { transform: translateY(120%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes bcx-toast-out {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(120%); opacity: 0; }
}

/* ─── Thumb do produto (quando tem imagem) ────────────────────────── */
.bcx-cart-toast-thumb {
  position: relative;
  width: 48px; height: 48px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.bcx-cart-toast-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.bcx-cart-toast-thumb-badge {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--bcx-accent, #27AE60);
  border: 2px solid #0F172A;
  border-radius: 50%;
  display: grid; place-items: center;
}

/* ─── Check verde (fallback quando nao tem imagem) ────────────────── */
.bcx-cart-toast-check {
  width: 32px; height: 32px;
  background: var(--bcx-accent, #27AE60);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}

/* ─── Texto: nome em 2 linhas + meta ──────────────────────────────── */
.bcx-cart-toast-text { flex: 1; min-width: 0; }
.bcx-cart-toast-text strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}
.bcx-cart-toast-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.95;
  margin-bottom: 2px;
  word-break: break-word;
}
.bcx-cart-toast-meta {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── CTA primaria (cor do tema, fallback azul Guedes) ────────────── */
.bcx-cart-toast-cta {
  background: var(--bcx-cta, var(--bcx-primary, #37B7FF));
  color: #fff !important;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.bcx-cart-toast-cta:hover {
  background: var(--bcx-cta-dark, var(--bcx-primary-dark, #1A9AE0));
  transform: translateY(-1px);
}

/* ─── X de fechar, branco limpo ───────────────────────────────────── */
.bcx-cart-toast-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 24px; height: 24px;
  padding: 0;
  display: grid; place-items: center;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.bcx-cart-toast-close:hover,
.bcx-cart-toast-close:focus-visible {
  opacity: 1;
  outline: none;
}
.bcx-cart-toast-close svg {
  stroke-width: 2.4;
}

/* ─── Mobile: full width com mais respiro ─────────────────────────── */
@media (max-width: 600px) {
  .bcx-cart-toast {
    bottom: 12px; left: 12px; right: 12px;
    gap: 10px;
    padding: 10px 12px;
  }
  .bcx-cart-toast-thumb { width: 44px; height: 44px; }
  .bcx-cart-toast-cta { padding: 9px 12px; }
  .bcx-cart-toast-text strong { font-size: 12px; }
  .bcx-cart-toast-name { font-size: 11px; -webkit-line-clamp: 2; }
}

/* ─── Badge bump animation no header ─────────────────────────────── */
.bcx-bump,
.bcx-cart-count.bcx-bump,
.cart-contents-count.bcx-bump,
.header-icon .badge.bcx-bump,
.bcx-cart-badge.bcx-bump {
  animation: bcx-badge-bump 0.4s ease-out;
}
@keyframes bcx-badge-bump {
  0% { transform: scale(1); }
  40% {
    transform: scale(1.6);
    background: var(--bcx-accent, #27AE60) !important;
    box-shadow: 0 0 0 4px rgba(39,174,96,0.18);
  }
  100% { transform: scale(1); }
}

/* ─── Esconde botao "Ver carrinho" nativo do WC ──────────────────── */
/* Toast BCX ja tem o CTA "Ver carrinho", o link nativo do WC fica redundante.
   Caso especial: categoria/loop, WC injeta <a class="added_to_cart wc-forward">
   logo depois do botao "Comprar", produzindo "dois loads" pro usuario
   (botao verde + link "Visualizar carrinho"). Toast preto BCX ja cobre isso.
   Esconder em todo contexto. (calderon, 16/05/2026) */
a.added_to_cart,
a.added_to_cart.wc-forward,
.bcx-product-actions a.added_to_cart,
.products a.added_to_cart,
li.product a.added_to_cart,
.single-product a.added_to_cart,
.single-product .added_to_cart.wc-forward,
.woocommerce-product-summary a.added_to_cart,
form.cart + .added_to_cart,
form.cart ~ a.added_to_cart {
  display: none !important;
}

/* ─── Spinner no botao durante AJAX add-to-cart ──────────────────── */
.bcx-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  animation: bcx-spin 0.7s linear infinite;
}
@keyframes bcx-spin {
  to { transform: rotate(360deg); }
}
.bcx-loading {
  opacity: 0.85;
  cursor: progress !important;
}

/* ─── Reduce motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .bcx-cart-toast { animation: none; }
  .bcx-bump { animation: none; }
}
