.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 420px;
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(229, 231, 235, 0.9);
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    --toast-accent: rgba(17, 24, 39, 0.65);
    color: var(--dif-text);
    overflow: hidden;
    transform: translateY(-6px);
    opacity: 0;
    animation: toast-in 220ms ease-out forwards;
}

.toast::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--toast-accent);
    opacity: 0.85;
}

.toast.toast--leaving {
    animation: toast-out 160ms ease-in forwards;
}

.toast--error {
    border-color: rgba(239, 68, 68, 0.35);
    background-color: rgba(254, 242, 242, 0.92);
    --toast-accent: rgba(239, 68, 68, 0.95);
}

.toast--success {
    border-color: rgba(34, 197, 94, 0.35);
}

.toast--info {
    border-color: rgba(91, 186, 208, 0.35);
}

.toast--primary {
    border-color: rgba(91, 186, 208, 0.45);
    background-color: rgba(239, 246, 255, 0.92);
    --toast-accent: rgba(91, 186, 208, 0.95);
}

.toast--warning {
    border-color: rgba(245, 158, 11, 0.45);
    background-color: rgba(255, 251, 235, 0.92);
    --toast-accent: rgba(245, 158, 11, 0.95);
}

.toast__icon {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1;
}

.toast--error .toast__icon {
    background-color: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.toast--success .toast__icon {
    background-color: rgba(34, 197, 94, 0.12);
    color: #22C55E;
}

.toast--info .toast__icon {
    background-color: rgba(91, 186, 208, 0.12);
    color: #5BBAD0;
}

.toast--primary .toast__icon {
    background-color: rgba(91, 186, 208, 0.12);
    color: #5BBAD0;
}

.toast--warning .toast__icon {
    background-color: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.toast__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.toast__title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgba(17, 24, 39, 0.95);
}

.toast__message {
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: rgba(55, 65, 81, 0.95);
    white-space: pre-line;
}

.toast__close {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1.1rem;
    opacity: 0.75;
}

.toast__close:hover {
    opacity: 1;
}

.toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    background: rgba(17, 24, 39, 0.12);
}

.toast__progress::after {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: left;
    transform: scaleX(1);
    background: var(--toast-accent);
    opacity: 0.55;
    animation: toast-progress var(--toast-time, 4000ms) linear forwards;
}

@keyframes toast-in {
    from {
        transform: translateY(-6px) translateX(6px);
        opacity: 0;
    }
    to {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-6px);
        opacity: 0;
    }
}

@keyframes toast-progress {
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 520px) {
    .toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        top: var(--spacing-md);
    }

    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
        transform: none;
        opacity: 1;
    }
    .toast.toast--leaving {
        animation: none;
    }
    .toast__progress::after {
        animation: none;
    }
}
