.modern-toast-stack {
    position: fixed;
    right: 1.5rem;
    top: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}

.modern-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.625rem;
    overflow: hidden;
    border: 1px solid #dbe5f2;
    border-radius: 0.625rem;
    background: rgba(252, 253, 255, 0.98);
    box-shadow: 0 10px 24px rgba(33, 62, 112, 0.1);
    color: #314560;
    padding: 0.72rem 0.85rem 0.78rem 0.8rem;
    font-size: 0.78rem;
    line-height: 1.35;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateX(calc(100% + 1.5rem));
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.25s ease;
    pointer-events: auto;
}

.modern-toast.modern-toast-active {
    transform: translateX(0);
    opacity: 1;
}

.modern-toast-success {
    border-color: #bde4cc;
    background: rgba(240, 252, 245, 0.98);
    color: #16643d;
}

.modern-toast-error {
    border-color: #f0cad0;
    background: rgba(255, 245, 246, 0.98);
    color: #b9384e;
}

.modern-toast-info {
    border-color: #c8d9f3;
    background: rgba(242, 247, 255, 0.98);
    color: #24508d;
}

.modern-toast-content {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}

.modern-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    margin-top: 0.05rem;
}

.modern-toast-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.modern-toast-title {
    color: #1f2f49;
    font-size: 0.82rem;
    font-weight: 600;
}

.modern-toast-message {
    min-width: 0;
    color: currentColor;
    word-break: break-word;
}

.modern-toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: currentColor;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.modern-toast-close:hover {
    opacity: 1;
}

.modern-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
}

.modern-toast-progress::before {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: right center;
    animation: modern-toast-progress linear forwards;
    animation-duration: var(--modern-toast-duration, 3500ms);
}

.modern-toast-success .modern-toast-progress::before {
    background: #15803d;
}

.modern-toast-error .modern-toast-progress::before {
    background: #dc2626;
}

.modern-toast-info .modern-toast-progress::before {
    background: #2563eb;
}

:root[data-theme="attackvaultdark"] .modern-toast {
    border-color: rgba(151, 178, 235, 0.14);
    background: rgba(22, 31, 49, 0.96);
    color: rgba(237, 237, 237, 0.8);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

:root[data-theme="attackvaultdark"] .modern-toast-success {
    border-color: rgba(74, 222, 128, 0.2);
    background: rgba(22, 33, 26, 0.96);
    color: #bceccc;
}

:root[data-theme="attackvaultdark"] .modern-toast-error {
    border-color: rgba(243, 139, 160, 0.22);
    background: rgba(44, 24, 29, 0.96);
    color: #ffc6d1;
}

:root[data-theme="attackvaultdark"] .modern-toast-info {
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(19, 31, 52, 0.96);
    color: #c9ddff;
}

:root[data-theme="attackvaultdark"] .modern-toast-title {
    color: #f4f6fb;
}

@keyframes modern-toast-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 640px) {
    .modern-toast-stack {
        left: 1rem;
        right: 1rem;
        top: 1rem;
        max-width: none;
    }
}
