/* ===========================================================================
   LYU CART TOAST — "Product added to cart" floating notification
   Editorial design: white card · pink gradient accent · serif heading
   =========================================================================== */

.lyu-cart-toast {
  /* Local fallbacks so the toast works on pages where lyu-shop.css isn't loaded */
  --lct-red:         var(--lyu-red, #f2053c);
  --lct-red-dark:    var(--lyu-red-dark, #cb003d);
  --lct-grad:        var(--lyu-grad, linear-gradient(135deg, #f2053c 0%, #cb003d 100%));
  --lct-grad-soft:   linear-gradient(135deg, rgba(242,5,60,.06) 0%, rgba(203,0,61,.03) 100%);
  --lct-shadow:
    0 22px 60px -16px rgba(242, 5, 60, .28),
    0 8px 22px -8px rgba(15, 18, 30, .15),
    0 0 0 1px rgba(242, 5, 60, .06);
  --lct-serif:       var(--lyu-serif, "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", Times, serif);

  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 24px);
  left: 50%;
  transform: translate(-50%, -32px) scale(.96);
  z-index: 2147483600;       /* above chat widgets */
  width: min(440px, calc(100vw - 24px));
  background: #fff;
  background-image: var(--lct-grad-soft);
  border-radius: 16px;
  padding: 14px 14px 14px 22px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: center;
  gap: 14px;
  box-shadow: var(--lct-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity .35s cubic-bezier(.22, 1, .36, 1),
    transform .42s cubic-bezier(.22, 1, .36, 1),
    visibility .42s linear;
  overflow: hidden;
  isolation: isolate;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
}

/* Gradient ribbon along the left edge */
.lyu-cart-toast::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--lct-grad);
  border-radius: 16px 0 0 16px;
}

/* Decorative soft glow in top-right corner */
.lyu-cart-toast::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(242, 5, 60, .12), transparent 65%);
  pointer-events: none;
  z-index: -1;
}

.lyu-cart-toast.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.lyu-cart-toast.is-leaving {
  opacity: 0;
  transform: translate(-50%, -32px) scale(.96);
  pointer-events: none;
}

/* ── Check icon ─────────────────────────────────────────────────────── */
.lyu-cart-toast__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--lct-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    0 6px 16px -4px rgba(242, 5, 60, .45),
    inset 0 0 0 2px rgba(255, 255, 255, .18);
  position: relative;
}

.lyu-cart-toast__icon svg {
  display: block;
  animation: lyu-toast-check .55s cubic-bezier(.22, 1, .36, 1) .15s both;
}

@keyframes lyu-toast-check {
  0%   { transform: scale(.4); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Pulsing ring around the icon on entrance */
.lyu-cart-toast.is-visible .lyu-cart-toast__icon::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--lct-red);
  opacity: 0;
  animation: lyu-toast-ring 1.1s ease-out .35s;
}

@keyframes lyu-toast-ring {
  0%   { transform: scale(.85); opacity: .55; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── Body text ──────────────────────────────────────────────────────── */
.lyu-cart-toast__body {
  min-width: 0;
}

.lyu-cart-toast__title {
  font-family: var(--lct-serif);
  font-size: 15px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: .005em;
  color: #101010;
  line-height: 1.15;
  margin: 0 0 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lyu-cart-toast__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(242, 5, 60, .25), transparent);
}

.lyu-cart-toast__item {
  font-size: 12.5px;
  color: #525a6b;
  line-height: 1.35;
  font-weight: 500;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/* ── CTA → /cart/ ───────────────────────────────────────────────────── */
.lyu-cart-toast__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px 9px 14px;
  background: var(--lct-grad);
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 6px 16px -4px rgba(242, 5, 60, .45);
  transition: transform .2s ease, box-shadow .2s ease;
  flex-shrink: 0;
  border: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.lyu-cart-toast__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transform: translateX(-110%);
  transition: transform .6s ease;
}

.lyu-cart-toast__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -6px rgba(242, 5, 60, .55);
  color: #fff !important;
}

.lyu-cart-toast__cta:hover::after {
  transform: translateX(110%);
}

.lyu-cart-toast__cta svg {
  transition: transform .2s ease;
}

.lyu-cart-toast__cta:hover svg {
  transform: translateX(2px);
}

/* ── Close button ───────────────────────────────────────────────────── */
.lyu-cart-toast__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: #9aa0ad;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.lyu-cart-toast__close:hover {
  background: rgba(242, 5, 60, .08);
  color: var(--lct-red);
  transform: rotate(90deg);
}

/* ── Auto-dismiss progress bar ──────────────────────────────────────── */
.lyu-cart-toast__progress {
  position: absolute;
  left: 5px;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--lct-grad);
  transform: scaleX(1);
  transform-origin: left center;
  opacity: .55;
  pointer-events: none;
}

.lyu-cart-toast.is-visible .lyu-cart-toast__progress {
  animation: lyu-toast-progress 4.2s linear forwards;
}

.lyu-cart-toast.is-paused .lyu-cart-toast__progress {
  animation-play-state: paused;
}

@keyframes lyu-toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ===========================================================================
   Mobile (≤480px) — denser, top of viewport, full-width minus margin
   =========================================================================== */
@media (max-width: 480px) {
  .lyu-cart-toast {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    width: calc(100vw - 16px);
    padding: 12px 14px 12px 18px;
    gap: 11px;
    border-radius: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .lyu-cart-toast__icon {
    width: 34px;
    height: 34px;
  }
  .lyu-cart-toast__title {
    font-size: 13.5px;
  }
  .lyu-cart-toast__item {
    font-size: 11.5px;
  }
  .lyu-cart-toast__cta {
    padding: 8px 10px;
    font-size: 10.5px;
    letter-spacing: .03em;
    gap: 4px;
  }
  .lyu-cart-toast__cta svg {
    width: 12px;
    height: 12px;
  }
  .lyu-cart-toast__close {
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
  }
  .lyu-cart-toast__close svg {
    width: 11px;
    height: 11px;
  }
}

/* ===========================================================================
   Hide the legacy WC notice once our toast is mounted in <body>
   =========================================================================== */
.woocommerce-message.lyu-cart-toast-host,
.woocommerce-notices-wrapper.lyu-cart-toast-host {
  display: none !important;
}

/* ===========================================================================
   Reduced motion: skip flourishes, keep clarity
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .lyu-cart-toast,
  .lyu-cart-toast__icon svg,
  .lyu-cart-toast__close,
  .lyu-cart-toast__cta,
  .lyu-cart-toast__cta::after,
  .lyu-cart-toast.is-visible .lyu-cart-toast__icon::after,
  .lyu-cart-toast.is-visible .lyu-cart-toast__progress {
    transition: opacity .2s linear !important;
    animation: none !important;
  }
}
