/**
 * IABT Toast — shared notification component
 *
 * Fixed-position toast container anchored to the top-right of the
 * viewport. Any widget can trigger toasts via the iabtToast JS API.
 * Designed as a shared primitive alongside iabt-tabs-shell and
 * iabt-slider-shell.
 *
 * Scoped under .iabt-toast so specificity stays at 0,2,0 for
 * child selectors — low enough for Elementor overrides to win.
 */

/* ─── Container ─── */

.iabt-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    width: 380px;
    max-width: calc(100vw - 48px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    font-family: var(--iabt-font-family);
}

/* ─── Alert ─── */

.iabt-toast .iabt-toast-alert {
    pointer-events: auto;
    position: relative;
    padding: 14px 44px 14px 20px;
    border-radius: 12px;
    font-size: var(--iabt-text-sm);
    font-weight: var(--iabt-font-medium);
    line-height: var(--iabt-line-height-body);
    box-shadow: 0 8px 32px var(--iabt-shadow-lg),
                0 2px 8px var(--iabt-shadow-sm);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: iabt-toast-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.iabt-toast .iabt-toast-alert p {
    margin: 0;
}

/* ─── Variants ─── */

.iabt-toast .iabt-toast-alert--success {
    background: hsl(var(--iabt-success-hsl), 0.12);
    color: var(--iabt-success);
}

.iabt-toast .iabt-toast-alert--error {
    background: hsl(var(--iabt-error-hsl), 0.12);
    color: var(--iabt-error);
}

.iabt-toast .iabt-toast-alert--notice {
    background: hsl(var(--iabt-warning-hsl), 0.12);
    color: var(--iabt-warning);
}

/* ─── Close button ─── */

.iabt-toast .iabt-toast-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.iabt-toast .iabt-toast-close:hover {
    opacity: 1;
    background: var(--iabt-shadow-sm);
}

/* ─── Entrance animation (slide down from top) ─── */

@keyframes iabt-toast-in {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Exit animation ─── */

.iabt-toast .iabt-toast-alert--out {
    animation: iabt-toast-out 0.3s ease-in forwards;
}

@keyframes iabt-toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
}

/* ─── Responsive ─── */

@media (max-width: 480px) {
    .iabt-toast {
        top: 12px;
        right: 12px;
        width: calc(100vw - 24px);
    }
}

/* ─── Accessibility ─── */

.iabt-toast .iabt-toast-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ─── Print ─── */

@media print {
    .iabt-toast {
        display: none;
    }
}
