/**
 * Smart Library — Premium Toast Notifications
 * Glassmorphism, smooth animations, accessible
 */

:root {
  --sl-toast-bg: rgba(255, 255, 255, 0.92);
  --sl-toast-border: rgba(148, 163, 184, 0.25);
  --sl-toast-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  --sl-toast-success: #059669;
  --sl-toast-error: #dc2626;
  --sl-toast-warning: #d97706;
  --sl-toast-info: #319189;
}

.dark {
  --sl-toast-bg: rgba(15, 23, 42, 0.95);
  --sl-toast-border: rgba(71, 85, 105, 0.4);
  --sl-toast-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(51, 65, 85, 0.5) inset;
}

#sl-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: min(420px, calc(100vw - 48px));
  pointer-events: none;
}

#sl-toast-container[data-stack="top"] {
  bottom: auto;
  top: 24px;
}

.sl-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--sl-toast-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 16px;
  border: 1px solid var(--sl-toast-border);
  box-shadow: var(--sl-toast-shadow);
  animation: sl-toast-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: bottom right;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}

.sl-toast[data-exit] {
  animation: sl-toast-out 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes sl-toast-in {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sl-toast-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
}

.sl-toast-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.sl-toast-success .sl-toast-icon {
  background: rgba(5, 150, 105, 0.14);
  color: #059669;
}

.sl-toast-error .sl-toast-icon {
  background: rgba(220, 38, 38, 0.14);
  color: #dc2626;
}

.sl-toast-warning .sl-toast-icon {
  background: rgba(217, 119, 6, 0.14);
  color: #d97706;
}

.sl-toast-info .sl-toast-icon {
  background: rgba(49, 145, 137, 0.2);
  color: #319189;
}

.sl-toast-body {
  flex: 1;
  min-width: 0;
}

.sl-toast-title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.sl-toast-success .sl-toast-title { color: #047857; }
.dark .sl-toast-success .sl-toast-title { color: #34d399; }
.sl-toast-error .sl-toast-title { color: #b91c1c; }
.dark .sl-toast-error .sl-toast-title { color: #f87171; }
.sl-toast-warning .sl-toast-title { color: #b45309; }
.dark .sl-toast-warning .sl-toast-title { color: #fbbf24; }
.sl-toast-info .sl-toast-title { color: #0f766e; }
.dark .sl-toast-info .sl-toast-title { color: #5eead4; }

.sl-toast-message {
  font-weight: 600;
  color: #334155;
}

.dark .sl-toast-message {
  color: #94a3b8;
}

.sl-toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #64748b;
  transition: background 0.2s, color 0.2s;
}

.sl-toast-close:hover {
  background: rgba(148, 163, 184, 0.28);
  color: #0f172a;
}

.dark .sl-toast-close:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #f1f5f9;
}

/* Progress bar for auto-dismiss */
.sl-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.35;
  transform-origin: left;
  animation: sl-toast-progress 5s linear forwards;
}

.sl-toast[data-duration="short"] .sl-toast-progress { animation-duration: 3s; }
.sl-toast[data-duration="long"] .sl-toast-progress { animation-duration: 8s; }

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

@media (prefers-reduced-motion: reduce) {
  .sl-toast {
    animation: sl-toast-in-simple 0.25s ease-out forwards;
  }
  .sl-toast[data-exit] {
    animation: sl-toast-out-simple 0.2s ease-out forwards;
  }
  .sl-toast-progress {
    animation: none;
  }
}

@keyframes sl-toast-in-simple {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sl-toast-out-simple {
  from { opacity: 1; }
  to { opacity: 0; }
}
