/* ============================================================
 * TOAST NOTIFICATIONS — IG Tech Panel
 * Sistema UX premium · configurable desde panel admin
 * ============================================================ */

.toast-container {
  position: fixed; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
  padding: 16px;
}
.toast-container.pos-tr { top: 0; right: 0; }
.toast-container.pos-tl { top: 0; left: 0; }
.toast-container.pos-br { bottom: 0; right: 0; flex-direction: column-reverse; }
.toast-container.pos-bl { bottom: 0; left: 0; flex-direction: column-reverse; }
.toast-container.pos-tc { top: 0; left: 50%; transform: translateX(-50%); align-items: center; }

.toast {
  pointer-events: auto;
  background: var(--bg-elevated, #fff);
  border: 1px solid color-mix(in srgb, var(--toast-color, #0F2A44) 35%, var(--border, #e2e8f0));
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 12px 28px rgba(15,42,68,0.18);
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 280px;
  font-size: 14px;
  line-height: 1.45;
  animation: toast-in .25s ease-out;
  position: relative;
  overflow: hidden;
}
.toast.is-leaving { animation: toast-out .2s ease-in forwards; }
.toast-icon {
  font-size: 20px; flex-shrink: 0; line-height: 1;
  color: var(--toast-color, #0F2A44);
  font-weight: 700;
}
.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-weight: 700;
  color: var(--text, #0F2A44);
  margin-bottom: 2px;
  word-wrap: break-word;
}
.toast-desc {
  color: var(--text-muted, #64748b);
  font-size: 13px;
  word-wrap: break-word;
}
.toast-close {
  background: transparent; border: 0;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 4px;
  min-width: 24px; min-height: 24px;
  border-radius: 4px;
  font-size: 16px; line-height: 1;
  flex-shrink: 0;
}
.toast-close:hover {
  background: var(--bg-elevated, #f1f5f9);
  color: var(--text, #0F2A44);
}

/* Niveles */
.toast.success { --toast-color: #16a34a; }
.toast.error   { --toast-color: #dc2626; }
.toast.warning { --toast-color: #d97706; }
.toast.info    { --toast-color: #2563eb; }

/* Barra de progreso (countdown auto-hide) */
.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 2px;
  width: 100%;
  background: var(--toast-color);
  border-radius: 0 0 10px 10px;
  animation: toast-progress var(--toast-duration, 5s) linear forwards;
  transform-origin: left;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px) scale(.95); }
}
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-progress { animation: none; display: none; }
}

/* Móvil · ocupa todo el ancho con padding lateral */
@media (max-width: 600px) {
  .toast-container {
    left: 16px !important;
    right: 16px !important;
    max-width: none;
    transform: none !important;
    padding: 12px 0;
  }
  .toast { min-width: 0; width: 100%; }
}

/* Tema oscuro */
[data-theme="dark"] .toast {
  background: var(--bg-elevated, #1e293b);
  border-color: var(--border, #334155);
  color: var(--text, #e2e8f0);
}
[data-theme="dark"] .toast-close:hover {
  background: rgba(255,255,255,0.06);
}
