/* BolsaHoy — avisos de estado globales.
   Patrón visual: tarjeta contextual centrada, compacta y legible.
   Se aplica a los avisos existentes de todas las páginas sin cambiar su API JS. */

.toast,
.acc-toast,
.comm-toast,
.lab-toast {
  --bh-toast-duration: 2600ms;
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 1000 !important;
  width: fit-content !important;
  min-width: 0 !important;
  max-width: min(440px, calc(100% - 28px)) !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 9px 15px 11px !important;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none !important;
  color: var(--bh-ink, #eef3fb) !important;
  background:
    linear-gradient(145deg, rgba(20, 37, 64, .98), rgba(8, 16, 30, .98)) !important;
  border: 1px solid rgba(115, 178, 255, .3) !important;
  border-radius: 15px !important;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, .34),
    inset 0 1px 0 rgba(255, 255, 255, .09) !important;
  font-family: var(--bh-font-sans, Poppins, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
  letter-spacing: -.01em;
  text-align: center;
  text-wrap: balance;
  opacity: 0 !important;
  visibility: hidden;
  transform: translate(-50%, calc(100% + 24px)) !important;
  transition:
    transform 240ms cubic-bezier(.2, .8, .2, 1),
    opacity 180ms ease,
    visibility 0s linear 240ms;
}

.toast.show,
.acc-toast.show,
.comm-toast.show,
.lab-toast.is-visible {
  opacity: 1 !important;
  visibility: visible;
  transform: translate(-50%, 0) !important;
  transition-delay: 0s;
}

/* Keep the native hidden contract used by Cuenta and Comunidad. */
.acc-toast[hidden],
.comm-toast[hidden] {
  display: none !important;
}

.toast .bh-toast-message,
.acc-toast .bh-toast-message,
.comm-toast .bh-toast-message,
.lab-toast .bh-toast-message {
  display: block;
  width: fit-content;
  min-width: 0;
  max-width: min(360px, calc(100vw - 56px));
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.3;
}

.toast::after,
.acc-toast::after,
.comm-toast::after,
.lab-toast::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 0 20px 20px;
  background: linear-gradient(90deg, #1f80ff, #00c48c);
  transform: scaleX(0);
  transform-origin: left center;
}

.toast.show::after,
.acc-toast.show::after,
.comm-toast.show::after,
.lab-toast.is-visible::after {
  animation: bh-toast-progress var(--bh-toast-duration) linear both;
}

/* The account/community panels use a slightly longer timeout. */
.acc-toast,
.comm-toast { --bh-toast-duration: 3200ms; }
.lab-toast { --bh-toast-duration: 2800ms; }

[data-theme="light"] .toast,
[data-theme="light"] .acc-toast,
[data-theme="light"] .comm-toast,
[data-theme="light"] .lab-toast {
  color: var(--bh-ink, #08090b) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(239, 246, 255, .98)) !important;
  border-color: rgba(31, 128, 255, .24) !important;
  box-shadow:
    0 18px 42px rgba(32, 58, 92, .2),
    inset 0 1px 0 rgba(255, 255, 255, .95) !important;
}

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

@media (max-width: 520px) {
  .toast,
  .acc-toast,
  .comm-toast,
  .lab-toast {
    width: fit-content !important;
    min-width: 0 !important;
    max-width: calc(100% - 24px) !important;
    min-height: 0 !important;
    padding: 8px 13px 10px !important;
    border-radius: 14px !important;
  }

  .toast .bh-toast-message,
  .acc-toast .bh-toast-message,
  .comm-toast .bh-toast-message,
  .lab-toast .bh-toast-message {
    max-width: min(280px, calc(100vw - 50px));
    font-size: 11.5px;
  }

  .toast::after,
  .acc-toast::after,
  .comm-toast::after,
  .lab-toast::after {
    border-radius: 0 0 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .acc-toast,
  .comm-toast,
  .lab-toast {
    transition: opacity 120ms ease !important;
  }

  .toast.show,
  .acc-toast.show,
  .comm-toast.show,
  .lab-toast.is-visible {
    transform: translate(-50%, 0) !important;
  }

  .toast.show::after,
  .acc-toast.show::after,
  .comm-toast.show::after,
  .lab-toast.is-visible::after {
    animation: none;
    transform: scaleX(1);
  }
}
