/* ==========================================================================
   TP TOAST — modern notification system
   Stack of slide-in cards, auto-dismiss with progress bar, types: success,
   error, warning, info. Responsive & theme-aware.
   ========================================================================== */

#tp-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 36px);
  width: 380px;
  pointer-events: none;
}

.tp-toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 64px;
  background: linear-gradient(135deg, rgba(28, 32, 44, 0.96), rgba(22, 26, 38, 0.96));
  color: #fff;
  border-radius: 14px;
  box-shadow:
    0 18px 40px -12px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  transform: translateX(420px);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease;
}
.tp-toast.tp-toast-show {
  transform: translateX(0);
  opacity: 1;
}
.tp-toast.tp-toast-hide {
  transform: translateX(420px);
  opacity: 0;
}

/* Left accent bar (per-type color) */
.tp-toast-accent {
  width: 5px;
  flex-shrink: 0;
  background: var(--tp-toast-color, #3498db);
}

/* Icon block */
.tp-toast-icon {
  width: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--tp-toast-color, #3498db) 16%, transparent);
  color: var(--tp-toast-color, #3498db);
}
.tp-toast-icon svg {
  width: 24px;
  height: 24px;
}

/* Body */
.tp-toast-body {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}
.tp-toast-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--tp-toast-color, #3498db);
  margin: 0;
  line-height: 1.2;
}
.tp-toast-message {
  font-size: 14px;
  font-weight: 500;
  color: #f1f3f8;
  margin: 0;
  line-height: 1.35;
  word-wrap: break-word;
}

/* Close button */
.tp-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.18s ease;
}
.tp-toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.tp-toast-close svg { width: 14px; height: 14px; }

/* Progress bar */
.tp-toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--tp-toast-color, #3498db);
  transform-origin: left center;
  animation: tp-toast-progress-shrink linear forwards;
  opacity: 0.75;
}
@keyframes tp-toast-progress-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Type-specific colors (driven via CSS var so structure stays identical) */
.tp-toast-success { --tp-toast-color: #1ecb78; }
.tp-toast-error   { --tp-toast-color: #ef4f4f; }
.tp-toast-warning { --tp-toast-color: #f5a623; }
.tp-toast-info    { --tp-toast-color: #3da0ff; }

/* Transaction announcement variant — fatter, centered at top */
.tp-toast.tp-toast-transaction {
  min-height: 72px;
  background: linear-gradient(135deg, #0f2f20, #0a1c14);
  box-shadow:
    0 22px 52px -14px rgba(30, 203, 120, 0.45),
    0 0 0 1px rgba(30, 203, 120, 0.25);
}
.tp-toast.tp-toast-transaction .tp-toast-title {
  font-size: 11px;
  color: #6de3a7;
}
.tp-toast.tp-toast-transaction .tp-toast-message {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #ffffff;
}

/* Responsive: on small screens, pin to full width at top */
@media (max-width: 600px) {
  #tp-toast-stack {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }
  .tp-toast {
    transform: translateY(-120%);
  }
  .tp-toast.tp-toast-show { transform: translateY(0); }
  .tp-toast.tp-toast-hide { transform: translateY(-120%); }
  .tp-toast-icon { width: 46px; }
  .tp-toast-icon svg { width: 20px; height: 20px; }
  .tp-toast-message { font-size: 13px; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tp-toast { transition: opacity 0.2s ease; transform: none !important; }
  .tp-toast-progress { animation: none; }
}
