/* ============================================================
   BinaryBot — shared toast notifications
   One look for every page. Class names are `bb-toast-*` prefixed
   so they never collide with page-local `.toast` styling.
   ============================================================ */

.bb-toast-region {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
  max-width: calc(100vw - 28px);
  pointer-events: none;
}

.bb-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  overflow: hidden;
  padding: 9px 10px 9px 13px;
  border-radius: 9px;
  border: 1px solid var(--bb-toast-border, rgba(15, 23, 42, 0.09));
  background: var(--bb-toast-surface, #ffffff);
  box-shadow: 0 6px 20px -6px rgba(15, 23, 42, 0.2), 0 1px 3px rgba(15, 23, 42, 0.08);
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Host pages centre-align text in places — pin it so toasts never inherit it */
  text-align: left;
  pointer-events: auto;
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.21, 1.02, 0.73, 1), opacity 0.3s ease;
}

.bb-toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.bb-toast.is-leaving {
  transform: translateX(calc(100% + 20px));
  opacity: 0;
}

/* Colour accent down the leading edge */
.bb-toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--bb-toast-accent);
}

.bb-toast-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bb-toast-accent-soft);
  color: var(--bb-toast-accent);
}

.bb-toast-icon svg {
  width: 12px;
  height: 12px;
  display: block;
}

.bb-toast-body {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 1px;
}

.bb-toast-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--bb-toast-title, #0f172a);
  letter-spacing: -0.005em;
}

.bb-toast-message {
  margin: 1px 0 0;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--bb-toast-text, #64748b);
  overflow-wrap: anywhere;
}

/* Message-only toasts read as a single line, not an orphaned subtitle */
.bb-toast-body.is-single .bb-toast-message {
  margin-top: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--bb-toast-title, #0f172a);
}

.bb-toast-close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 -1px 0 0;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.bb-toast-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--bb-toast-title, #0f172a);
}

.bb-toast-close svg {
  width: 10px;
  height: 10px;
  display: block;
}

/* Time-remaining bar */
.bb-toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: left center;
  background: var(--bb-toast-accent);
  opacity: 0.4;
}

.bb-toast.is-paused .bb-toast-progress {
  animation-play-state: paused;
}

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

/* Per-type accents, darkened for contrast against the white card */
.bb-toast-success {
  --bb-toast-accent: #16a34a;
  --bb-toast-accent-soft: rgba(22, 163, 74, 0.12);
}

.bb-toast-error {
  --bb-toast-accent: #e11d48;
  --bb-toast-accent-soft: rgba(225, 29, 72, 0.12);
}

.bb-toast-warning {
  --bb-toast-accent: #d97706;
  --bb-toast-accent-soft: rgba(217, 119, 6, 0.12);
}

.bb-toast-info {
  --bb-toast-accent: #0284c7;
  --bb-toast-accent-soft: rgba(2, 132, 199, 0.12);
}

/* Small screens: span the width so long messages stay readable */
@media (max-width: 600px) {
  .bb-toast-region {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    gap: 6px;
  }

  .bb-toast {
    padding: 8px 9px 8px 12px;
    border-radius: 8px;
  }

  .bb-toast-title,
  .bb-toast-body.is-single .bb-toast-message {
    font-size: 12px;
  }

  .bb-toast-message {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bb-toast {
    transition: opacity 0.2s ease;
    transform: none;
  }

  .bb-toast.is-leaving {
    transform: none;
  }

  .bb-toast-progress {
    display: none;
  }
}
