/* ═══════════════════════════════════════════════════════════════
   toast.css — 登录页 Toast 通知样式（r39 独立提取）
   
   使用方式：
     在需要 toast 的页面组件中 import '@/styles/toast.css'
     或在 layout.tsx 里全局引入
   
   包含：
     1. Toast 容器定位（顶部居中，堆叠）
     2. Toast 卡片样式（圆角、阴影、毛玻璃背景）
     3. 4 种变体颜色（success/error/warning/info）
     4. 进入/退出动画（@keyframes）
     5. 暗色模式适配
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Toast 动画 keyframes ── */
@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

/* ── 2. Toast 容器（顶部居中堆叠）──
   注：custom-toast.tsx 用的是 inline style 定位，
   这里提供 class 版本供需要时替换 */
.toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

/* ── 3. Toast 卡片基础样式 ── */
.toast-card {
  max-width: 260px;
  width: fit-content;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(0, 0, 0, 0.78);
  font-size: 13px;
  line-height: 1.4;
  font-family: inherit;
  cursor: default;
  animation: toast-enter 300ms ease forwards;
  transition: box-shadow 150ms ease;
}

.toast-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ── 4. Toast 变体颜色 ── */

/* success — 绿色（操作成功） */
.toast-card.toast-success {
  background-color: rgba(240, 249, 235, 0.95);
  border: 1px solid rgba(103, 194, 58, 0.2);
  color: rgba(103, 194, 58, 0.95);
}

/* error — 红色（操作失败/错误） */
.toast-card.toast-error {
  background-color: rgba(254, 240, 240, 0.95);
  border: 1px solid rgba(245, 108, 108, 0.2);
  color: rgba(245, 108, 108, 0.95);
}

/* warning — 橙色（警告） */
.toast-card.toast-warning {
  background-color: rgba(253, 246, 236, 0.95);
  border: 1px solid rgba(230, 162, 60, 0.2);
  color: rgba(230, 162, 60, 0.95);
}

/* info — 蓝色（提示信息，默认） */
.toast-card.toast-info,
.toast-card.toast-default {
  background-color: rgba(236, 245, 255, 0.95);
  border: 1px solid rgba(64, 158, 255, 0.2);
  color: rgba(64, 158, 255, 0.95);
}

/* ── 5. Toast 图标容器 ── */
.toast-icon {
  flex-shrink: 0;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── 6. Toast 文本内容 ── */
.toast-content {
  min-width: 0;
  flex: 1;
}

.toast-message {
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-description {
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 2px;
  opacity: 0.65;
}

/* ── 7. 暗色模式适配 ── */
.dark .toast-card {
  background-color: rgba(30, 35, 42, 0.92);
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.dark .toast-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dark .toast-card.toast-success {
  background-color: rgba(40, 50, 40, 0.95);
  border-color: rgba(103, 194, 58, 0.3);
  color: rgba(133, 206, 97, 0.95);
}

.dark .toast-card.toast-error {
  background-color: rgba(50, 40, 40, 0.95);
  border-color: rgba(245, 108, 108, 0.3);
  color: rgba(236, 128, 128, 0.95);
}

.dark .toast-card.toast-warning {
  background-color: rgba(50, 45, 35, 0.95);
  border-color: rgba(230, 162, 60, 0.3);
  color: rgba(240, 180, 100, 0.95);
}

.dark .toast-card.toast-info,
.dark .toast-card.toast-default {
  background-color: rgba(35, 40, 50, 0.95);
  border-color: rgba(64, 158, 255, 0.3);
  color: rgba(100, 175, 255, 0.95);
}

/* ── 8. 响应式调整 ── */
@media (max-width: 480px) {
  .toast-container {
    top: 8px;
    left: 8px;
    right: 8px;
    transform: none;
    align-items: stretch;
  }
  .toast-card {
    max-width: 100%;
    width: 100%;
  }
  .toast-message {
    white-space: normal;
  }
}

/* ── 9. 减少动画（无障碍）── */
@media (prefers-reduced-motion: reduce) {
  .toast-card {
    animation: none;
    transition: none;
  }
}
