/* ──────────────────────────────────────────────────────────────
   ÓNIX · TOASTS (desde cero)
   - Fila única, centrado vertical real
   - Colores sólidos (light/dark)
   - Slide-in/out por la derecha
   - Blindado contra estilos globales
   ────────────────────────────────────────────────────────────── */

/* ================================================================
   1) CONTENEDOR (stack)
   ================================================================ */
#onx-toast-container {
  position: fixed;
  top: 16px;
  /* cambia a bottom:16px si lo prefieres abajo */
  right: 16px;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  gap: 10px;

  pointer-events: none;
  /* clics pasan, salvo dentro de cada toast */
}

/* ================================================================
   2) TOAST BASE (layout + look)
   ================================================================ */
#onx-toast-container .onx-toast {
  box-sizing: border-box;
  pointer-events: auto;
  position: relative;

  /* Layout en FILA — a prueba de utilidades globales */
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 10px;

  max-width: 520px;
  min-height: 44px;
  padding: 10px 12px;

  border: 1px solid #E5E7EB;
  /* fallback */
  border-radius: 16px;
  background: #FFFFFF;
  color: #111827;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);

  /* Estado inicial (JS añade .show/.hide) */
  transform: translateX(24px);
  opacity: 0;
}

/* Blindaje: si una regla global fuerza display:block en hijos */
#onx-toast-container .onx-toast>.onx-toast__icon,
#onx-toast-container .onx-toast>.onx-toast__close {
  display: inline-flex !important;
}

/* ================================================================
   3) PARTES: icono / mensaje / cerrar
   ================================================================ */
#onx-toast-container .onx-toast__icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;

  width: 20px;
  height: 20px;
  line-height: 1;
  margin: 0;
  opacity: .9;
}

/* Desktop: una línea + elipsis */
#onx-toast-container .onx-toast__msg {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  /* permite elipsis */
  margin: 0;

  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#onx-toast-container .onx-toast__close {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;

  width: 24px;
  height: 24px;
  margin-left: 4px;

  background: transparent;
  border: 0;
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  line-height: 1;

  opacity: .75;
  transition: opacity .15s ease, background-color .15s ease;
}

#onx-toast-container .onx-toast__close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, .06);
}

#onx-toast-container .onx-toast__close ion-icon {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* ================================================================
   4) MOTION (entrada/salida)
   ================================================================ */
#onx-toast-container .onx-toast.show {
  animation: onx-toast-in .24s ease forwards;
}

#onx-toast-container .onx-toast.hide {
  animation: onx-toast-out .20s ease forwards;
}

@keyframes onx-toast-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes onx-toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(24px);
    opacity: 0;
  }
}

/* ================================================================
   5) VARIANTES (modo claro)
   ================================================================ */
#onx-toast-container .onx-toast--success {
  background: #10B981;
  border-color: #0EA371;
  color: #F0FDF4;
}

#onx-toast-container .onx-toast--error {
  background: #B91C1C;
  border-color: #9F1A1A;
  color: #FEE2E2;
}

#onx-toast-container .onx-toast--warning {
  background: #D97706;
  border-color: #B76705;
  color: #FFFBEB;
}

#onx-toast-container .onx-toast--info {
  background: #1D4ED8;
  border-color: #1A46BF;
  color: #DBEAFE;
}

#onx-toast-container .onx-toast--copy {
  background: #4F46E5;
  border-color: #443CD9;
  color: #E0E7FF;
}

/* ================================================================
   6) MODO OSCURO (prefers-color-scheme)
   ================================================================ */
@media (prefers-color-scheme: dark) {
  #onx-toast-container .onx-toast {
    border-color: rgba(255, 255, 255, .14);
    background: #1F2937;
    color: #F3F4F6;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .55);
  }

  #onx-toast-container .onx-toast__close:hover {
    background: rgba(255, 255, 255, .12);
  }

  #onx-toast-container .onx-toast--success {
    background: #047857;
    border-color: #10B981;
    color: #D1FAE5;
  }

  #onx-toast-container .onx-toast--error {
    background: #7F1D1D;
    border-color: #EF4444;
    color: #FECACA;
  }

  #onx-toast-container .onx-toast--warning {
    background: #92400E;
    border-color: #F59E0B;
    color: #FDE68A;
  }

  #onx-toast-container .onx-toast--info {
    background: #1E3A8A;
    border-color: #3B82F6;
    color: #DBEAFE;
  }

  #onx-toast-container .onx-toast--copy {
    background: #3730A3;
    border-color: #6366F1;
    color: #E0E7FF;
  }
}

/* ================================================================
   7) RESPONSIVE (móvil)
   - contenedor full-width con margen
   - mensaje hasta 2 líneas (clamp)
   ================================================================ */
@media (max-width: 520px) {
  #onx-toast-container {
    top: 12px;
    left: 12px;
    right: 12px;
    align-items: center;
  }

  #onx-toast-container .onx-toast {
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
    padding: 10px 10px;
  }

  /* 2 líneas + ellipsis */
  #onx-toast-container .onx-toast__msg {
    white-space: normal;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* Touch-friendly */
  #onx-toast-container .onx-toast__icon {
    width: 22px;
    height: 22px;
  }

  #onx-toast-container .onx-toast__close {
    width: 28px;
    height: 28px;
  }

  #onx-toast-container .onx-toast__close ion-icon {
    width: 20px;
    height: 20px;
  }
}