/* Toast notifications — guest + admin (Indigo DS tokens) */
.toast-container {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 1090;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

@media (max-width: 991.98px) {
  body:has(.ck-bottomnav) .toast-container,
  body:has(.mobile-bottom-nav) .toast-container {
    bottom: calc(var(--site-bottom-nav-offset, 88px) + 12px);
  }
}

.toast-container .toast-item {
  pointer-events: auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  color: var(--heading);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow:
    0 16px 40px color-mix(in srgb, var(--primary) 12%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toast-slide-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .toast-container .toast-item {
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.toast-item.toast-leaving {
  animation: toast-slide-out 0.28s ease-in forwards;
}

.toast-item__inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 12px;
}

.toast-item__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.toast-item__body {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.toast-item__title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
  margin-bottom: 3px;
  letter-spacing: 0.01em;
  color: var(--heading);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toast-item__message {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.toast-item__close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px;
  margin: -4px -4px 0 0;
  border-radius: 8px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.toast-item__close:hover {
  color: var(--heading);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.toast-item__progress {
  height: 3px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
  transform-origin: left center;
}

.toast-item.success {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
}
.toast-item.success .toast-item__icon {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}
.toast-item.success .toast-item__progress {
  background: linear-gradient(90deg, color-mix(in srgb, var(--success) 80%, white), var(--success));
}

.toast-item.error {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}
.toast-item.error .toast-item__icon {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
}
.toast-item.error .toast-item__progress {
  background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 80%, white), var(--danger));
}

.toast-item.warning {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
}
.toast-item.warning .toast-item__icon {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}
.toast-item.warning .toast-item__progress {
  background: linear-gradient(90deg, color-mix(in srgb, var(--warning) 80%, white), var(--warning));
}

.toast-item.info {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.toast-item.info .toast-item__icon {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary);
}
.toast-item.info .toast-item__progress {
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 70%, white), var(--primary));
}

@keyframes toast-slide-in {
  from {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  to {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
  }
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 575.98px) {
  .toast-container {
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    width: auto;
    max-width: none;
    align-items: stretch;
  }

  .toast-container .toast-item {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .toast-item__inner {
    padding: 12px 12px 10px;
    gap: 10px;
  }

  .toast-item__title {
    font-size: 0.9rem;
  }

  .toast-item__message {
    font-size: 0.82rem;
    line-height: 1.5;
  }
}
