/* FlashBet — in-app toast & confirm (replaces browser alert/confirm) */

.fb-toast-stack {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 120000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.fb-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 14px 18px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.97) 0%, rgba(20, 30, 48, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 150, 57, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  overflow: hidden;
  transform: translateX(110%);
  opacity: 0;
  animation: fb-toast-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fb-toast.is-leaving {
  animation: fb-toast-out 0.32s ease forwards;
}

.fb-toast__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.fb-toast--success .fb-toast__icon {
  background: rgba(0, 150, 57, 0.2);
  color: #4ade80;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.25);
}

.fb-toast--error .fb-toast__icon {
  background: rgba(220, 38, 38, 0.18);
  color: #f87171;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.fb-toast--warning .fb-toast__icon {
  background: rgba(255, 184, 28, 0.18);
  color: #fbbf24;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.25);
}

.fb-toast--info .fb-toast__icon {
  background: rgba(0, 122, 50, 0.22);
  color: #86efac;
  box-shadow: inset 0 0 0 1px rgba(134, 239, 172, 0.2);
}

.fb-toast__body {
  min-width: 0;
  padding-top: 2px;
}

.fb-toast__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffb81c;
  margin-bottom: 4px;
}

.fb-toast__brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #009639;
  box-shadow: 0 0 8px rgba(0, 150, 57, 0.8);
}

.fb-toast__message {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  color: #e2e8f0;
  white-space: pre-line;
  word-break: break-word;
}

.fb-toast__close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.fb-toast__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.fb-toast__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  background: linear-gradient(90deg, #009639, #00b347);
}

.fb-toast--error .fb-toast__progress {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.fb-toast--warning .fb-toast__progress {
  background: linear-gradient(90deg, #e5a500, #ffb81c);
}

.fb-toast--info .fb-toast__progress {
  background: linear-gradient(90deg, #007a32, #4ade80);
}

/* Confirm modal */
.fb-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 130000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: fb-fade-in 0.22s ease forwards;
}

.fb-confirm-overlay.is-leaving {
  animation: fb-fade-out 0.2s ease forwards;
}

.fb-confirm {
  width: min(420px, 100%);
  border-radius: 18px;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 150, 57, 0.2);
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  animation: fb-confirm-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fb-confirm-overlay.is-leaving .fb-confirm {
  animation: fb-confirm-out 0.2s ease forwards;
}

.fb-confirm__header {
  padding: 22px 22px 0;
  text-align: center;
}

.fb-confirm__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(0, 150, 57, 0.25), rgba(255, 184, 28, 0.15));
  color: #ffb81c;
  box-shadow: inset 0 0 0 1px rgba(255, 184, 28, 0.25);
}

.fb-confirm__title {
  font-size: 1.125rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 8px;
}

.fb-confirm__message {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #94a3b8;
  white-space: pre-line;
  margin: 0;
  padding: 0 22px 22px;
  text-align: center;
}

.fb-confirm__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 18px 18px;
}

.fb-confirm__btn {
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.fb-confirm__btn:active {
  transform: scale(0.98);
}

.fb-confirm__btn--cancel {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fb-confirm__btn--cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.fb-confirm__btn--ok {
  background: linear-gradient(135deg, #007a32 0%, #009639 55%, #00b347 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 150, 57, 0.35);
}

.fb-confirm__btn--ok:hover {
  box-shadow: 0 10px 28px rgba(0, 150, 57, 0.45);
}

.fb-confirm__btn--danger.fb-confirm__btn--ok {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
}

@keyframes fb-toast-in {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fb-toast-out {
  to {
    transform: translateX(110%);
    opacity: 0;
  }
}

@keyframes fb-fade-in {
  to { opacity: 1; }
}

@keyframes fb-fade-out {
  to { opacity: 0; }
}

@keyframes fb-confirm-in {
  to {
    transform: scale(1) translateY(0);
  }
}

@keyframes fb-confirm-out {
  to {
    transform: scale(0.95) translateY(8px);
    opacity: 0;
  }
}

@media (max-width: 480px) {
  .fb-toast-stack {
    left: 16px;
    right: 16px;
    width: auto;
  }

  .fb-confirm__actions {
    grid-template-columns: 1fr;
  }

  .fb-confirm__btn--ok {
    order: -1;
  }
}
