/**
 * 全局提示组件样式 v2
 * 支持 success、warning、error 三种类型
 * 动画更流畅，支持层叠
 */

/* 提示容器 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast, 9999);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 90vw;
}

/* 提示项 */
.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 14px 20px;
    border-radius: var(--border-radius-large, 8px);
    box-shadow: var(--shadow-2, 0 4px 10px rgba(0,0,0,.12));
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    pointer-events: auto;
    animation: toastSlideIn var(--duration-slow, 0.3s) var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
    transition: all var(--duration-slow, 0.3s) var(--ease-out);
    position: relative;
    overflow: hidden;
    border-left: 4px solid transparent;
}

.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.2;
}

/* 滑入动画 */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 滑出动画 */
@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
}

.toast.hiding {
    animation: toastSlideOut var(--duration-normal, 0.2s) var(--ease-in-out) forwards;
    pointer-events: none;
}

/* 图标容器 */
.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

/* 消息文本 */
.toast-message {
    flex: 1;
    line-height: 1.5;
    word-break: break-word;
}

/* 关闭按钮 */
.toast-close {
    margin-left: 4px;
}




/* 成功提示 */
.toast-success {
    background: var(--color-success-bg, #E8FFEA);
    border-left-color: var(--color-success, #00B42A);
    color: var(--color-success-hover, #009A29);
}

.toast-success .toast-icon svg {
    fill: var(--color-success, #00B42A);
}


/* 警告提示 */
.toast-warning {
    background: var(--color-warning-bg, #FFF7E8);
    border-left-color: var(--color-warning, #FF7D00);
    color: var(--color-warning-hover, #D25F00);
}

.toast-warning .toast-icon svg {
    fill: var(--color-warning, #FF7D00);
}


/* 错误提示 */
.toast-error {
    background: var(--color-danger-bg, #FFECE8);
    border-left-color: var(--color-danger, #F53F3F);
    color: var(--color-danger-hover, #CB2634);
}

.toast-error .toast-icon svg {
    fill: var(--color-danger, #F53F3F);
}


/* 信息提示 */
.toast-info {
    background: var(--color-primary-light-1, #E8F3FF);
    border-left-color: var(--color-primary, #165DFF);
    color: var(--color-primary-active, #0E42D2);
}

.toast-info .toast-icon svg {
    fill: var(--color-primary, #165DFF);
}


/* ========== 暗色模式适配 ========== */
html[data-theme="dark"] .toast-success,
.dark-theme .toast-success {
    background: rgba(0, 180, 42, 0.12);
    color: var(--color-success, #00B42A);
}

html[data-theme="dark"] .toast-warning,
.dark-theme .toast-warning {
    background: rgba(255, 125, 0, 0.12);
    color: var(--color-warning, #FF7D00);
}

html[data-theme="dark"] .toast-error,
.dark-theme .toast-error {
    background: rgba(245, 63, 63, 0.12);
    color: var(--color-danger, #F53F3F);
}

html[data-theme="dark"] .toast-info,
.dark-theme .toast-info {
    background: rgba(22, 93, 255, 0.12);
    color: var(--color-primary, #4080FF);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .toast-container {
        top: 12px;
        left: 12px;
        right: 12px;
        transform: none;
    }

    .toast {
        min-width: auto;
        width: 100%;
        padding: 12px 16px;
    }
}
