/* ==========================================================================
   AIRH Toast Notifications — Futuristic Neumorphism
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Toast Container
   --------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - var(--space-8));
}

.toast-container--bottom-right {
  bottom: var(--space-6);
  right: var(--space-6);
}

.toast-container--top-right {
  top: var(--space-6);
  right: var(--space-6);
}

/* ---------------------------------------------------------------------------
   Toast Item — Raised neumorphic
   --------------------------------------------------------------------------- */
.toast {
  display: flex;
  align-items: stretch;
  background: var(--color-bg-primary);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-raised-lg);
  pointer-events: auto;
  overflow: hidden;
  transform: translateX(100%);
  opacity: 0;
  animation: toastSlideIn var(--transition-panel) forwards;
  position: relative;
}

.toast.is-exiting {
  animation: toastSlideOut var(--transition-base) forwards;
}

/* ---------------------------------------------------------------------------
   Color Bar (left) — Gradient
   --------------------------------------------------------------------------- */
.toast__bar {
  width: 4px;
  flex-shrink: 0;
  border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.toast--success .toast__bar { background: linear-gradient(180deg, var(--color-success), #10b981); }
.toast--error .toast__bar { background: linear-gradient(180deg, #ef4444, #dc2626); }
.toast--warning .toast__bar { background: linear-gradient(180deg, var(--color-warning), #f59e0b); }
.toast--info .toast__bar { background: linear-gradient(180deg, var(--color-info), var(--color-accent)); }

/* ---------------------------------------------------------------------------
   Toast Content
   --------------------------------------------------------------------------- */
.toast__content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  min-width: 0;
}

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast--success .toast__icon { color: var(--color-success); }
.toast--error .toast__icon { color: var(--color-error); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--info .toast__icon { color: var(--color-info); }

.toast__text { flex: 1; min-width: 0; }

.toast__title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: var(--leading-snug);
}

.toast__message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  line-height: var(--leading-normal);
}

.toast__action {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.toast__action:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Close Button — Neumorphic
   --------------------------------------------------------------------------- */
.toast__close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  margin: var(--space-2) var(--space-2) 0 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toast__close:hover {
  box-shadow: var(--neu-inset-sm);
  color: var(--color-text-primary);
}

/* ---------------------------------------------------------------------------
   Auto-dismiss Progress Bar
   --------------------------------------------------------------------------- */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 0 var(--radius-lg);
  animation: toastProgress linear forwards;
}

.toast--success .toast__progress { background: var(--color-success); opacity: 0.4; }
.toast--error .toast__progress { background: var(--color-error); opacity: 0.4; }
.toast--warning .toast__progress { background: var(--color-warning); opacity: 0.4; }
.toast--info .toast__progress { background: var(--color-info); opacity: 0.4; }

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ---------------------------------------------------------------------------
   Animations
   --------------------------------------------------------------------------- */
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ---------------------------------------------------------------------------
   Mobile
   --------------------------------------------------------------------------- */
@media (max-width: 639px) {
  .toast-container,
  .toast-container--bottom-right,
  .toast-container--top-right {
    top: var(--space-4);
    bottom: auto;
    right: var(--space-4);
    left: var(--space-4);
    max-width: 100%;
    width: auto;
  }

  .toast {
    transform: translateY(-100%);
    animation-name: toastSlideInMobile;
  }

  .toast.is-exiting {
    animation-name: toastSlideOutMobile;
  }

  @keyframes toastSlideInMobile {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  @keyframes toastSlideOutMobile {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
  }
}
