/* toast.css — 全站 Toast 通知元件
 * 使用方式：在頁面引入此 CSS + js/toast.js
 * 呼叫：showToast('訊息內容', { type: 'success' | 'error' | 'warning' | 'info' })
 */

#toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: max-content;
  max-width: min(400px, 92vw);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.14);
  font-family: "Inter","Noto Sans TC",-apple-system,sans-serif;
  font-size: 14px;
  line-height: 1.5;
  max-width: 320px;
  pointer-events: auto;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  animation: toastIn 0.2s ease forwards;
  will-change: transform, opacity;
}

.toast.toast-hiding {
  animation: toastOut 0.2s ease forwards;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  color: #0f172a;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  margin-top: 1px;
  transition: color 0.15s ease;
}
.toast-close:hover { color: #374151; }

/* 類型變體 */
.toast-success {
  border-left: 3px solid #059669;
}
.toast-success .toast-icon { color: #059669; }

.toast-error {
  border-left: 3px solid #dc2626;
}
.toast-error .toast-icon { color: #dc2626; }

.toast-warning {
  border-left: 3px solid #d97706;
}
.toast-warning .toast-icon { color: #d97706; }

.toast-info {
  border-left: 3px solid #c7a46a;
}
.toast-info .toast-icon { color: #c7a46a; }

/* 動畫 */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* 手機版維持頂部置中，縮小邊距 */
@media (max-width: 640px) {
  #toast-container {
    top: 16px;
    max-width: 92vw;
  }
}
