/**
 * Global glass toast — use showToast('success'|'error'|'warning'|'info', message)
 * Theme: --primary #196164, --secondary #F8B102
 */

.bm-toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.bm-toast {
  --bm-toast-accent: var(--primary, #196164);
  --bm-toast-accent-soft: rgba(25, 97, 100, 0.14);
  --bm-toast-accent-glow: rgba(25, 97, 100, 0.22);

  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1rem 1.1rem;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: auto;

  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 10px 40px rgba(25, 97, 100, 0.12),
    0 2px 8px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);

  color: #1e293b;
  font-size: 0.9375rem;
  line-height: 1.45;
  animation: bmToastIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.bm-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--bm-toast-accent), var(--bm-toast-accent-glow));
  border-radius: 14px 0 0 14px;
}

.bm-toast--success {
  --bm-toast-accent: var(--primary, #196164);
  --bm-toast-accent-soft: rgba(25, 97, 100, 0.15);
  --bm-toast-accent-glow: rgba(25, 97, 100, 0.35);
}

.bm-toast--error {
  --bm-toast-accent: #dc4c4c;
  --bm-toast-accent-soft: rgba(220, 76, 76, 0.14);
  --bm-toast-accent-glow: rgba(220, 76, 76, 0.32);
}

.bm-toast--warning {
  --bm-toast-accent: var(--secondary, #f8b102);
  --bm-toast-accent-soft: rgba(248, 177, 2, 0.2);
  --bm-toast-accent-glow: rgba(248, 177, 2, 0.45);
}

.bm-toast--info {
  --bm-toast-accent: #3b82c4;
  --bm-toast-accent-soft: rgba(59, 130, 196, 0.14);
  --bm-toast-accent-glow: rgba(59, 130, 196, 0.3);
}

.bm-toast__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bm-toast-accent-soft);
  color: var(--bm-toast-accent);
  font-size: 1.35rem;
  margin-left: 0.15rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.bm-toast__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.2rem;
  padding-right: 0.25rem;
}

.bm-toast__title {
  display: block;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bm-toast-accent);
  margin-bottom: 0.2rem;
}

.bm-toast__message {
  font-weight: 500;
  color: #334155;
  word-wrap: break-word;
}

.bm-toast__close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.bm-toast__close:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #1e293b;
  transform: scale(1.05);
}

.bm-toast__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(15, 23, 42, 0.06);
  transform-origin: left center;
  animation: bmToastProgress 3.5s linear forwards;
}

.bm-toast__progress::after {
  content: '';
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--bm-toast-accent), var(--bm-toast-accent-glow));
  border-radius: 0 2px 2px 0;
}

.bm-toast.bm-toast--out {
  animation: bmToastOut 0.32s ease forwards;
}

/* Dark mode */
.dark-mode .bm-toast {
  background: rgba(22, 28, 36, 0.82);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.dark-mode .bm-toast__message {
  color: #cbd5e1;
}

.dark-mode .bm-toast__close {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.dark-mode .bm-toast__close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}

.dark-mode .bm-toast__progress {
  background: rgba(255, 255, 255, 0.08);
}

@keyframes bmToastIn {
  from {
    opacity: 0;
    transform: translateX(1.25rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes bmToastOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(1rem) scale(0.96);
  }
}

@keyframes bmToastProgress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 575.98px) {
  .bm-toast-container {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}
