/* Sistema global de notificações Toast */

/* Ocultar alertas antigos (inc.msg, inc.erros) antes da migração para toast */
.msg.msg-toast,
#msg_lista_um_erro,
#msg_lista_varios_erros {
    display: none !important;
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.toast-container > * {
    pointer-events: auto;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12), 0 0 1px rgba(0,0,0,.08);
    border-left: 4px solid var(--toast-color, #3b82f6);
    animation: toastIn 0.35s ease-out;
    min-width: 280px;
    max-width: 100%;
}

.toast-dismissing {
    animation: toastOut 0.3s ease-in forwards;
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: var(--toast-color, #3b82f6);
    margin-top: 0.1rem;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
    margin-bottom: 0.2rem;
}

.toast-body {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.toast-body a.toast-action {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: var(--toast-color, #3b82f6);
    color: #fff !important;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.toast-body a.toast-action:hover {
    filter: brightness(1.1);
}

.toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 6px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}

.toast-close:hover {
    background: #e5e7eb;
    color: #374151;
}

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

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

/* Mobile: ocupar largura com margem */
@media (max-width: 480px) {
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        top: 0.75rem;
        max-width: none;
    }
    .toast {
        min-width: 0;
        width: 100%;
    }
}
