.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    box-shadow: 0 8px 30px -10px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.05);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.6);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

/* Liquid Glass / Dark Mode Support */
.dark .toast {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.2);
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) .toast {
        background: rgba(30, 41, 59, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.2);
    }
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 16px 0 0 16px;
}

.toast.success::before { background-color: #10b981; }
.toast.error::before { background-color: #ef4444; }
.toast.info::before { background-color: #3b82f6; }
.toast.warning::before { background-color: #f59e0b; }

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast.success .toast-icon { color: #10b981; }
.toast.error .toast-icon { color: #ef4444; }
.toast.info .toast-icon { color: #3b82f6; }
.toast.warning .toast-icon { color: #f59e0b; }

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding-right: 6px;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.dark .toast-title { color: #f8fafc; }

@media (prefers-color-scheme: dark) {
    :root:not(.light) .toast-title { color: #f8fafc; }
}

.toast-message {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
    word-break: break-word;
}

.dark .toast-message { color: #94a3b8; }

@media (prefers-color-scheme: dark) {
    :root:not(.light) .toast-message { color: #94a3b8; }
}

.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    margin: -2px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

.dark .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) .toast-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #f8fafc;
    }
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    border-radius: 0 0 16px 16px;
    animation: progressBar 4s linear forwards;
    opacity: 0.8;
}

.toast.success .toast-progress { color: #10b981; }
.toast.error .toast-progress { color: #ef4444; }
.toast.info .toast-progress { color: #3b82f6; }
.toast.warning .toast-progress { color: #f59e0b; }

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.95);
        margin-top: -80px; /* Collapse gap */
    }
}

.toast.removing {
    animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@media (max-width: 640px) {
    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        width: auto;
    }

    .toast {
        padding: 14px 16px;
        gap: 12px;
    }
}

/* Hide original alerts */
.alert.alert-success, .alert.alert-error, .alert.alert-danger, .alert.alert-info, .alert.alert-warning {
    display: none !important;
}
