/* CSS/toast.css - Toasts premium (dark UI) */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
  width: 360px;
  max-width: calc(100% - 48px);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(22,16,30,0.78), rgba(12,8,18,0.7));
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 10px 30px rgba(4,4,10,0.6);
  color: #eef0f6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  font-size: 14px;
  line-height: 1.2;
  transform-origin: right top;
  opacity: 0;
  transform: translateX(24px) scale(0.995);
  animation: toast-in 360ms cubic-bezier(.2,.9,.3,1) forwards;
  overflow: hidden;
  position: relative;
  will-change: transform, opacity;
}

.toast__icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.toast__icon svg { width: 22px; height: 22px; display: block; }

.toast__content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast__title { font-weight: 600; color: #ffffff; font-size: 13px; }
.toast__message { color: rgba(238,240,246,0.9); font-size: 13px; min-width: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

.toast__close {
  background: none;
  border: none;
  color: rgba(238,240,246,0.7);
  cursor: pointer;
  padding: 6px;
  margin-left: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.toast__close:hover { color: #fff; background: rgba(255,255,255,0.02); }

.toast--success { border-left: 4px solid #8b5cf6; }
.toast--error   { border-left: 4px solid #ef4444; }
.toast--warning { border-left: 4px solid #f59e0b; }

/* Microinteracciones */
.toast:hover {
  transform: translateX(0) scale(1.01);
  box-shadow: 0 14px 40px rgba(8,8,16,0.65);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(0.995); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(18px) scale(0.995); }
}

/* exit animation helper */
.toast--exiting {
  animation: toast-out 260ms cubic-bezier(.3,.0,.2,1) forwards;
}

/* Barra de progreso (vida del toast) */
.toast__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  animation-name: toast-progress-shrink;
  animation-timing-function: linear;
  animation-duration: var(--toast-duration, 3500ms);
  animation-fill-mode: forwards;
}
.toast--success .toast__progress { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }
.toast--error   .toast__progress { background: linear-gradient(90deg, #fca5a5, #ef4444); }
.toast--warning .toast__progress { background: linear-gradient(90deg, #fde68a, #f59e0b); }

@keyframes toast-progress-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Pausar barra al interactuar */
.toast:hover .toast__progress,
.toast:focus-within .toast__progress {
  animation-play-state: paused;
}

/* Responsiveness */
@media (max-width:420px) {
  #toast-container { left: 12px; right: 12px; top: 18px; width: auto; }
  .toast { padding: 10px; gap: 10px; }
  .toast__icon { width: 40px; height: 40px; min-width: 40px; }
}
