/* 吐司通知组件样式 */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    pointer-events: none;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    /* 确保不影响页面布局 */
    width: auto;
    max-width: min(500px, calc(100vw - 280px));
    /* 确保Toast容器对页面布局零影响 */
    isolation: isolate;
    will-change: auto;
}

.toast {
    display: flex;
    align-items: flex-start;
    min-width: 280px;
    max-width: 420px;
    margin-bottom: 0.5rem;
    padding: 1rem;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    pointer-events: auto;
    transform: translateX(100%);
    transition: all 0.3s ease;
    position: relative;
    z-index: 100000;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

/* 吐司类型 */
.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-success .toast-icon {
    color: var(--success-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

.toast-error {
    border-left: 4px solid var(--error-color);
}

.toast-error .toast-icon {
    color: var(--error-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-info .toast-icon {
    color: var(--info-color);
}

.toast-primary {
    border-left: 4px solid var(--primary-color);
}

.toast-primary .toast-icon {
    color: var(--primary-color);
}

/* 吐司内容 */
.toast-content {
    flex: 1;
    margin-left: 0.5rem;
}

.toast-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.toast-message {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
    margin: 0;
}

/* 吐司图标 */
.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    font-size: 1rem;
}

/* 吐司关闭按钮 */
.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-left: 0.5rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #374151;
}

/* 吐司进度条 */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: currentColor;
    opacity: 0.3;
    transition: width linear;
}

.toast-success .toast-progress {
    background-color: var(--success-color);
}

.toast-warning .toast-progress {
    background-color: var(--warning-color);
}

.toast-error .toast-progress {
    background-color: var(--error-color);
}

.toast-info .toast-progress {
    background-color: var(--info-color);
}

.toast-primary .toast-progress {
    background-color: var(--primary-color);
}

/* 吐司动画 */
@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes toast-fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* 吐司位置变体 */
.toast-container.top-left {
    top: var(--spacing-md);
    left: var(--spacing-md);
    right: auto;
}

.toast-container.top-center {
    top: var(--spacing-md);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.toast-container.top-right {
    top: var(--spacing-md);
    right: var(--spacing-md);
}

.toast-container.bottom-left {
    top: auto;
    bottom: var(--spacing-md);
    left: var(--spacing-md);
    right: auto;
}

.toast-container.bottom-center {
    top: auto;
    bottom: var(--spacing-md);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.toast-container.bottom-right {
    top: auto;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
}

/* 吐司尺寸变体 */
.toast-sm {
    min-width: 250px;
    max-width: 400px;
    padding: var(--spacing-sm);
}

.toast-sm .toast-title {
    font-size: var(--font-size-xs);
}

.toast-sm .toast-message {
    font-size: var(--font-size-xs);
}

.toast-sm .toast-icon {
    width: 16px;
    height: 16px;
    font-size: var(--font-size-base);
}

.toast-sm .toast-close {
    width: 16px;
    height: 16px;
    font-size: var(--font-size-base);
}

.toast-lg {
    min-width: 400px;
    max-width: 600px;
    padding: var(--spacing-lg);
}

.toast-lg .toast-title {
    font-size: var(--font-size-base);
}

.toast-lg .toast-message {
    font-size: var(--font-size-base);
}

.toast-lg .toast-icon {
    width: 24px;
    height: 24px;
    font-size: var(--font-size-xl);
}

.toast-lg .toast-close {
    width: 24px;
    height: 24px;
    font-size: var(--font-size-xl);
}

/* 吐司堆叠效果 */
.toast-stack .toast {
    margin-bottom: var(--spacing-xs);
}

.toast-stack .toast:last-child {
    margin-bottom: 0;
}

/* 大屏幕优化 */
@media (min-width: 1071px) {
    .toast-container {
        max-width: 420px;
        right: 1rem;
    }
}

/* 特大屏幕优化 */
@media (min-width: 1440px) {
    .toast-container {
        max-width: 400px;
        right: 2rem;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toast-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
    
    .toast-container.top-left,
    .toast-container.top-right,
    .toast-container.bottom-left,
    .toast-container.bottom-right {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
    }
    
    .toast-container.top-center,
    .toast-container.bottom-center {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
        transform: none;
    }
}

/* 吐司主题变体 */
.toast-dark {
    background-color: var(--gray-800);
    border-color: var(--gray-700);
    color: var(--gray-100);
}

.toast-dark .toast-title {
    color: var(--gray-100);
}

.toast-dark .toast-message {
    color: var(--gray-300);
}

.toast-dark .toast-close {
    color: var(--gray-400);
}

.toast-dark .toast-close:hover {
    color: var(--gray-300);
}

/* 吐司可点击 */
.toast-clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toast-clickable:hover {
    transform: translateX(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
}

/* 吐司图标样式 */
.toast-icon-img {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}
