/* =========================================================
   STUDYTASK TOAST SYSTEM
   Glassmorphism • Smooth Animations • Fixed Positioning
========================================================= */

.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 3rem);
}

.toast {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toast-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.toast.hiding {
  animation: toast-out 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-content {
  flex-grow: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0.6;
  transition: var(--transition);
  background: none;
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
}

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

/* Tipos de Toast */
.toast-success .toast-icon {
  color: var(--success);
}
.toast-error .toast-icon {
  color: var(--danger);
}
.toast-warning .toast-icon {
  color: var(--warning);
}
.toast-info .toast-icon {
  color: var(--primary);
}

/* Barra de Progresso */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: hsla(var(--h-primary), var(--s-primary), var(--l-primary), 0.2);
  transform-origin: left;
}

.toast-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--primary);
  transform-origin: left;
}

.toast-success .toast-progress-fill {
  background: var(--success);
}
.toast-error .toast-progress-fill {
  background: var(--danger);
}
.toast-warning .toast-progress-fill {
  background: var(--warning);
}

/* Animações */
@keyframes toast-in {
  from {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes toast-out {
  from {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .toast-container {
    top: auto;
    bottom: 1.5rem;
    right: 1.5rem;
    left: 1.5rem;
    width: auto;
    max-width: none;
  }

  @keyframes toast-in {
    from {
      transform: translateY(100%) scale(0.9);
      opacity: 0;
    }
    to {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
  }

  @keyframes toast-out {
    from {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
    to {
      transform: translateY(100%) scale(0.9);
      opacity: 0;
    }
  }
}
