/* Toast del sito (js/site-toast.js): autonomo, funziona anche senza css/style.css. */
#site-toast-container {
    position: fixed;
    inset: auto 24px 24px auto;
    z-index: 30000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    overflow: visible;
    pointer-events: none;
}

/* Come popover (sopra ai dialog) e' visibile solo mentre contiene toast. */
#site-toast-container[popover]:not(:popover-open) {
    display: none;
}

.site-toast {
    max-width: 100%;
    padding: 13px 18px;
    border-left: 5px solid rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    background: #1e3a8a;
    color: #fff;
    font: 700 0.95rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    white-space: pre-line;
    overflow-wrap: anywhere;
    cursor: pointer;
    pointer-events: auto;
    animation: site-toast-in 0.35s ease-out both;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.site-toast.is-success { background: #1e8449; }
.site-toast.is-error { background: #c0392b; }
.site-toast.is-warning { background: #facc15; color: #422006; border-left-color: #a16207; }
.site-toast.is-info { background: #1f5f99; }

.site-toast.is-leaving {
    opacity: 0;
    transform: translateY(8px);
}

@keyframes site-toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* siteShake(): l'azione richiesta non puo' procedere */
.site-shake {
    animation: site-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes site-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-7px); }
    40%, 60% { transform: translateX(7px); }
}

@media (max-width: 600px) {
    #site-toast-container {
        inset: auto 16px 16px auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-toast { animation: none; transition: none; }
    .site-shake { animation: none; outline: 2px solid #facc15; outline-offset: 2px; }
}
