/* ==========================================================================
   SILEO NOTIFICATION SYSTEM (Vanilla CSS)
   Estética física de resorte (spring physics), cápsula/píldora y glassmorphism.
   ========================================================================== */

#sileo-toaster {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: 480px;
}

@media (max-width: 640px) {
  #sileo-toaster {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: 100%;
    align-items: center;
  }
}

.sileo-toast {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 14px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  box-shadow:
    0 10px 30px -5px rgba(0, 0, 0, 0.5),
    0 4px 12px -2px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: default;
  user-select: none;
  transform-origin: top center;
  animation: sileo-spring-enter 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
  overflow: hidden;
  max-width: 100%;
}

.sileo-toast:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 14px 34px -4px rgba(0, 0, 0, 0.6),
    0 6px 14px -2px rgba(0, 0, 0, 0.35),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.25);
}

.sileo-toast.sileo-dismissing {
  animation: sileo-spring-leave 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* --- ÍCONO Y BADGES --- */
.sileo-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sileo-icon-wrapper svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* Tipos de toasts con colores de halo */
.sileo-toast.sileo-success {
  border-color: rgba(16, 185, 129, 0.35);
}
.sileo-toast.sileo-success .sileo-icon-wrapper {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.sileo-toast.sileo-error {
  border-color: rgba(244, 63, 94, 0.35);
}
.sileo-toast.sileo-error .sileo-icon-wrapper {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.5);
}

.sileo-toast.sileo-warning {
  border-color: rgba(245, 158, 11, 0.35);
}
.sileo-toast.sileo-warning .sileo-icon-wrapper {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.sileo-toast.sileo-info {
  border-color: rgba(14, 165, 233, 0.35);
}
.sileo-toast.sileo-info .sileo-icon-wrapper {
  background: rgba(14, 165, 233, 0.2);
  color: #0ea5e9;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.5);
}

.sileo-toast.sileo-loading .sileo-icon-wrapper {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

/* Spinner animado */
.sileo-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: sileo-spin 0.75s linear infinite;
}

/* --- CUERPO DEL MENSAJE --- */
.sileo-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sileo-title {
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  letter-spacing: -0.2px;
  word-break: break-word;
}

.sileo-desc {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
  line-height: 1.35;
  word-break: break-word;
}

/* --- BOTÓN CERRAR --- */
.sileo-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  margin-left: 6px;
  border-radius: 50%;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
  line-height: 1;
}

.sileo-close-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.1);
}

.sileo-close-btn svg {
  width: 13px;
  height: 13px;
  display: block;
}

/* --- BARRA DE PROGRESO DE AUTO-DISMISS --- */
.sileo-progress {
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.sileo-progress-bar {
  height: 100%;
  width: 100%;
  background: rgba(255, 255, 255, 0.4);
  transform-origin: left center;
  animation: sileo-progress linear forwards;
}

.sileo-toast.sileo-success .sileo-progress-bar { background: #10b981; }
.sileo-toast.sileo-error .sileo-progress-bar { background: #f43f5e; }
.sileo-toast.sileo-warning .sileo-progress-bar { background: #f59e0b; }
.sileo-toast.sileo-info .sileo-progress-bar { background: #0ea5e9; }

/* Pausar progreso al hacer hover */
.sileo-toast:hover .sileo-progress-bar {
  animation-play-state: paused;
}

/* --- ANIMACIONES CON SPRING PHYSICS --- */
@keyframes sileo-spring-enter {
  0% {
    opacity: 0;
    transform: translateY(-24px) scale(0.85);
  }
  60% {
    opacity: 1;
    transform: translateY(4px) scale(1.03);
  }
  85% {
    transform: translateY(-2px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sileo-spring-leave {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 80px;
  }
  100% {
    opacity: 0;
    transform: translateY(-16px) scale(0.9);
    max-height: 0;
    margin-bottom: -10px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

@keyframes sileo-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sileo-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
