/* SellerEngine — Canonical Toast Component (v2 — 2026-05-18)
   Spec aprobado humano: 420-640px desktop, 36px icon, 4px bar, bottom-center 24px.
   Override en TODAS las apps prod (apps/*) y demos (demo/*).
   Especificidad elevada para ganar sobre overrides locales tipo
   `body.sellerengine-canonical-app .toast-*` (0-2-1) que existen en sniper-hub. */

body .toast.toast {
  position: fixed !important;
  display: none !important;
  left: 50% !important;
  right: auto !important;
  bottom: 24px !important;
  top: auto !important;
  width: auto !important;
  min-width: 420px !important;
  max-width: 640px !important;
  transform: translate(-50%, 18px) !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease !important;
  z-index: 10000 !important;
}

body .toast.toast.visible,
body .toast.toast.is-visible {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translate(-50%, 0) !important;
}

/* Empty visible toasts are a stale UI state, never a valid notification. */
body .toast.toast.visible:not(.has-title):not(.toast-progress-active):not(.is-sync-toast):has(.toast-msg:empty),
body .toast.toast.is-visible:not(.has-title):not(.toast-progress-active):not(.is-sync-toast):has(.toast-msg:empty),
body .toast.toast.visible:not(.has-title):not(.toast-progress-active):not(.is-sync-toast):has(#toastMsg:empty),
body .toast.toast.is-visible:not(.has-title):not(.toast-progress-active):not(.is-sync-toast):has(#toastMsg:empty) {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate(-50%, 18px) !important;
}

body .toast .toast-shell.toast-shell {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100% !important;
  padding: 14px 20px !important;
  background: rgba(14, 16, 22, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(66, 133, 244, 0.06) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

body .toast .toast-icon.toast-icon {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 36px !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 999px !important;
  color: #8db7ff !important;
  background: rgba(66, 133, 244, 0.18) !important;
  position: relative !important;
  box-shadow: none !important;
}

body .toast .toast-icon.toast-icon .mi,
body .toast .toast-icon.toast-icon svg,
body .toast .toast-icon.toast-icon .material-symbols-rounded {
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
  line-height: 1 !important;
}

body .toast .toast-content.toast-content {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  text-align: center !important;
}

body .toast .toast-title.toast-title {
  display: none !important;
  margin: 0 0 2px 0 !important;
  color: rgba(255, 255, 255, 0.94) !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}

body .toast.has-title .toast-title.toast-title,
body .toast.toast-progress-active .toast-title.toast-title {
  display: block !important;
}

body .toast .toast-msg.toast-msg,
body .toast #toastMsg {
  margin: 0 !important;
  color: rgba(255, 255, 255, 0.84) !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body .toast .toast-bar.toast-bar {
  display: none !important;
  height: 4px !important;
  width: 100% !important;
  margin-top: 8px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
}

body .toast.toast-progress-active .toast-bar.toast-bar {
  display: block !important;
}

body .toast .toast-bar-fill.toast-bar-fill {
  width: 0%;
  height: 100% !important;
  background: linear-gradient(90deg, #4285f4, #8b5cf6) !important;
  border-radius: inherit !important;
  transition: width 0.25s ease !important;
}

/* Color variants — accept all known class names from existing apps */
body .toast.toast-emerald .toast-icon.toast-icon,
body .toast.toast-ok .toast-icon.toast-icon,
body .toast.toast-success .toast-icon.toast-icon,
body .toast.toast-done .toast-icon.toast-icon {
  color: #7cf0b8 !important;
  background: rgba(43, 214, 141, 0.18) !important;
}

body .toast.toast-emerald .toast-bar-fill.toast-bar-fill,
body .toast.toast-ok .toast-bar-fill.toast-bar-fill,
body .toast.toast-success .toast-bar-fill.toast-bar-fill,
body .toast.toast-done .toast-bar-fill.toast-bar-fill {
  background: linear-gradient(90deg, #35d399, #86efac) !important;
}

body .toast.toast-rose .toast-icon.toast-icon,
body .toast.toast-bad .toast-icon.toast-icon,
body .toast.toast-error .toast-icon.toast-icon,
body .toast.toast-danger .toast-icon.toast-icon {
  color: #ff9aa8 !important;
  background: rgba(255, 92, 122, 0.18) !important;
}

body .toast.toast-rose .toast-bar-fill.toast-bar-fill,
body .toast.toast-bad .toast-bar-fill.toast-bar-fill,
body .toast.toast-error .toast-bar-fill.toast-bar-fill,
body .toast.toast-danger .toast-bar-fill.toast-bar-fill {
  background: linear-gradient(90deg, #ff5c7a, #fca5a5) !important;
}

body .toast.toast-amber .toast-icon.toast-icon,
body .toast.toast-warn .toast-icon.toast-icon,
body .toast.toast-warning .toast-icon.toast-icon {
  color: #ffd966 !important;
  background: rgba(255, 205, 65, 0.18) !important;
}

body .toast.toast-amber .toast-bar-fill.toast-bar-fill,
body .toast.toast-warn .toast-bar-fill.toast-bar-fill,
body .toast.toast-warning .toast-bar-fill.toast-bar-fill {
  background: linear-gradient(90deg, #fbbf24, #ffd966) !important;
}

body .toast.toast-info .toast-icon.toast-icon,
body .toast.toast-sky .toast-icon.toast-icon,
body .toast.toast-blue .toast-icon.toast-icon,
body .toast.toast-neutral .toast-icon.toast-icon {
  background: rgba(66, 133, 244, 0.16) !important;
  color: #8db7ff !important;
  border-color: rgba(66, 133, 244, 0.28) !important;
}

body .toast.toast-info .toast-bar-fill.toast-bar-fill,
body .toast.toast-sky .toast-bar-fill.toast-bar-fill,
body .toast.toast-blue .toast-bar-fill.toast-bar-fill,
body .toast.toast-neutral .toast-bar-fill.toast-bar-fill {
  background: linear-gradient(90deg, #4285f4, #8b5cf6, #d9658f) !important;
}

/* Loading spinner state — spinner orbits around the 36px icon */
body .toast.toast-progress-active .toast-icon.toast-icon::after {
  content: "" !important;
  position: absolute !important;
  inset: -3px !important;
  border: 2px solid rgba(141, 183, 255, 0.35) !important;
  border-top-color: transparent !important;
  border-radius: 999px !important;
  animation: se-toast-spin 0.9s linear infinite !important;
  display: block !important;
}

@keyframes se-toast-spin {
  to { transform: rotate(360deg); }
}

/* Mobile responsive — 640px breakpoint per spec */
@media (max-width: 640px) {
  body .toast.toast {
    width: calc(100vw - 24px) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
  }
  body .toast .toast-shell.toast-shell {
    padding: 14px 16px !important;
    border-radius: 12px !important;
    gap: 12px !important;
  }
  body .toast .toast-icon.toast-icon {
    flex: 0 0 32px !important;
    width: 32px !important;
    height: 32px !important;
  }
  body .toast .toast-icon.toast-icon .mi,
  body .toast .toast-icon.toast-icon svg,
  body .toast .toast-icon.toast-icon .material-symbols-rounded {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
  }
  body .toast .toast-msg.toast-msg,
  body .toast #toastMsg {
    font-size: 0.85rem !important;
    white-space: normal !important;
  }
}

/* Aliases for apps that use alternative IDs/classes */
body #toast-container .toast,
body #toastContainer .toast,
body .notification-toast,
body .app-toast,
body .se-toast {
  position: fixed !important;
  left: 50% !important;
  bottom: 24px !important;
  transform: translate(-50%, 0) !important;
}

/* ── Day mode ─────────────────────────────────────────────────────────────
   The persisted theme sets data-se-theme="light" on <html> (anti-flash snippet +
   theme bridge). These rules live HERE — not in sellerengine-light-mode.css —
   because this file wins every specificity fight by design (!important + chained
   classes): light rules anywhere weaker produced the reported hybrid of a dark
   toast in day mode, or a light surface stuck with the white !important text. */
html[data-se-theme="light"] body .toast .toast-shell.toast-shell {
  background: rgba(255, 255, 255, 0.97) !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(66, 133, 244, 0.05) !important;
}

html[data-se-theme="light"] body .toast .toast-title.toast-title {
  color: rgba(15, 23, 42, 0.92) !important;
}

html[data-se-theme="light"] body .toast .toast-msg.toast-msg,
html[data-se-theme="light"] body .toast #toastMsg {
  color: rgba(15, 23, 42, 0.78) !important;
}

html[data-se-theme="light"] body .toast .toast-bar.toast-bar {
  background: rgba(15, 23, 42, 0.08) !important;
}

/* Icon chips: deepen each accent so it reads on the white shell. */
html[data-se-theme="light"] body .toast .toast-icon.toast-icon {
  color: #2c64d9 !important;
  background: rgba(66, 133, 244, 0.14) !important;
}

html[data-se-theme="light"] body .toast.toast-emerald .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-ok .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-success .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-done .toast-icon.toast-icon {
  color: #0d8a5f !important;
  background: rgba(16, 185, 129, 0.15) !important;
}

html[data-se-theme="light"] body .toast.toast-rose .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-bad .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-error .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-danger .toast-icon.toast-icon {
  color: #d2244d !important;
  background: rgba(244, 63, 94, 0.13) !important;
}

html[data-se-theme="light"] body .toast.toast-amber .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-warn .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-warning .toast-icon.toast-icon {
  color: #b45309 !important;
  background: rgba(245, 158, 11, 0.16) !important;
}

html[data-se-theme="light"] body .toast.toast-info .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-sky .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-blue .toast-icon.toast-icon,
html[data-se-theme="light"] body .toast.toast-neutral .toast-icon.toast-icon {
  color: #2c64d9 !important;
  background: rgba(66, 133, 244, 0.13) !important;
  border-color: rgba(66, 133, 244, 0.24) !important;
}

html[data-se-theme="light"] body .toast.toast-progress-active .toast-icon.toast-icon::after {
  border-color: rgba(44, 100, 217, 0.35) !important;
  border-top-color: transparent !important;
}

/* Alias families that paint their own surface (chrome/demo notices). */
html[data-se-theme="light"] body .notification-toast,
html[data-se-theme="light"] body .app-toast,
html[data-se-theme="light"] body .se-toast {
  background: rgba(255, 255, 255, 0.97) !important;
  color: rgba(15, 23, 42, 0.82) !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16) !important;
}
