/* ==========================================================================
   COMPONENT: CART TOAST — Notificación flotante al agregar al carrito
   Componente global reutilizable. Se inyecta vía JS (cart-animation.js).
   ========================================================================== */

/* --- Toast Container (position fixed, bottom-right) --- */
.cart-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  background-color: rgba(25, 28, 29, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-3xl, 1.5rem);
  padding: 1rem 1.25rem;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transform: translateY(120%) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.35s ease,
    visibility 0.35s ease;
  pointer-events: none;
  box-sizing: border-box;
}

/* --- Visible State --- */
.cart-toast--visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --- Exiting State (slide down) --- */
.cart-toast--exiting {
  transform: translateY(120%) scale(0.95);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 1, 1),
    opacity 0.25s ease;
}

/* --- Top Row: Icon + Text + Close --- */
.cart-toast__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Animated Check Icon --- */
.cart-toast__icon-wrapper {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tertiary, #006860), var(--tertiary-container, #008379));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: toastIconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.cart-toast__icon {
  font-size: 1.25rem !important;
  color: #ffffff;
}

/* --- Text Block --- */
.cart-toast__text {
  flex: 1;
  min-width: 0;
}

.cart-toast__title {
  font-family: var(--font-headline, 'Space Grotesk', sans-serif);
  font-weight: 700;
  font-size: 0.78rem;
  color: #ffffff;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cart-toast__product-name {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  margin: 0.15rem 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Close Button --- */
.cart-toast__close {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.08);
  border: none;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.cart-toast__close:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.cart-toast__close-icon {
  font-size: 0.95rem !important;
}

/* --- Action Button (VER CARRITO) --- */
.cart-toast__action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, var(--primary, #b7102a), var(--primary-container, #db313f));
  color: #ffffff;
  font-family: var(--font-headline, 'Space Grotesk', sans-serif);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-2xl, 1rem);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.cart-toast__action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(183, 16, 42, 0.4);
}

.cart-toast__action-icon {
  font-size: 1rem !important;
}

/* --- Progress Bar (auto-dismiss timer) --- */
.cart-toast__progress {
  height: 3px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: -0.25rem;
}

.cart-toast__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary, #b7102a), var(--tertiary, #006860));
  border-radius: 2px;
  width: 100%;
  transform-origin: left;
  animation: toastProgressShrink 4.5s linear forwards;
}

/* Pause progress on hover */
.cart-toast:hover .cart-toast__progress-bar {
  animation-play-state: paused;
}

/* ==========================================================================
   KEYFRAMES
   ========================================================================== */

@keyframes toastIconPop {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@keyframes toastProgressShrink {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

/* ==========================================================================
   RESPONSIVE: Mobile adjustments
   ========================================================================== */
@media (max-width: 640px) {
  .cart-toast {
    right: 1rem;
    left: 1rem;
    bottom: 1.25rem;
    width: auto;
    max-width: none;
  }
}

/* ==========================================================================
   COMPONENT: WC NOTICE TOAST — avisos nativos de WooCommerce (stock, cupón,
   carrito modificado) reconvertidos a flotante en vez de bloques apilados.
   Se inyecta vía JS (cart-animation.js) a partir de [data-mt-toast-notices].
   Mismo lenguaje visual que .cart-toast, arriba a la derecha para no chocar
   con el toast de "Añadido al carrito" (bottom-right).
   ========================================================================== */

/* Oculto desde el CSS (carga en <head>, antes que cart-animation.js corra en
   el footer) para que los notices originales de WC nunca lleguen a pintarse
   apilados — cart-animation.js los lee de acá y los reinyecta como toast. */
[data-mt-toast-notices] {
  display: none;
}

.wc-notice-toast-container {
  position: fixed;
  top: calc(5.5rem + 1rem); /* debajo del .site-header fijo — Regla 19 */
  right: 1.5rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}

.wc-notice-toast {
  pointer-events: auto;
  background-color: rgba(25, 28, 29, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-3xl, 1.5rem);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
  box-sizing: border-box;
}

.wc-notice-toast--visible {
  transform: translateX(0);
  opacity: 1;
}

.wc-notice-toast--exiting {
  transform: translateX(120%);
  opacity: 0;
}

.wc-notice-toast__icon-wrapper {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wc-notice-toast--error .wc-notice-toast__icon-wrapper {
  background: linear-gradient(135deg, var(--error, #ba1a1a), var(--error, #ba1a1a));
}

.wc-notice-toast--notice .wc-notice-toast__icon-wrapper,
.wc-notice-toast--info .wc-notice-toast__icon-wrapper {
  background: linear-gradient(135deg, var(--tertiary, #006860), var(--tertiary-container, #008379));
}

.wc-notice-toast--success .wc-notice-toast__icon-wrapper {
  background: linear-gradient(135deg, var(--tertiary, #006860), var(--tertiary-container, #008379));
}

.wc-notice-toast__icon {
  font-size: 1.1rem !important;
  color: #ffffff;
}

.wc-notice-toast__text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
  padding-top: 0.15rem;
}

.wc-notice-toast__text a {
  color: #ffffff;
  text-decoration: underline;
}

.wc-notice-toast__close {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.08);
  border: none;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.wc-notice-toast__close:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.wc-notice-toast__close-icon {
  font-size: 0.95rem !important;
}

@media (max-width: 640px) {
  .wc-notice-toast-container {
    left: 1rem;
    right: 1rem;
    top: calc(5.5rem + 0.5rem);
    width: auto;
    max-width: none;
  }
}
