/**
 * Global toast notifications (assets/js/toast.js). Shared by the full front end,
 * the lightweight sign-in pages and the phone forms, so it stays self-contained.
 */

.uap-toast-container {
    position: fixed;
    top: max(24px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: min(512px, 100%);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 4px 16px 32px;
    box-sizing: border-box;
}

.uap-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16),
                0 0 0 1px rgba(15, 23, 42, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.95);
    color: var(--uap-text, #0f172a);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--uap-font-family, inherit);
    line-height: 1.4;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-16px) scale(0.94);
    transition: opacity 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: normal;
    box-sizing: border-box;
    flex-shrink: 0;
    max-width: 100%;
}

.uap-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

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

.uap-toast-icon svg {
    width: 20px;
    height: 20px;
}

.uap-toast-message {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

body.admin-bar .uap-toast-container {
    top: max(56px, calc(env(safe-area-inset-top) + 32px));
}

@media (max-width: 782px) {
    body.admin-bar .uap-toast-container { top: max(70px, calc(env(safe-area-inset-top) + 46px)); }
}

.uap-toast-success .uap-toast-icon {
    color: var(--uap-success, #059669);
}

.uap-toast-error .uap-toast-icon {
    color: var(--uap-error, #e11d48);
}

.uap-toast-warning .uap-toast-icon {
    color: var(--uap-warning, #d97706);
}

.uap-toast-info .uap-toast-icon {
    color: var(--uap-action-bg, #4f46e5);
}

.uap-toast-loading .uap-toast-icon {
    color: var(--uap-action-bg, #4f46e5);
}

.uap-toast-spinner {
    animation: uap-toast-spin 0.75s linear infinite;
}

@keyframes uap-toast-spin {
    to {
        transform: rotate(360deg);
    }
}

.uap-toast .uap-toast-action {
    flex-shrink: 1;
    min-width: 0;
    max-width: 40%;
    white-space: normal;
    overflow-wrap: anywhere;
    min-height: 30px;
    margin-left: 4px;
    padding: 4px 10px;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    cursor: pointer;
}

.uap-toast .uap-toast-action:hover {
    background: rgba(6, 95, 70, 0.08);
}

.uap-toast .uap-toast-action:disabled {
    opacity: 0.55;
    cursor: wait;
}
