/*
 * Wishlist (inc/wishlist.php, js/wishlist.js): heart buttons on cards and the product page,
 * My Account → Обране, and the toast. The palette and type follow the cart drawer:
 * Neue Haas Unica, 46px controls with 8px corners, tracked capitals, warm beige lines.
 */

:root {
  --ags-wl-dark: #201600;
  --ags-wl-gold: #C49564;
  --ags-wl-heart: #A97B4B;
  --ags-wl-accent: #8D6235;
  --ags-wl-text: #565049;
  --ags-wl-muted: #6F6A63;
  --ags-wl-border: #DCD3C3;
  --ags-wl-line: #E8E2D9;
  --ags-wl-tint: #F7F4EF;
}

/* Heart button */

.ags-wishlist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ags-wl-dark);
  border-radius: 8px;
  background: #fff;
  color: var(--ags-wl-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.ags-wishlist-btn:active {
  transform: scale(0.94);
}

.ags-wishlist-btn:focus-visible {
  outline: 2px solid var(--ags-wl-gold);
  outline-offset: 2px;
}

/* Everywhere the header's size (css/header.css, .site-header__svg) */
.ags-wishlist-btn__icon {
  display: block;
  width: 24px;
  height: 24px;
  overflow: visible;
}

/* The filled heart over the outline (inc/wishlist.php): shown when the product is in the list */
.ags-wishlist-btn__fill {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ags-wishlist-btn.woosw-added {
  color: var(--ags-wl-heart);
}

.ags-wishlist-btn.woosw-added .ags-wishlist-btn__fill {
  opacity: 1;
}

/* Set by js/wishlist.js right after adding, so hearts saved earlier do not pop on every page load. */
.ags-wishlist-btn.is-popped .ags-wishlist-btn__icon {
  animation: ags-wishlist-pop 0.35s ease;
}

.ags-wishlist-btn.woosw-adding {
  pointer-events: none;
}

.ags-wishlist-btn.woosw-adding .ags-wishlist-btn__icon {
  animation: ags-wishlist-pulse 0.8s ease-in-out infinite;
}

@keyframes ags-wishlist-pop {
  50% { transform: scale(1.18); }
}

@keyframes ags-wishlist-pulse {
  50% { opacity: 0.35; }
}

/* On a card: a frosted circle in the photo's top right corner. */
ul.products li.product .ags-wishlist-btn--card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ags-wl-dark);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

ul.products li.product .ags-wishlist-btn--card.woosw-added {
  color: var(--ags-wl-heart);
}

@media (hover: hover) {
  ul.products li.product .ags-wishlist-btn--card:hover {
    background: #fff;
  }
}

/* On the product page: round, in the top right corner of the summary (the title leaves room for it). */
.single-product .summary .ags-wishlist-btn--single {
  position: absolute;
  top: 10px;
  right: 0;
  z-index: 3;
  width: 46px;
  height: 46px;
  border-color: #e2e2e2;
  border-radius: 50%;
}

/* Header link: the icon and count come from css/header.css (.site-header__icon, .cart-count). */

/* Toast */

.ags-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100001;
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--ags-wl-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(32, 22, 0, 0.14);
  color: var(--ags-wl-dark);
  font-family: 'Neue Haas Unica', sans-serif;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity var(--ags-pop-close, 0.2s) var(--ags-ease-close, ease),
    transform var(--ags-pop-close, 0.2s) var(--ags-ease-close, ease),
    visibility 0s linear var(--ags-pop-close, 0.2s);
}

/* Motion tokens in css/pages.css, as the chat card. */
.ags-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--ags-pop-open, 0.3s) var(--ags-ease, ease-out), transform var(--ags-pop-open, 0.3s) var(--ags-ease, ease-out);
}

.ags-toast__image {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--ags-wl-tint);
  object-fit: contain;
}

.ags-toast__body {
  flex: 1 1 auto;
  min-width: 0;
}

.ags-toast__title {
  font-size: 15px;
  line-height: 1.3;
}

.ags-toast__text {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ags-wl-muted);
  font-size: 13px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ags-toast__action {
  flex: 0 0 auto;
  padding: 8px 4px;
  color: var(--ags-wl-accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.ags-toast__action:hover,
.ags-toast__action:focus-visible {
  color: var(--ags-wl-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ags-toast__close {
  position: relative;
  flex: 0 0 28px;
  align-self: flex-start;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ags-wl-muted);
  cursor: pointer;
}

.ags-toast__close:hover {
  background: var(--ags-wl-tint);
  color: var(--ags-wl-dark);
}

.ags-toast__close::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("../img/ph/x.svg") center / contain no-repeat;
  mask: url("../img/ph/x.svg") center / contain no-repeat;
  transform: translate(-50%, -50%);
}

.ags-toast [hidden] {
  display: none;
}

/* Phones: the action moves under the text, so the title keeps the full width. */
@media screen and (max-width: 599px) {
  .ags-toast {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    grid-template-areas:
      'body close'
      'action close';
    align-items: start;
    gap: 2px 12px;
    width: auto;
  }

  .ags-toast--image {
    grid-template-columns: 56px minmax(0, 1fr) 28px;
    grid-template-areas:
      'image body close'
      'image action close';
  }

  .ags-toast__image {
    grid-area: image;
    align-self: center;
  }

  .ags-toast__body {
    grid-area: body;
  }

  .ags-toast__action {
    grid-area: action;
    justify-self: start;
    padding: 6px 0 2px;
  }

  .ags-toast__close {
    grid-area: close;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ags-toast,
  .ags-toast.is-visible {
    transform: none;
  }

  .ags-wishlist-btn.is-popped .ags-wishlist-btn__icon,
  .ags-wishlist-btn.woosw-adding .ags-wishlist-btn__icon {
    animation: none;
  }
}
