/**
 * StarRiver Toast 提示消息样式
 * 提供多种提示消息样式和位置
 */

/* Toast 容器 */
.toast-container {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-container[data-position*="top"] {
  flex-direction: column;
}

.toast-container[data-position*="bottom"] {
  flex-direction: column-reverse;
}

/* Toast 消息基础样式 */
.toast-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  color: #333;
  pointer-events: auto;
  /* min-width: 200px; */
  /* max-width: 400px; */
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  max-height: 200px;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              border-width 0.35s ease;
  will-change: opacity, transform, max-height, margin;
}

/* Toast 显示状态 */
.toast-message.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Toast 隐藏状态 */
.toast-message.toast-hide {
  opacity: 0;
  transform: translateY(-20px) scale(0.85);
  margin-top: -44px; /* 负 margin 让下方元素平滑上移 */
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  max-height: 0;
  min-height: 0;
  border-width: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Toast 图标 */
.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Toast 内容 */
.toast-content {
  flex: 1;
  line-height: 1.5;
}

/* Toast 关闭按钮 */
.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-left: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  color: #666;
}

.toast-close .iconfont {
  font-size: 14px;
}

/* ===== 样式类型 ===== */

/* 成功 */
.toast-success {
  background: rgba(217, 247, 190, 0.85);
  /* border: 1px solid #b7eb8f; */
}

.toast-success .toast-icon {
  color: #389e0d;
}

.toast-success .toast-content {
  color: #237804;
}

/* 错误 */
.toast-error {
  background: rgba(255, 204, 199, 0.85);
  /* border: 1px solid #ffccc7; */
}

.toast-error .toast-icon {
  color: #cf1322;
}

.toast-error .toast-content {
  color: #a8071a;
}

/* 警告 */
.toast-warning {
  background: rgba(255, 229, 143, 0.85);
  /* border: 1px solid #ffe58f; */
}

.toast-warning .toast-icon {
  color: #d48806;
}

.toast-warning .toast-content {
  color: #ad6800;
}

/* 信息 */
.toast-info {
  background: rgba(186, 231, 255, 0.85);
  /* border: 1px solid #91d5ff; */
}

.toast-info .toast-icon {
  color: #096dd9;
}

.toast-info .toast-content {
  color: #0050b3;
}

/* 加载中 */
.toast-loading {
  background: rgba(240, 240, 240, 0.9);
  /* border: 1px solid #e8e8e8; */
}

.toast-loading .toast-icon {
  color: #1890ff;
  animation: toast-spin 1s linear infinite;
}

.toast-loading .toast-content {
  color: #666;
}

/* ===== 动画效果 ===== */

/* 淡入淡出 */
.toast-fade {
  transition: opacity 0.3s ease;
}

/* 滑动 */
.toast-slide {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 缩放 */
.toast-zoom {
  transform: scale(0.8);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast-zoom.toast-show {
  transform: scale(1);
}

.toast-zoom.toast-hide {
  transform: scale(0.8);
}

/* 加载动画 */
@keyframes toast-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== 深色模式适配 ===== */
@media (prefers-color-scheme: dark) {
  .toast-message {
    background: #2d2d2d;
    color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .toast-success {
    background: #1a2e1a;
    border-color: #2f5a2f;
  }

  .toast-success .toast-content {
    color: #6abe39;
  }

  .toast-error {
    background: #2e1a1a;
    border-color: #5a2f2f;
  }

  .toast-error .toast-content {
    color: #ff6b6b;
  }

  .toast-warning {
    background: #2e2a1a;
    border-color: #5a4f2f;
  }

  .toast-warning .toast-content {
    color: #ffc107;
  }

  .toast-info {
    background: #1a2a3e;
    border-color: #2f4f5a;
  }

  .toast-info .toast-content {
    color: #4dabf7;
  }

  .toast-loading {
    background: #2d2d2d;
    border-color: #404040;
  }

  .toast-loading .toast-content {
    color: #e0e0e0;
  }

  .toast-close {
    color: #888;
  }

  .toast-close:hover {
    color: #ccc;
  }
}

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
  .toast-container {
    left: 10px !important;
    right: 10px !important;
    transform: none !important;
  }

  .toast-container[data-position*="left"],
  .toast-container[data-position*="right"] {
    left: 10px !important;
    right: 10px !important;
  }

  .toast-message {
    max-width: none;
    width: 100%;
  }
}
