/**
 * EPF Toast Notifications
 * Bottom toast for favorites add/remove feedback
 */

/* Toast container - fixed at bottom, centered */
#epf-toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100000; /* Below MVP bar (999999) but above cart popup (99999) */
  pointer-events: none;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  /* Dynamic offset for MVP bar - set via JS */
  --epf-toast-offset: 24px;
  padding-bottom: var(--epf-toast-offset);
}

/* Toast element */
.epf-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1a1a;
  color: #fff;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 14px;
  line-height: 1.4;
  max-width: 400px;
  width: auto;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.epf-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Toast message */
.epf-toast__message {
  flex: 1;
  min-width: 0;
}

/* Toast CTA link */
.epf-toast__link {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.epf-toast__link:hover,
.epf-toast__link:focus {
  opacity: 0.8;
  color: #fff;
}

/* Toast close button */
.epf-toast__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.epf-toast__close:hover,
.epf-toast__close:focus {
  background: rgba(255, 255, 255, 0.25);
  outline: none;
}

.epf-toast__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Toast variants */
.epf-toast--success {
  background: #1a1a1a;
}

.epf-toast--error {
  background: #b91c1c;
}

/* Mobile: full width with safe area */
@media (max-width: 980px) {
  #epf-toast-root {
    padding-left: 12px;
    padding-right: 12px;
    /* iOS safe area */
    padding-bottom: calc(var(--epf-toast-offset) + env(safe-area-inset-bottom, 0px));
  }

  .epf-toast {
    max-width: none;
    width: 100%;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
  }

  .epf-toast__link {
    font-size: 13px;
  }
}

/* Ensure toast doesn't get hidden behind MVP bar */
body.ep-mvp-sticky-active #epf-toast-root {
  --epf-toast-offset: calc(var(--ep-mvp-h, 78px) + 16px);
}

/* PDP (single-product) has taller sticky bar with Frame/Size + Add to Cart rows */
/* Add extra offset to ensure toast appears above these elements */
@media (max-width: 980px) {
  body.single-product.ep-mvp-sticky-active #epf-toast-root {
    --epf-toast-offset: calc(var(--ep-mvp-h, 140px) + 24px);
  }
}

/* Hide toast when share modal is open (avoid stacking) */
body.ep-share-open #epf-toast-root {
  display: none;
}
