/**
 * 全局Toast组件样式
 * @author PodBub Team
 * @version 1.0.1 - 修复文字显示问题
 */

/* Toast样式重置 - 修复版本，更精确的重置 */
.toast {
    box-sizing: border-box !important;
    margin-bottom: 12px !important;
    background: white !important;
    border-left: 4px solid #3b82f6;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* 只重置容器元素，不影响文字元素 */
.toast-content,
.toast-icon,
.toast-close,
.toast-progress {
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
    list-style: none !important;
}

/* 恢复Toast需要的样式 */
.toast-content {
    padding: 16px 20px !important;
    background: transparent !important;
}

/* Toast容器 */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
    max-width: 420px;
}

/* Toast基础样式 */
.toast {
    margin-bottom: 12px;
    max-width: 400px;
    min-width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #3b82f6;
    border-right: none;
    border-top: none;
    border-bottom: none;
    overflow: hidden;
    transform: translateX(450px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Toast显示动画 */
.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Toast隐藏动画 */
.toast.hide {
    transform: translateX(450px);
    opacity: 0;
    margin-bottom: 0;
    max-height: 0;
    transition: all 0.3s ease-out;
}

/* Toast内容区域 - 修复布局 */
.toast-content {
    padding: 16px 20px !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    background: transparent !important;
}

/* Toast图标 - 确保正确定位 */
.toast-icon {
    font-size: 20px !important;
    flex-shrink: 0 !important;
    margin-top: 2px !important;
    line-height: 1 !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

/* Toast文本区域 - 修复定位问题 */
.toast-text {
    flex: 1 !important;
    min-width: 0 !important;
    display: block !important;
    width: auto !important;
    overflow: visible !important;
    background: none !important;
}

/* Toast标题 - 强化文字显示并修复定位 */
.toast-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #111827 !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    font-family: inherit !important;
    background: none !important;
    text-shadow: none !important;
    letter-spacing: normal !important;
    text-indent: 0 !important;
    border: none !important;
}

/* Toast消息 - 强化文字显示并修复定位 */
.toast .toast-message {
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    color: #374151 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    font-family: inherit !important;
    background: none !important;
    text-shadow: none !important;
    letter-spacing: normal !important;
    text-indent: 0 !important;
    border: none !important;
    /* 重要：覆盖main.css中的冲突样式 */
    position: static !important;
    transform: none !important;
    overflow: visible !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* 只有消息没有标题时的样式 */
.toast .toast-message.toast-message-only {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #111827 !important;
    /* 重要：覆盖main.css中的冲突样式 */
    position: static !important;
    transform: none !important;
    overflow: visible !important;
    width: 100% !important;
}

/* Toast关闭按钮 */
.toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: -2px;
    line-height: 1;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* Toast进度条 */
.toast-progress {
    height: 3px;
    background: rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.toast-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #3b82f6;
    width: 100%;
    transform-origin: left;
    animation: toast-countdown linear;
}

@keyframes toast-countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* 成功类型 Toast */
.toast.toast-success {
    border-left-color: #10b981 !important;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-success .toast-progress-bar {
    background: #10b981;
}

/* 错误类型 Toast */
.toast.toast-error {
    border-left-color: #ef4444 !important;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-error .toast-progress-bar {
    background: #ef4444;
}

/* 警告类型 Toast */
.toast.toast-warning {
    border-left-color: #f59e0b !important;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-warning .toast-progress-bar {
    background: #f59e0b;
}

/* 信息类型 Toast */
.toast.toast-info {
    border-left-color: #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-info .toast-progress-bar {
    background: #3b82f6;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        transform: translateY(-120px);
        margin-bottom: 8px;
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .toast.hide {
        transform: translateY(-120px);
    }
    
    .toast-content {
        padding: 14px 16px;
        gap: 10px;
    }
    
    .toast-icon {
        font-size: 18px;
    }
    
    .toast-title {
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 12px;
    }
    
    .toast-message.toast-message-only {
        font-size: 13px;
    }
}

/* 小屏幕手机适配 */
@media (max-width: 480px) {
    #toast-container {
        top: 8px;
        right: 8px;
        left: 8px;
    }
    
    .toast-content {
        padding: 12px 14px;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .toast {
        background: #1f2937;
        color: #f9fafb;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    }
    
    .toast-title {
        color: #f9fafb !important;
    }
    
    .toast-message {
        color: #d1d5db !important;
    }
    
    .toast-message.toast-message-only {
        color: #e5e7eb !important;
    }
    
    .toast-close {
        color: #9ca3af;
    }
    
    .toast-close:hover {
        background: #374151;
        color: #d1d5db;
    }
}

/* 动画性能优化 */
.toast {
    will-change: transform, opacity;
}

.toast-progress-bar {
    will-change: transform;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .toast {
        border-width: 2px;
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    }
    
    .toast-close {
        border: 1px solid rgba(0, 0, 0, 0.2);
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast-close,
    .toast-progress-bar {
        animation: none;
        transition: none;
    }
    
    .toast.show {
        opacity: 1;
        transform: none;
    }
    
    .toast.hide {
        opacity: 0;
        transform: none;
    }
}

/* 紧急修复：强制确保文字可见 - 移除背景色 */
.toast .toast-message,
.toast .toast-title {
    color: #111827 !important;
    font-size: 14px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 调试辅助样式 - 只在调试模式下显示背景 */
.toast-debug .toast-message,
.toast-debug .toast-title {
    background: rgba(255, 255, 0, 0.3) !important;
    border: 1px dashed red !important;
    padding: 2px !important;
}

/* 强制覆盖规则 - 防止与其他CSS冲突 */
#toast-container .toast .toast-message {
    /* 强制重置可能冲突的样式 */
    position: static !important;
    transform: none !important;
    transition: none !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: visible !important;
    background-color: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    /* 确保文字正常显示 */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #374151 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    white-space: normal !important;
}

#toast-container .toast .toast-title {
    /* 强制重置可能冲突的样式 */
    position: static !important;
    transform: none !important;
    transition: none !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: visible !important;
    background-color: transparent !important;
    border: none !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    /* 确保文字正常显示 */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #111827 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
    white-space: normal !important;
}

/* 特别针对只有消息没有标题的情况 */
#toast-container .toast .toast-message.toast-message-only {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #111827 !important;
} 