/* 表單驗證 */
input.error,
select.error {
  /* border: 2px solid #ff4d4f; */
  /* 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;
}

/* .input-error::placeholder {
  color: #ff4d4f;
} */

/* TOAST */
@keyframes nice-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@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;
}

/* swal2調整 */
.swal2-container.swal2-backdrop-show {
  overflow-y: hidden !important;
  overflow-x: hidden !important;
}

/* 1. 改造內文容器 .swal2-html-container (消滅邊距與捲軸) */
.swal2-container .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
  margin-top: 30px !important;
  overflow: hidden !important; /* 徹底消滅這層容器的捲軸 */
  width: 100% !important;
  height: 100% !important;
}

/* 2. 改造「X」關閉按鈕，浮在 iframe 之上 */
.swal2-container .swal2-close {
  z-index: 99999 !important;
  color: #fff !important; /* 變成白色 X */
  background-color: rgba(0, 0, 0, 0.5) !important; /* 加個半透明黑底 */
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  font-size: 28px !important;
  top: 20px !important;
  right: 20px !important;
  margin-right: 10px;

  /* 確保裡面的 X 居中對齊 */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 3. 移除 SweetAlert2 預設的白色卡片陰影與背景，並強制滿版 */
.swal2-container .swal2-popup {
  box-shadow: none !important;
  background-color: transparent !important;
  background: transparent !important; /* 雙重保險 */
  max-width: 100vw !important;
  max-height: 100vh !important;
  height: 100vh !important;
  width: 100vw !important;
  padding: 0 !important; /* 確保把外層可能有的內邊距也拔掉 */
}
