/* Obyte UI Alerts — feedback global de sucesso, informação, atenção e erro */
:root {
  --obyte-alert-radius: 14px;
  --obyte-alert-shadow: 0 18px 48px rgba(17, 24, 39, .14), 0 2px 10px rgba(17, 24, 39, .07);
}

.obyte-alert-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100000;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  pointer-events: none;
}

.obyte-alert {
  --alert-accent: #2563eb;
  --alert-bg: #eff6ff;
  --alert-border: #bfdbfe;
  --alert-text: #1e3a8a;
  --alert-icon-bg: #dbeafe;
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 30px;
  align-items: start;
  gap: 11px;
  padding: 13px 11px 13px 12px;
  overflow: hidden;
  border: 1px solid var(--alert-border);
  border-left: 4px solid var(--alert-accent);
  border-radius: var(--obyte-alert-radius);
  background: var(--alert-bg);
  color: var(--alert-text);
  box-shadow: var(--obyte-alert-shadow);
  pointer-events: auto;
  opacity: 0;
  transform: translate3d(14px, -4px, 0) scale(.985);
  transition: opacity .2s ease, transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease;
}

.obyte-alert.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.obyte-alert.is-leaving {
  opacity: 0;
  transform: translate3d(12px, 0, 0) scale(.985);
}

.obyte-alert:hover { box-shadow: 0 22px 54px rgba(17, 24, 39, .17), 0 3px 12px rgba(17, 24, 39, .08); }

.obyte-alert--success {
  --alert-accent: #16a34a;
  --alert-bg: #f0fdf4;
  --alert-border: #bbf7d0;
  --alert-text: #14532d;
  --alert-icon-bg: #dcfce7;
}
.obyte-alert--info {
  --alert-accent: #2563eb;
  --alert-bg: #eff6ff;
  --alert-border: #bfdbfe;
  --alert-text: #1e3a8a;
  --alert-icon-bg: #dbeafe;
}
.obyte-alert--warning {
  --alert-accent: #d97706;
  --alert-bg: #fffbeb;
  --alert-border: #fde68a;
  --alert-text: #78350f;
  --alert-icon-bg: #fef3c7;
}
.obyte-alert--error {
  --alert-accent: #dc2626;
  --alert-bg: #fef2f2;
  --alert-border: #fecaca;
  --alert-text: #7f1d1d;
  --alert-icon-bg: #fee2e2;
}

.obyte-alert__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--alert-icon-bg);
  color: var(--alert-accent);
}
.obyte-alert__icon svg { width: 19px; height: 19px; display: block; }

.obyte-alert__content { min-width: 0; padding-top: 1px; }
.obyte-alert__title {
  margin: 0 0 3px;
  font: 700 13px/1.25 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.01em;
}
.obyte-alert__message {
  margin: 0;
  font: 500 12.5px/1.42 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: color-mix(in srgb, var(--alert-text) 88%, #000 12%);
  overflow-wrap: anywhere;
}

.obyte-alert__close {
  appearance: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: currentColor;
  opacity: .58;
  cursor: pointer;
  transition: opacity .16s ease, background-color .16s ease;
}
.obyte-alert__close:hover { opacity: .9; background: rgba(255,255,255,.62); }
.obyte-alert__close svg { width: 15px; height: 15px; }

.obyte-alert__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: color-mix(in srgb, var(--alert-accent) 18%, transparent);
}
.obyte-alert__progress::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--alert-accent);
  transform-origin: left center;
  animation: obyteAlertProgress var(--obyte-alert-duration, 3600ms) linear forwards;
}
.obyte-alert:hover .obyte-alert__progress::after { animation-play-state: paused; }

@keyframes obyteAlertProgress { to { transform: scaleX(0); } }

/* Oculta os toasts legados quando o sistema global está disponível. */
body.obyte-alerts-ready #adminToast,
body.obyte-alerts-ready #operationalToast,
body.obyte-alerts-ready #accountToast,
body.obyte-alerts-ready #checkoutToast,
body.obyte-alerts-ready #toast.toast {
  display: none !important;
}

@media (max-width: 640px) {
  .obyte-alert-stack {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }
  .obyte-alert {
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    gap: 9px;
    padding: 11px 9px 11px 10px;
  }
  .obyte-alert__icon { width: 32px; height: 32px; border-radius: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .obyte-alert { transition: opacity .01ms linear !important; transform: none !important; }
  .obyte-alert__progress::after { animation: none !important; }
}
