/**
 * Toast/Notification System
 * Provides a unified toast notification UI for the InterviewPrep platform.
 * Toast types: success, info, warning, xp
 */

/* ── Container ─────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 400px;
  width: calc(100% - 2rem);
}

/* ── Individual Toast ──────────────────────────────────────────────────────── */

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  border-radius: 0.5rem;
  border-left: 4px solid transparent;
  width: 100%;
  max-width: 400px;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transform: translateY(1rem);
  animation: toast-slide-in 0.3s ease forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.toast--dismissing {
  opacity: 0;
  transform: translateY(-0.5rem);
  pointer-events: none;
}

/* ── Slide-in Animation ────────────────────────────────────────────────────── */

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Reduced Motion ────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.15s ease;
  }

  .toast.toast--dismissing {
    opacity: 0;
    transform: translateY(0);
  }
}

/* ── Toast Icon ────────────────────────────────────────────────────────────── */

.toast__icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

/* ── Toast Body ────────────────────────────────────────────────────────────── */

.toast__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.toast__message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}

.toast__sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin: 0;
}

/* ── Toast Dismiss Button ──────────────────────────────────────────────────── */

.toast__dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.toast__dismiss:hover {
  opacity: 1;
}

/* ── Type: Success ─────────────────────────────────────────────────────────── */

.toast--success {
  border-left-color: var(--status-success);
}

.toast--success .toast__icon {
  color: var(--status-success);
}

/* ── Type: Info ────────────────────────────────────────────────────────────── */

.toast--info {
  border-left-color: var(--status-info);
}

.toast--info .toast__icon {
  color: var(--status-info);
}

/* ── Type: Warning ─────────────────────────────────────────────────────────── */

.toast--warning {
  border-left-color: var(--status-warning);
}

.toast--warning .toast__icon {
  color: var(--status-warning);
}

/* ── Type: XP ──────────────────────────────────────────────────────────────── */

.toast--xp {
  border-left-color: var(--xp-purple);
}

.toast--xp .toast__icon {
  color: var(--xp-purple);
}

.toast--xp .toast__message {
  font-weight: 700;
  color: var(--xp-purple);
}

/* ── Mobile Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .toast-container {
    max-width: none;
    width: calc(100% - 2rem);
  }

  .toast {
    max-width: none;
  }
}
