/* Toast Container */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

/* Toast individual */
.toast {
  min-width: 300px;
  max-width: 400px;
  padding: 14px 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
  font-family: var(--sans);
}

.toast.removing {
  animation: slideOutRight 0.3s ease-in forwards;
}

/* Variantes : on garde le background du menu, seul le bord et la couleur d'accent changent */
.toast-success { border-left-color: var(--success-text); }
.toast-success .toast-icon { color: var(--success-text); }

.toast-error { border-left-color: var(--error-text); }
.toast-error .toast-icon { color: var(--error-text); }

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

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

/* Icônes */
.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-2);
  opacity: 0.7;
  padding: 0;
  margin-left: 8px;
  transition: opacity 120ms;
}

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

/* Toast confirm — 2 boutons d'action, pas d'auto-dismiss */
.toast-confirm {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  border-left-color: var(--warning-text);
  min-width: 340px;
  max-width: 440px;
}

.toast-confirm .toast-confirm-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-confirm .toast-icon {
  color: var(--warning-text);
}

.toast-confirm .toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.toast-confirm .toast-action {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.toast-confirm .toast-action:hover {
  background: color-mix(in oklab, var(--text) 6%, transparent);
}

.toast-confirm .toast-action--confirm {
  color: var(--error-text);
  border-color: color-mix(in oklab, var(--error-text) 40%, var(--border));
}

.toast-confirm .toast-action--confirm:hover {
  background: var(--error-text);
  color: #fff;
  border-color: var(--error-text);
}

.toast-confirm .toast-action:focus-visible {
  outline: 2px solid var(--info-text);
  outline-offset: 2px;
}

/* Animations */
@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .toast-container {
    left: 20px;
    right: 20px;
    top: 70px;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.removing {
    animation: none;
  }
}
