/**
 * Toast 消息提示组件。
 *
 * 来源:从 assets/css/style.css 复制(P1.4 第一刀,行 1746-1857)。仅复制不删原。
 */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    padding: 10px 20px;
    background-color: var(--toast-bg);
    color: var(--token-color-ink-0);
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-standard), transform var(--motion-standard);
    z-index: 2400;
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.18));
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(480px, calc(100vw - 32px));
    white-space: nowrap;
}

.toast::before {
    content: '';
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.toast.success {
    background-color: var(--token-color-success-500);
}

.toast.success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

.toast.error {
    background-color: var(--token-color-danger-500);
}

.toast.error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
}

.toast.warning {
    background-color: var(--token-color-warning-500);
}

.toast.warning::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E");
}

.toast.info {
    background-color: var(--brand-primary);
}

.toast.info::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: toast-slide-in var(--motion-standard) forwards;
    pointer-events: auto;
}

.toast-message {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-action {
    appearance: none;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
    background: transparent;
    color: var(--token-color-ink-0);
    font: inherit;
    font-weight: 700;
    padding: 2px 0 2px 10px;
    margin-left: 2px;
    cursor: pointer;
    white-space: nowrap;
}

.toast-action:hover:not(:disabled) {
    text-decoration: underline;
}

.toast-action:disabled,
.toast.is-busy .toast-action {
    cursor: default;
    opacity: 0.72;
    text-decoration: none;
}
