/* ============================================
   TOAST.CSS — Système de notifications
   Stackable, bas droite, 3 max
   ============================================ */

/* ── Conteneur ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none; /* les toasts individuels réactivent pointer-events */
}

/* ── Toast de base ── */
.toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 280px;
  max-width: 380px;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-primary);
  line-height: 1.5;

  /* Entrée */
  animation: toast-in 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── Variantes ── */
.toast.success { border-left: 2px solid #4ade80; }
.toast.error   { border-left: 2px solid var(--danger); }
.toast.warning { border-left: 2px solid #fbbf24; }
.toast.info    { border-left: 2px solid var(--accent); }

/* ── Icône ── */
.toast-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.toast.success .toast-icon { color: #4ade80; }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: #fbbf24; }
.toast.info    .toast-icon { color: var(--accent); }

/* ── Contenu ── */
.toast-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.toast-title {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-primary);
}

.toast-msg {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── Bouton fermer ── */
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  font-size: 0.9rem;
  transition: color var(--transition);
  margin-top: 1px;
}

.toast-close:hover {
  color: var(--text-secondary);
}

/* ── Barre de progression ── */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  animation: toast-progress linear both;
}

.toast { position: relative; overflow: hidden; }

.toast.success .toast-progress { background: #4ade80; }
.toast.error   .toast-progress { background: var(--danger); }
.toast.warning .toast-progress { background: #fbbf24; }
.toast.info    .toast-progress { background: var(--accent); }

/* ── Animations ── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
    max-height: 100px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(16px);
    max-height: 0;
    margin-bottom: -0.5rem;
  }
}

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

.toast.removing {
  animation: toast-out 250ms cubic-bezier(0.4, 0, 0.2, 1) both;
}