/* ==========================================================================
   Toast 组件 (Toast / Notification)
   ========================================================================== */

/* 容器 (Container) - 固定定位，用于承载所有 Toast */
.zuoekai-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--zuoekai-z-toast, 2200);
  display: flex;
  flex-direction: column;
  /* gap: 12px; Removed to support smooth margin collapse animation */
  max-width: 360px;
  width: 100%;
  pointer-events: none; /* 允许点击穿透到底部内容 */
}

/* Toast 项 */
.zuoekai-toast {
  background-color: var(--zuoekai-color-surface-panel);
  border: 1px solid var(--zuoekai-color-border);
  box-shadow: var(--zuoekai-shadow-md);
  border-radius: var(--zuoekai-radius-md);
  
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  
  pointer-events: auto; /* 恢复自身点击 */
  
  /* 布局过渡属性 */
  max-height: 200px; /* 足够容纳多行文本 */
  margin-bottom: 12px; /* Replaces container gap */
  opacity: 0;
  
  /* 初始进入状态：轻微右偏 + 缩小 */
  transform: translateX(20px) scale(0.95);
  
  transition: 
    opacity 0.3s ease,
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    margin 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    border 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* 硬件加速 */
  will-change: transform, opacity, max-height, margin;
}

/* 激活状态 (显示) */
.zuoekai-toast--active {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* 移除状态 (消失) */
.zuoekai-toast--leaving {
  opacity: 0;
  transform: translateX(100%) scale(1); /* 向右滑出 */
  
  /* 布局收缩 */
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  overflow: hidden;
}

/* --- 内容结构 --- */

.zuoekai-toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.zuoekai-toast__content {
  flex: 1;
  min-width: 0;
}

.zuoekai-toast__title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--zuoekai-color-text);
}

.zuoekai-toast__message {
  margin: 0;
  font-size: 13px;
  color: var(--zuoekai-color-text-secondary);
  line-height: 1.5;
}

.zuoekai-toast__close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin: -4px -4px 0 0;
  color: var(--zuoekai-color-text-muted);
  border-radius: var(--zuoekai-radius-sm);
  transition: color 0.2s, background-color 0.2s;
}

.zuoekai-toast__close:hover {
  color: var(--zuoekai-color-text);
  background-color: var(--zuoekai-color-action-hover-bg);
}

/* --- 类型变体 (Type Variants) --- */

/* Success */
.zuoekai-toast--success .zuoekai-toast__icon {
  color: var(--zuoekai-color-success-600);
}
.zuoekai-toast--success {
  border-left: 4px solid var(--zuoekai-color-success-600);
}

/* Error */
.zuoekai-toast--error .zuoekai-toast__icon {
  color: var(--zuoekai-color-error-600);
}
.zuoekai-toast--error {
  border-left: 4px solid var(--zuoekai-color-error-600);
}

/* Warning */
.zuoekai-toast--warning .zuoekai-toast__icon {
  color: var(--zuoekai-color-warning-600);
}
.zuoekai-toast--warning {
  border-left: 4px solid var(--zuoekai-color-warning-600);
}

/* Info (Default) */
.zuoekai-toast--info .zuoekai-toast__icon {
  color: var(--zuoekai-color-info-600);
}
.zuoekai-toast--info {
  border-left: 4px solid var(--zuoekai-color-info-600);
}

/* 适配移动端 */
@media (max-width: 640px) {
  .zuoekai-toast-container {
    top: auto;
    bottom: 20px;
    left: 20px;
    right: 20px;
    width: auto;
    max-width: none;
  }
  
  .zuoekai-toast {
    transform: translateY(100%);
  }
  
  .zuoekai-toast--active {
    transform: translateY(0) scale(1);
  }
  
  .zuoekai-toast--leaving {
    transform: translateY(100%) scale(1);
    
    /* 布局收缩 (Mobile) */
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    overflow: hidden;
  }
}
