/* =========================================================
   Toast unificado — diseño inspirado en .task-item.active
   de tasks_individuales.html. Fondo var(--btn-new-bg),
   ícono circular blanco a la izquierda, tipografía clara.
   ========================================================= */

:root {
  --zp-toast-bg: var(--btn-new-bg, #4735a1);
  --zp-toast-fg: #ffffff;
  --zp-toast-fg-soft: rgba(255, 255, 255, 0.85);
  --zp-toast-fg-muted: rgba(255, 255, 255, 0.65);
  --zp-toast-badge-bg: rgba(255, 255, 255, 0.2);
  --zp-toast-radius: 8px;

  --zp-toast-icon-success: #10B981;
  --zp-toast-icon-error:   #DC2626;
  --zp-toast-icon-warning: #D97706;
  --zp-toast-icon-info:    var(--btn-new-bg, #4735a1);
}

/* ======== Container (esquina inferior izquierda) ======== */
.zp-toast-container {
  position: fixed;
  bottom: 24px;
  left: 80px;
  z-index: 999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 92vw;
}

/* ======== Toast base ======== */
.zp-toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  min-width: 320px;
  max-width: 440px;
  border-radius: var(--zp-toast-radius);
  background: var(--zp-toast-bg);
  color: var(--zp-toast-fg);
  box-shadow: 0 12px 28px -8px rgba(71, 53, 161, 0.45),
              0 4px 10px -4px rgba(0, 0, 0, 0.18);
  animation: zpToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.zp-toast:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px -8px rgba(71, 53, 161, 0.55),
              0 6px 14px -4px rgba(0, 0, 0, 0.22);
}
.zp-toast.zp-toast--hide { animation: zpToastOut 0.22s ease-in forwards; }

/* ======== Ícono circular blanco (como .task-channel-icon en active) ======== */
.zp-toast__icon {
  width: 29px;
  height: 29px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111827;
}
.zp-toast__icon svg { width: 17px; height: 17px; fill: currentColor; }
.zp-toast__icon .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
  line-height: 1;
  color: currentColor;
}
.zp-toast__icon--spin svg,
.zp-toast__icon--spin .material-symbols-outlined {
  animation: zpToastSpin 2s ease-in-out infinite;
}

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

/* ======== Contenido (título + mensaje apilados, como task-content) ======== */
.zp-toast__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zp-toast__title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--zp-toast-fg);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zp-toast__message {
  font-size: 0.78rem;
  color: var(--zp-toast-fg-soft);
  line-height: 1.35;
  margin: 0;
  word-wrap: break-word;
}

/* Toast sin título: el mensaje toma el protagonismo */
.zp-toast--no-title .zp-toast__message {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--zp-toast-fg);
}

/* Badge opcional de tipo (como .overdue-badge en active) */
.zp-toast__type-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--zp-toast-badge-bg);
  color: var(--zp-toast-fg-soft);
  margin-bottom: 2px;
}

/* Link inline (para casos como "Ir a Mis Tareas") */
.zp-toast__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--zp-toast-fg);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.zp-toast__link:hover { color: var(--zp-toast-fg); opacity: 0.85; }

/* CTA — pequeña pista de acción bajo el mensaje (ej. "Ver en Tareas →") */
.zp-toast__cta {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--zp-toast-fg);
  opacity: 0.92;
  letter-spacing: 0.01em;
}

/* Toast clickeable (cuando se pasa href) */
.zp-toast--clickable { cursor: pointer; }
.zp-toast--clickable:hover .zp-toast__cta { text-decoration: underline; }

/* ======== Botón cerrar (×) ======== */
.zp-toast__close {
  flex-shrink: 0;
  align-self: flex-start;
  background: transparent;
  border: 0;
  padding: 2px 4px;
  margin: -4px -4px 0 0;
  cursor: pointer;
  color: var(--zp-toast-fg-muted);
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s;
}
.zp-toast__close:hover { color: var(--zp-toast-fg); }

/* ======== Acciones / botones iziToast (al costado derecho, como .t-amount) ======== */
.zp-toast__actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  align-self: center;
  margin-left: 4px;
}
.zp-toast__action a,
.zp-toast__action button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  background: #ffffff;
  color: var(--zp-toast-bg) !important;
  border: 0;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.zp-toast__action a:hover,
.zp-toast__action button:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* ======== Barra de progreso ======== */
.zp-toast__progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.55);
  transform-origin: left center;
  animation: zpToastProgress linear forwards;
}
/* Progreso manual (controlado por JS, no auto-countdown) */
.zp-toast__progress--manual {
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  animation: none !important;
  transform: scaleX(0);
}
.zp-toast.success .zp-toast__progress--manual { background: rgba(255, 255, 255, 0.25); }
.zp-toast.warning .zp-toast__progress--manual { background: rgba(255, 255, 255, 0.25); }

/* ======== Animaciones ======== */
@keyframes zpToastIn {
  from { opacity: 0; transform: translateX(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes zpToastOut {
  to { opacity: 0; transform: translateX(-8px) scale(0.98); }
}
@keyframes zpToastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
@keyframes zpToastSpin {
  0%   { transform: rotate(0deg); }
  50%  { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

/* ======== Mobile ======== */
@media (max-width: 520px) {
  .zp-toast { min-width: 0; width: 100%; }
  .zp-toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
