/* =========================================
   toast.css - 全局提示系统 (变量优化版)
   ========================================= */

/* 1. 容器定位 */
#toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2147483646; /* 仅次于底部导航 */
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 320px;
}

/* 2. Toast 消息卡片基础 */
.toast-message {
    /* 玻璃质感背景 */
    background: rgba(20, 25, 35, 0.95); /* 深色半透明 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* 边框与阴影 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    
    /* 文字排版 */
    color: var(--text-light);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
    
    /* 动画与布局 */
    opacity: 0;
    transform: translateY(-20px);
    animation: toastSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
    overflow: hidden;
}

/* 3. 左侧状态条装饰 */
.toast-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    border-radius: 0 3px 3px 0;
}

/* 4. 顶部进度条动画 */
.toast-message::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.7;
    animation: toastProgress 3s linear forwards;
}

/* 5. 状态类型 (使用全局变量) */
.toast-success {
    --toast-color: var(--accent-green);
    border-left: 1px solid var(--accent-green); /* 额外的视觉强化 */
}

.toast-error {
    --toast-color: var(--accent-red);
    border-left: 1px solid var(--accent-red);
}

.toast-warning {
    --toast-color: var(--primary-color);
    border-left: 1px solid var(--primary-color);
}

.toast-info {
    --toast-color: var(--accent-blue);
    border-left: 1px solid var(--accent-blue);
}

/* 应用颜色到伪元素 */
.toast-success::before, .toast-success::after { background: var(--toast-color); }
.toast-error::before, .toast-error::after { background: var(--toast-color); }
.toast-warning::before, .toast-warning::after { background: var(--toast-color); }
.toast-info::before, .toast-info::after { background: var(--toast-color); }

/* 6. 进出场动画 */
@keyframes toastSlideIn {
    0% { opacity: 0; transform: translateY(-30px) scale(0.95); }
    70% { transform: translateY(5px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastSlideOut {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.95); }
}

@keyframes toastProgress {
    0% { width: 100%; }
    100% { width: 0%; }
}

.toast-message.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

/* 7. 适配与优化 */
@media (max-width: 768px) {
    #toast-container {
        top: 70px;
        width: 94%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast-message, .toast-message::after, .toast-message.removing {
        animation: none;
        transition: none;
    }
}