/* Por encima de modales (.workflow-modal-overlay ~10000, confirmación ~11000)
   para que backdrop-filter no difumine ni tape los toasts */
.toast-stack-container {
  position: fixed;
  inset: 0;
  z-index: 20050;
  pointer-events: none;
  overflow: visible;
}

.toast-stack-container .toast {
  pointer-events: auto;
  z-index: 20051;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-size: 0.95rem;
  z-index: 20050;
  opacity: 0;
  transition: opacity 0.4s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 320px;
  max-width: 320px;
  min-width: 320px;
  box-sizing: border-box;
  min-height: 48px;
  overflow: hidden;
}
  
  .toast.show {
    opacity: 0.95;
  }
  
  .toast-success { background: #2ecc71; }
  .toast-error   { background: #e74c3c; }
  .toast-warning { background: #f39c12; }
  .toast-info    { background: #3498db; }
  
  .toast.fade-out {
    opacity: 0;
    pointer-events: none;
  }
  
  .toast-link {
    color: white;
    text-decoration: underline;
    font-weight: bold;
    margin-top: 0.5rem;
    font-size: 0.9em;
    display: block;
  }
  
  .toast-link:hover {
  color: #e0e0e0;
}

/* Estilos para botones de toast */
.toast-expand-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  white-space: nowrap;
  position: absolute;
  top: 6px;
  right: 32px;
}

.toast-expand-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.toast-expand-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.toast-close-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.toast-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Estilos para el contenido del toast */
.toast-content {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  word-wrap: break-word;
  line-height: 1.3;
  padding-right: 85px;
  flex: 1;
  min-height: 0;
}

.toast-message {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Cuando está expandido, dar más espacio para evitar solapamiento */
.toast.expanded {
  padding: 0.75rem 1.5rem 1rem 1.5rem;
}

.toast.expanded .toast-content {
  padding-right: 95px;
}

/* Asegurar que el toast expandido mantenga su ancho */
.toast.expanded {
  width: 320px !important;
  max-width: 320px !important;
  min-width: 320px !important;
}

/* Estilos específicos para contenido expandido */
.toast.expanded .toast-message {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Barra de progreso moderna en el borde superior */
.toast-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
  border-radius: 8px 8px 0 0;
  transition: width linear;
  z-index: 2;
  box-shadow: 
    0 1px 3px rgba(255, 255, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Efectos adicionales cuando el toast tiene hover */
.toast.hovered .toast-progress-bar {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5));
  box-shadow: 
    0 1px 2px rgba(255, 255, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
  