/* EMNG.Toast — notificacoes nao-bloqueantes */

.em-toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(440px, calc(100vw - 3rem));
    pointer-events: none;
}

@media (max-width: 640px) {
    .em-toast-container {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

.em-toast {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.4rem 1.4rem;
    background: var(--content);
    border-radius: 0.625rem;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.08);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--bs-body-color, #212529);
    pointer-events: auto;
    border-left: 6px solid transparent;
    width: 100%;
    min-height: 76px;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.2s ease-out, transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.em-toast.is-open {
    opacity: 1;
    transform: translateX(0);
}

.em-toast.is-closing {
    opacity: 0;
    transform: translateX(24px);
}

/* Barra de progresso sutil indicando tempo restante antes do dismiss */
.em-toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.18;
    transform-origin: left center;
    animation: em-toast-progresso var(--em-toast-duracao, 4000ms) linear forwards;
}

.em-toast:hover::after {
    animation-play-state: paused;
}

@keyframes em-toast-progresso {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .em-toast,
    .em-toast.is-open,
    .em-toast.is-closing { transition: opacity 0.01s linear; transform: none; }
}

.em-toast__icone {
    font-size: 1.75rem;
    flex-shrink: 0;
    margin-top: 0;
}

.em-toast__mensagem {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.em-toast__fechar {
    background: transparent;
    border: none;
    color: var(--bs-secondary-color, #6c757d);
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    font-size: 1rem;
}

.em-toast__fechar:hover,
.em-toast__fechar:focus-visible {
    background: var(--bs-tertiary-bg, #f8f9fa);
    color: var(--bs-danger, #dc3545);
    outline: none;
}

/* Variantes por tipo */
.em-toast--sucesso {
    border-left-color: var(--success, #28a745);
    /* Fundo branco solido (sem o gradiente com rgba transparente, que
     * deixava a borda esquerda do toast ver-atraves). */
}
.em-toast--sucesso .em-toast__icone {
    color: var(--success, #28a745);
    animation: em-toast-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}

/* Animacao do icone de sucesso: parte de scale 0 + rotacao leve, vai
 * pra 1.0 com overshoot (cubic-bezier elastico). Sentido de "check
 * confirmado" enfatico. */
@keyframes em-toast-pop {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.25) rotate(8deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Pulse leve no border-left do sucesso nos 800ms iniciais */
.em-toast--sucesso::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--success, #28a745);
    animation: em-toast-pulse-borda 1.4s ease-out 1;
    pointer-events: none;
}

@keyframes em-toast-pulse-borda {
    0%   { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.55); }
    100% { box-shadow: 0 0 0 14px rgba(40, 167, 69, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .em-toast--sucesso .em-toast__icone,
    .em-toast--sucesso::before { animation: none; }
}

.em-toast--info {
    border-left-color: var(--bs-primary, #0d6efd);
}
.em-toast--info .em-toast__icone {
    color: var(--bs-primary, #0d6efd);
}

.em-toast--atencao {
    border-left-color: var(--warning, #e6ac00);
}
.em-toast--atencao .em-toast__icone {
    color: var(--warning, #e6ac00);
}

.em-toast--erro {
    border-left-color: var(--danger, #dc3545);
}
.em-toast--erro .em-toast__icone {
    color: var(--danger, #dc3545);
}
