/* Shared toast component
 * Namespaced as-toast-* to avoid collisions with Bootstrap's .toast and
 * legacy page-local .toast/.error-toast styles. Owned by /static/shared/js/toast.js.
 */

.as-toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.as-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card, #141919);
    border: 1px solid var(--border-card, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    color: var(--text-high, #f0f1f1);
    font-size: 13px;
    line-height: 1.4;
    max-width: 360px;
    animation: asToastSlideIn 0.25s ease;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes asToastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

.as-toast--leave {
    opacity: 0;
    transform: translateX(100%);
}

.as-toast--success { border-color: rgba(34, 197, 94, 0.35); }
.as-toast--error   { border-color: rgba(239, 68, 68, 0.40); }
.as-toast--warning { border-color: rgba(245, 158, 11, 0.40); }
.as-toast--info    { border-color: rgba(59, 130, 246, 0.35); }

.as-toast__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.as-toast__icon svg {
    width: 100%;
    height: 100%;
}

.as-toast--success .as-toast__icon { color: var(--success, #22c55e); }
.as-toast--error   .as-toast__icon { color: var(--error,   #ef4444); }
.as-toast--warning .as-toast__icon { color: var(--warning, #f59e0b); }
.as-toast--info    .as-toast__icon { color: var(--info,    #3b82f6); }

.as-toast__message {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.as-toast__message a {
    color: var(--teal-400, #5eead4);
    text-decoration: underline;
}

.as-toast__close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-medium, rgba(255, 255, 255, 0.6));
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.as-toast__close:hover {
    opacity: 1;
    color: var(--text-high, #f0f1f1);
}

/* Mobile / narrow screen: span width near the bottom edge.
 * Pages with mobile bottom toolbars (e.g. pipeline-builder) override
 * `.as-toast-container` to a higher bottom value in their own CSS. */
@media (max-width: 991px) {
    .as-toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .as-toast {
        max-width: none;
        width: 100%;
    }
}

@supports (padding: env(safe-area-inset-bottom)) {
    .as-toast-container {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (prefers-reduced-motion: reduce) {
    .as-toast {
        animation: none;
        transition: none;
    }
}
