/* ============================================================
   toast.css — Composant de notification toast
   ProjetRencontre LGBT+ Premium
   ============================================================ */

/* ── Conteneur principal (coin haut droit) ─────────────────────────────── */
#toast-container {
  position: fixed;
  /* Bas-droite : évite la collision avec le header fixe (0–80px) et reste
     cohérent avec le mobile (toasts en bas). */
  top: auto;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

/* ── Toast de base ──────────────────────────────────────────────────────── */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  overflow: hidden;

  /* Animation d'entrée */
  animation: toast-slide-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.toast--hiding {
  animation: toast-slide-out 0.3s ease forwards;
}

/* Barre de progression en bas du toast */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 12px 12px;
  animation: toast-progress linear forwards;
}

/* ── Icône ──────────────────────────────────────────────────────────────── */
.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  margin-top: 1px;
}

/* ── Corps ──────────────────────────────────────────────────────────────── */
.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 2px;
  color: inherit;
}

.toast__message {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
  color: inherit;
  opacity: 0.85;
  word-break: break-word;
}

/* ── Bouton fermeture ───────────────────────────────────────────────────── */
.toast__close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  color: inherit;
  font-size: 14px;
  line-height: 18px;
  padding: 0;
  transition: opacity 0.15s;
  margin-top: 1px;
}
.toast__close:hover {
  opacity: 1;
}

/* ── Variantes ──────────────────────────────────────────────────────────── */

/* Succès */
.toast--success {
  background: rgba(29, 209, 161, 0.12);
  border-color: rgba(29, 209, 161, 0.35);
  color: #1dd1a1;
}
.toast--success .toast__progress {
  background: #1dd1a1;
}

/* Erreur */
.toast--error {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.35);
  color: #ff6b6b;
}
.toast--error .toast__progress {
  background: #ff6b6b;
}

/* Avertissement */
.toast--warning {
  background: rgba(254, 202, 87, 0.12);
  border-color: rgba(254, 202, 87, 0.35);
  color: #feca57;
}
.toast--warning .toast__progress {
  background: #feca57;
}

/* Info */
.toast--info {
  background: rgba(84, 160, 255, 0.12);
  border-color: rgba(84, 160, 255, 0.35);
  color: #54a0ff;
}
.toast--info .toast__progress {
  background: #54a0ff;
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 120px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    max-height: 0;
    margin-bottom: -10px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

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

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  #toast-container {
    top: auto;
    bottom: calc(70px + env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  @keyframes toast-slide-in {
    from {
      opacity: 0;
      transform: translateY(20px) scale(0.97);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes toast-slide-out {
    from {
      opacity: 1;
      transform: translateY(0) scale(1);
      max-height: 120px;
    }
    to {
      opacity: 0;
      transform: translateY(20px) scale(0.97);
      max-height: 0;
      padding-top: 0;
      padding-bottom: 0;
    }
  }
}
