:root {
    --fluid-toast-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --fluid-toast-primary: #3E285C;
    --fluid-toast-accent: #667eea;
    --fluid-toast-accent-end: #764ba2;
}

.fluid-toast-stack {
    position: fixed;
    top: 1.15rem;
    right: 1.15rem;
    z-index: 19999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(100vw - 2rem, 22.5rem);
    pointer-events: none;
}

.fluid-toast {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow:
        0 18px 44px rgba(62, 40, 92, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
    transform: translateX(calc(100% + 1.5rem)) scale(0.96);
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease;
}

.fluid-toast.is-visible {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.fluid-toast.is-leaving {
    transform: translateX(calc(100% + 1.5rem)) scale(0.96);
    opacity: 0;
}

.fluid-toast::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--fluid-toast-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.55;
}

.fluid-toast-bubbles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.fluid-toast-bubble {
    position: absolute;
    bottom: -1.5rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), rgba(102, 126, 234, 0.28) 50%, rgba(118, 75, 162, 0.12) 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    opacity: 0;
    animation: fluid-toast-bubble-rise var(--bubble-duration, 3.6s) ease-in-out forwards;
}

@keyframes fluid-toast-bubble-rise {
    0% {
        transform: translate3d(0, 0, 0) scale(0.4);
        opacity: 0;
    }

    15% {
        opacity: 0.7;
    }

    75% {
        transform: translate3d(var(--bubble-drift, 0px), -7.5rem, 0) scale(1);
        opacity: 0.45;
    }

    100% {
        transform: translate3d(var(--bubble-drift, 0px), -8.5rem, 0) scale(1.2);
        opacity: 0;
    }
}

.fluid-toast-accent-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--fluid-toast-gradient);
    z-index: 1;
}

.fluid-toast-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 0.9rem 1rem 1rem;
}

.fluid-toast-icon-wrap {
    flex-shrink: 0;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fluid-toast-gradient);
    color: #fff;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.32);
    font-size: 0.95rem;
}

.fluid-toast-content {
    flex: 1;
    min-width: 0;
    padding-top: 0.1rem;
}

.fluid-toast-title {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--fluid-toast-primary);
}

.fluid-toast-message {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.45;
    color: rgba(62, 40, 92, 0.72);
    word-break: break-word;
}

.fluid-toast-close {
    flex-shrink: 0;
    width: 1.85rem;
    height: 1.85rem;
    margin: -0.15rem -0.1rem 0 0;
    border: none;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--fluid-toast-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.fluid-toast-close:hover {
    background: rgba(102, 126, 234, 0.18);
    color: #4a2f6e;
    transform: scale(1.05);
}

.fluid-toast-close:focus-visible {
    outline: 2px solid var(--fluid-toast-accent);
    outline-offset: 2px;
}

.fluid-toast-progress {
    position: relative;
    z-index: 2;
    height: 3px;
    background: rgba(102, 126, 234, 0.1);
    overflow: hidden;
}

.fluid-toast-progress-bar {
    height: 100%;
    width: 100%;
    background: var(--fluid-toast-gradient);
    transform-origin: left center;
    transform: scaleX(1);
}

.fluid-toast.is-paused .fluid-toast-progress-bar {
    animation-play-state: paused;
}

.fluid-toast.type-success .fluid-toast-icon-wrap {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.28);
}

.fluid-toast.type-error .fluid-toast-icon-wrap {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.28);
}

.fluid-toast.type-warning .fluid-toast-icon-wrap {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.28);
}

.fluid-toast.type-info .fluid-toast-icon-wrap {
    background: var(--fluid-toast-gradient);
}

@media (max-width: 575.98px) {
    .fluid-toast-stack {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }

    .fluid-toast-inner {
        padding: 0.9rem 0.75rem 0.9rem 0.85rem;
    }
}

@keyframes fluid-toast-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fluid-toast,
    .fluid-toast-bubble,
    .fluid-toast-progress-bar {
        animation: none !important;
        transition: none !important;
    }

    .fluid-toast.is-visible {
        transform: none;
        opacity: 1;
    }
}
