.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
    animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    will-change: transform;
    position: relative;
    overflow: hidden;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.28), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.26), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.toast.warning {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.28), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.toast.info {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.28), 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.15), 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast.success {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.14), 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast.warning {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15), 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast.info {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.toast.warning .toast-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.toast.info .toast-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    transition: color 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-main);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 16px 16px;
    animation: toastProgressShrink linear forwards;
}

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

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

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

.toast.info .toast-progress {
    background: #3b82f6;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

@keyframes toastSlideInMobile {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOutMobile {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(40px);
    }
}

@keyframes toastProgressShrink {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        right: 16px;
        left: 16px;
    }

    body:has(.bottom-nav) .toast-container {
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .toast {
        min-width: auto;
        max-width: none;
        animation-name: toastSlideInMobile;
    }

    .toast.removing {
        animation-name: toastSlideOutMobile;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .toast.removing {
        animation: none;
        opacity: 0;
    }
}