/* =============================================================================
   MISSÃO AMAZONAS – SEM FRONTEIRAS
   Sistema de notificações (toasts) — balões laterais reutilizáveis.

   Uso via JS:      Notificacao.sucesso("Mensagem", { titulo: "Opcional" })
   Uso via Django:  messages.success(request, "Mensagem")

   Tipos: sucesso · erro · aviso · info
   ============================================================================= */

/* ------------------------- Tokens de cor por tipo ------------------------ */
.area-notificacoes {
    --raio-notif: 14px;
}

/* --------------------------- Área / empilhamento ------------------------- */
.area-notificacoes {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .8rem;
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none; /* a área não bloqueia cliques; só os balões */
}

/* ------------------------------- Balão ---------------------------------- */
.notificacao {
    --cor: #2d6a4f;
    --cor-suave: rgba(45, 106, 79, .14);

    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: 1rem 2.4rem 1rem 1.1rem;
    border-radius: var(--raio-notif);
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .65);
    box-shadow:
        0 14px 34px -10px rgba(4, 20, 12, .38),
        0 0 22px -12px var(--cor);
    overflow: hidden;

    /* estado inicial (fora da tela, à direita) */
    transform: translateX(120%);
    opacity: 0;
    transition:
        transform .5s cubic-bezier(.22, 1, .36, 1),
        opacity .4s ease,
        margin .35s ease;
}

.notificacao.visivel {
    transform: translateX(0);
    opacity: 1;
}

.notificacao.saindo {
    transform: translateX(120%);
    opacity: 0;
    margin-top: -0.4rem; /* leve colapso ao sair */
}

/* Barra de destaque colorida à esquerda */
.notificacao::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--cor), color-mix(in srgb, var(--cor) 65%, #000));
    background: var(--cor); /* fallback caso color-mix não seja suportado */
}

/* ----------------------------- Variações -------------------------------- */
.notificacao--sucesso { --cor: #2d6a4f; --cor-suave: rgba(45, 106, 79, .16); }
.notificacao--erro    { --cor: #d62828; --cor-suave: rgba(214, 40, 40, .13); }
.notificacao--aviso   { --cor: #e8802e; --cor-suave: rgba(232, 128, 46, .16); }
.notificacao--info    { --cor: #1d4e89; --cor-suave: rgba(29, 78, 137, .13); }

/* ------------------------------- Ícone ---------------------------------- */
.notificacao__icone {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--cor-suave);
    animation: notif-pulso 2.4s ease-in-out infinite;
}

.notificacao__icone svg {
    width: 22px;
    height: 22px;
    fill: var(--cor);
}

@keyframes notif-pulso {
    0%, 100% { box-shadow: 0 0 0 0 var(--cor-suave); }
    50%      { box-shadow: 0 0 0 6px transparent; }
}

/* ------------------------------- Texto ---------------------------------- */
.notificacao__corpo {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

.notificacao__titulo {
    font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
    font-size: .95rem;
    color: var(--cor);
    margin-bottom: .15rem;
    line-height: 1.2;
}

.notificacao__texto {
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    font-size: .88rem;
    color: #2c3a29;
    line-height: 1.4;
    word-wrap: break-word;
}

/* ------------------------------ Fechar ---------------------------------- */
.notificacao__fechar {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6b7a63;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.notificacao__fechar:hover {
    background: rgba(0, 0, 0, .06);
    color: #21301f;
    transform: rotate(90deg);
}

.notificacao__fechar svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* --------------------------- Barra de progresso ------------------------- */
.notificacao__progresso {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--cor);
    opacity: .75;
    border-radius: 0 3px 0 var(--raio-notif);
    transform-origin: left;
}

/* --------------------------- Responsivo --------------------------------- */
@media (max-width: 520px) {
    .area-notificacoes {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        width: auto;
    }

    /* no mobile os balões sobem a partir da base */
    .notificacao {
        transform: translateY(140%);
    }
    .notificacao.visivel { transform: translateY(0); }
    .notificacao.saindo  { transform: translateY(140%); }
}

/* --------------------- Acessibilidade / movimento ----------------------- */
@media (prefers-reduced-motion: reduce) {
    .notificacao {
        transition: opacity .2s ease;
        transform: none;
    }
    .notificacao.saindo { transform: none; }
    .notificacao__icone { animation: none; }
}
