/* ================================================
   统一Toast提示组件样式
   ================================================ */

/* Toast容器基础样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 500px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    font-family: var(--font-family-chinese);
}

/* Toast显示状态 */
.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Toast隐藏状态 */
.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Toast类型样式 - 成功(绿色) */
.toast.toast-success {
    background: #5fb101;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .toast.toast-success {
    background: rgba(2, 158, 18, 0.95);
    color: #34d399;
    border-color: #34d399;
}

/* Toast类型样式 - 信息(蓝色) */
.toast.toast-info {
    background: #3b82f6;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .toast.toast-info {
    background: rgba(30, 58, 138, 0.95);
    color: #60a5fa;
    border-color: #60a5fa;
}

/* Toast类型样式 - 警告(橙色) */
.toast.toast-warning {
    background: #f59e0b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .toast.toast-warning {
    background: rgba(120, 53, 15, 0.95);
    color: #fbbf24;
    border-color: #fbbf24;
}

/* Toast类型样式 - 错误(红色) */
.toast.toast-error {
    background: #ef4444;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .toast.toast-error {
    background: rgba(153, 27, 27, 0.95);
    color: #f87171;
    border-color: #f87171;
}

/* Toast内容区域 */
.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 500;
}

/* Toast图标样式 */
.toast-content i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success .toast-content i {
    color: #ffffff;
}

.toast-info .toast-content i {
    color: #ffffff;
}

.toast-warning .toast-content i {
    color: #ffffff;
}

.toast-error .toast-content i {
    color: #ffffff;
}

[data-theme="dark"] .toast-success .toast-content i {
    color: #34d399;
}

[data-theme="dark"] .toast-info .toast-content i {
    color: #60a5fa;
}

[data-theme="dark"] .toast-warning .toast-content i {
    color: #fbbf24;
}

[data-theme="dark"] .toast-error .toast-content i {
    color: #f87171;
}

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

/* Toast关闭按钮 */
.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.875rem;
    opacity: 0.7;
    flex-shrink: 0;
}

/* 彩色背景toast的关闭按钮 - Light主题 */
.toast.toast-success .toast-close,
.toast.toast-info .toast-close,
.toast.toast-warning .toast-close,
.toast.toast-error .toast-close {
    color: rgba(255, 255, 255, 0.8);
}

.toast.toast-success .toast-close:hover,
.toast.toast-info .toast-close:hover,
.toast.toast-warning .toast-close:hover,
.toast.toast-error .toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

/* 默认关闭按钮样式 */
.toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    opacity: 1;
}

[data-theme="dark"] .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 确保暗色主题下关闭按钮使用正确的颜色 */
[data-theme="dark"] .toast.toast-success .toast-close,
[data-theme="dark"] .toast.toast-info .toast-close,
[data-theme="dark"] .toast.toast-warning .toast-close,
[data-theme="dark"] .toast.toast-error .toast-close {
    color: var(--text-secondary);
}

[data-theme="dark"] .toast.toast-success .toast-close:hover,
[data-theme="dark"] .toast.toast-info .toast-close:hover,
[data-theme="dark"] .toast.toast-warning .toast-close:hover,
[data-theme="dark"] .toast.toast-error .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

/* Toast进度条(可选) */
.toast-progress {
    position: absolute;
    bottom: 4px;
    left: 8px;
    right: 8px;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    background: currentColor;
    transform: translateX(-100%);
    transition: transform linear;
}

/* 彩色背景下的进度条背景调整 */
.toast.toast-success .toast-progress,
.toast.toast-info .toast-progress,
.toast.toast-warning .toast-progress,
.toast.toast-error .toast-progress {
    background: rgba(255, 255, 255, 0.2);
}

.toast.toast-success .toast-progress-bar {
    background: rgba(255, 255, 255, 0.8);
}

.toast.toast-info .toast-progress-bar {
    background: rgba(255, 255, 255, 0.8);
}

.toast.toast-warning .toast-progress-bar {
    background: rgba(255, 255, 255, 0.8);
}

.toast.toast-error .toast-progress-bar {
    background: rgba(255, 255, 255, 0.8);
}

/* 暗色主题下保持原有的进度条样式 */
[data-theme="dark"] .toast.toast-success .toast-progress {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .toast.toast-info .toast-progress {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .toast.toast-warning .toast-progress {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .toast.toast-error .toast-progress {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .toast.toast-success .toast-progress-bar {
    background: #34d399;
}

[data-theme="dark"] .toast.toast-info .toast-progress-bar {
    background: #60a5fa;
}

[data-theme="dark"] .toast.toast-warning .toast-progress-bar {
    background: #fbbf24;
}

[data-theme="dark"] .toast.toast-error .toast-progress-bar {
    background: #f87171;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toast {
        left: 20px;
        right: 20px;
        min-width: auto;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .toast.hide {
        transform: translateY(-100%);
    }
    
    .toast-content {
        font-size: 0.85rem;
        gap: 0.5rem;
    }
    
    .toast-content i {
        font-size: 1.1rem;
    }
}

/* Toast容器管理(用于多个toast堆叠) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-container .toast {
    position: relative;
    top: auto;
    right: auto;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .toast-container {
        left: 20px;
        right: 20px;
        top: 20px;
    }
}

/* 动画效果增强 */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes toastSlideInMobile {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOutMobile {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* 平滑弹出效果 */
.toast.animate-in {
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

.toast.animate-out {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

@media (max-width: 768px) {
    .toast.animate-in {
        animation: toastSlideInMobile 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
    }
    
    .toast.animate-out {
        animation: toastSlideOutMobile 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
    }
}
