[data-theme="blue"] {
  --bg-color: #4C9EEA;
}
[data-theme="orange"] {
  --bg-color: #FFBB5C;
}

/* Toast组件样式 - 优化性能和移动支持 */
.toast--box {
  position: relative;
  max-width: calc(100% - 30px);
  width: auto;
  padding: 12px 16px;
  margin: 0 auto;
  border-radius: 6px;
  background: var(--bg-color);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  will-change: opacity, transform;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  z-index: 9999;
}

/* 动画相关类 */
.toast--show {
  animation: toastFadeIn 0.25s cubic-bezier(0.2, 0, 0.1, 1) forwards;
}

.toast--hide {
  animation: toastFadeOut 0.2s cubic-bezier(0.2, 0, 0.1, 1) forwards;
}

/* 内容容器 */
.toast--con {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

/* 图标样式 */
.toast--icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

.toast--icon img {
  width: 100%;
  height: 100%;
  display: block;
  -o-object-fit: contain;
     object-fit: contain;
}

/* 消息文本 - 支持换行 */
.toast--msg {
  flex: 1;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  -webkit-hyphens: auto;
          hyphens: auto;
  min-width: 0;
  max-width: 100%;
}

/* 统一动画定义 - 移动和桌面通用 */
@keyframes toastFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* 为顶部和底部位置定义特殊动画 */
.toast--top.toast--show {
  animation: toastTopFadeIn 0.3s ease-out forwards;
}

.toast--bottom.toast--show {
  animation: toastBottomFadeIn 0.3s ease-out forwards;
}

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

@keyframes toastBottomFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 提高性能 */
@media screen and (min-width: 768px) {
  .toast--box {
    max-width: 320px;
    padding: 12px 20px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .toast--box {
    /* background: rgba(76, 158, 234, 1); */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }
}

/* 增强可访问性 */
@media (prefers-reduced-motion: reduce) {
  .toast--box,
  .toast--show,
  .toast--hide {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}