@keyframes nice-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

/* 2. 震動時的樣式：加粗邊框與柔和光暈 */
.error-shake {
  animation: nice-shake 0.4s ease-in-out;
  /* 加上擴散的光暈感，讓視覺不會太突兀 */
  box-shadow: 0 0 8px rgba(255, 120, 117, 0.4);
  /* 稍微讓背景也帶一點點紅，更有氛圍感 */
  background-color: #fff2f0;
  transition: all 0.3s ease;
}

/* 修改 parent 為相對定位，作為 span 的基準 */
.form-group {
  /* 假設你的 input 外層有 div */
  position: relative;
  padding-bottom: 20px; /* 預留空間給錯誤訊息 */
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 容器固定在中上位置 */
.toast-container {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translate(-50%, -20px);
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* --- 修正對齊的關鍵 --- */
  display: flex;
  align-items: center; /* 垂直居中 */
  justify-content: center; /* 水平居中 */
  line-height: 1; /* 消除行高造成的位移 */
  gap: 12px;
  /* ---------------------- */
}

/* 確保裡面的文字也垂直居中 */
.toast-container span {
  display: inline-block;
  line-height: 1.2; /* 稍微給一點行高讓文字更美，但不會歪 */
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block; /* 防止 svg 底部的空隙 */
}
.toast-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 顏色維持質感的淺色調，但邊框稍微明顯一點 */
.toast-success {
  background-color: #f6ffed;
  border: 1.5px solid #b7eb8f;
  color: #389e0d;
}
.toast-error {
  background-color: #fff2f0;
  border: 1.5px solid #ffccc7;
  color: #cf1322;
}

button:disabled {
  background-color: #cccccc !important;
  cursor: not-allowed; /* 游標變成禁止符號 */
  opacity: 0.7;
}
