/* ==========================================================================
   Component: Toast — premium bottom-left notifications
   Glassmorphism + colored accent bar design
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Toast Container — stacks at bottom-left above footer
   --------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: calc(var(--footer-height) + var(--space-3));
  left: var(--space-3);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
  width: auto;
}

/* ---------------------------------------------------------------------------
   Individual Toast — glassmorphism card with left accent
   --------------------------------------------------------------------------- */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 18px;
  background: hsla(0, 0%, 10%, 0.82);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid hsla(0, 0%, 100%, 0.07);
  border-radius: 12px;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  animation: toast-enter 380ms cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
}

/* Left accent bar */
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--text-muted);
}

.toast.is-exiting {
  animation: toast-exit 200ms var(--ease-in) forwards;
}

/* ---------------------------------------------------------------------------
   Toast Icon
   --------------------------------------------------------------------------- */
.toast__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast__icon svg {
  width: 18px;
  height: 18px;
}

/* ---------------------------------------------------------------------------
   Toast Content
   --------------------------------------------------------------------------- */
.toast__content {
  flex: 1;
  min-width: 0;
}

.toast__message {
  font-size: 12px;
  font-weight: 500;
  color: hsla(0, 0%, 100%, 0.88);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 300px;
}

/* ---------------------------------------------------------------------------
   Toast Close Button
   --------------------------------------------------------------------------- */
.toast__close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsla(0, 0%, 100%, 0.25);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 150ms, color 150ms, background 150ms;
}

.toast__close svg {
  width: 10px;
  height: 10px;
}

.toast:hover .toast__close {
  opacity: 1;
}

.toast__close:hover {
  color: hsla(0, 0%, 100%, 0.7);
  background: hsla(0, 0%, 100%, 0.08);
}

/* ---------------------------------------------------------------------------
   Progress Bar
   --------------------------------------------------------------------------- */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 2px 0 0;
  opacity: 0.6;
  animation: toast-progress linear forwards;
  animation-duration: var(--toast-duration, 4000ms);
}

.toast:hover .toast__progress {
  animation-play-state: paused;
}

/* ---------------------------------------------------------------------------
   Variants — accent bar + icon color + glow
   --------------------------------------------------------------------------- */

/* Success */
.toast--success {
  box-shadow:
    0 4px 24px hsla(142, 60%, 30%, 0.15),
    0 0 0 1px hsla(142, 60%, 50%, 0.06);
}
.toast--success::before { background: var(--color-success); }
.toast--success .toast__icon { color: var(--color-success); }
.toast--success .toast__progress { background: var(--color-success); }

/* Error */
.toast--error {
  box-shadow:
    0 4px 24px hsla(0, 60%, 30%, 0.18),
    0 0 0 1px hsla(0, 60%, 50%, 0.06);
}
.toast--error::before { background: var(--color-error); }
.toast--error .toast__icon { color: var(--color-error); }
.toast--error .toast__message {
  white-space: normal;
  max-width: 300px;
}
.toast--error .toast__progress { background: var(--color-error); }

/* Warning */
.toast--warning {
  box-shadow:
    0 4px 24px hsla(32, 60%, 30%, 0.15),
    0 0 0 1px hsla(32, 60%, 50%, 0.06);
}
.toast--warning::before { background: var(--color-warning); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--warning .toast__progress { background: var(--color-warning); }

/* Info */
.toast--info {
  box-shadow:
    0 4px 24px hsla(210, 60%, 30%, 0.15),
    0 0 0 1px hsla(210, 60%, 50%, 0.06);
}
.toast--info::before { background: var(--color-info); }
.toast--info .toast__icon { color: var(--color-info); }
.toast--info .toast__progress { background: var(--color-info); }

/* ---------------------------------------------------------------------------
   Animations
   --------------------------------------------------------------------------- */
@keyframes toast-enter {
  from {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes toast-exit {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateX(-24px) scale(0.95);
    opacity: 0;
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ---------------------------------------------------------------------------
   Mobile
   --------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .toast-container {
    left: var(--space-2);
    right: var(--space-2);
    max-width: none;
  }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
    transform: none;
    opacity: 1;
  }
  .toast.is-exiting {
    animation: none;
    opacity: 0;
  }
  .toast__progress {
    animation: none;
    width: 0;
  }
}
