/* ═══════════════════════════════════════════════════════════════════
   Toast — Global notification system
   ═══════════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
  border-left: 4px solid;
  pointer-events: auto;
  animation: toast-in 0.3s ease both;
  font-family: var(--font-body);
}

.toast--exit {
  animation: toast-out 0.2s ease forwards;
}

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

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ── Variants ── */
.toast--success {
  border-left-color: var(--color-success);
}

.toast--success .toast-icon {
  color: var(--color-success);
}

.toast--error {
  border-left-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.toast--error .toast-icon {
  color: var(--color-danger);
}

.toast--warning {
  border-left-color: var(--color-warning);
}

.toast--warning .toast-icon {
  color: var(--color-warning);
}

.toast--info {
  border-left-color: var(--color-info);
}

.toast--info .toast-icon {
  color: var(--color-info);
}

/* ── Icon ── */
.toast-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 14px;
  font-weight: var(--weight-extrabold);
  margin-top: 1px;
}

/* ── Message ── */
.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  min-width: 0;
  word-break: break-word;
}

/* ── Action button ── */
.toast-action {
  flex-shrink: 0;
  padding: 4px 14px;
  border: 1px solid rgba(25, 38, 43, 0.12);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--color-ink);
  font-size: var(--text-xs);
  font-family: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  white-space: nowrap;
}

.toast-action:hover {
  background: var(--color-paper);
}

/* ── Close button ── */
.toast-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-ink-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.toast-close:hover {
  background: rgba(25, 38, 43, 0.06);
  color: var(--color-ink);
}

/* ── Responsive ── */
@media (max-width: 540px) {
  #toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
    width: auto;
  }

  .toast {
    padding: 12px 14px;
  }
}
