/*
 Aviso de atualizacao (public/js/core/AppUpdate.js).

 Fica no topo ao centro por eliminacao: o canto superior direito e do
 #prompt-container (sysmsg) e o inferior direito e do #vc-pip-overlay. Os tres
 podem estar na tela ao mesmo tempo durante uma chamada.
*/
#app-update-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);

    display: flex;
    align-items: center;
    gap: 18px;

    max-width: min(560px, calc(100vw - 32px));
    padding: 12px 16px;

    background: hsl(from var(--main) h s calc(l * 3));
    color: hsl(from var(--main) h s calc(l * 12));
    border: 1px solid var(--border-color-bright);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);

    z-index: 99998; /* abaixo do sysmsg, acima do resto */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#app-update-banner.visivel {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#app-update-banner .app-update-texto {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
    line-height: 1.35;
}

#app-update-banner .app-update-texto strong {
    font-size: 14px;
    font-weight: 600;
}

#app-update-banner #app-update-detalhe {
    font-size: 13px;
    opacity: 0.75;
}

#app-update-banner .app-update-acoes {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

#app-update-banner .app-update-btn {
    border: none;
    border-radius: 6px;
    padding: 8px 14px;

    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;

    background: #5865f2;
    color: #fff;
    transition: filter 0.15s ease, background 0.15s ease;
}

#app-update-banner .app-update-btn:hover {
    filter: brightness(1.12);
}

#app-update-banner .app-update-btn.secundario {
    background: transparent;
    color: hsl(from var(--main) h s calc(l * 10));
    border: 1px solid var(--border-color-bright);
}

#app-update-banner .app-update-btn.secundario:hover {
    background: hsl(from var(--main) h s calc(l * 5));
}

/* No celular a largura nao cabe titulo, detalhe e dois botoes na mesma linha */
@media (max-width: 620px) {
    #app-update-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        left: 16px;
        right: 16px;
        max-width: none;
        transform: translateY(-12px);
    }

    #app-update-banner.visivel {
        transform: translateY(0);
    }

    #app-update-banner .app-update-acoes {
        margin-left: 0;
    }

    #app-update-banner .app-update-btn {
        flex: 1;
    }
}


/*
 Seta verde no cabecalho, ao lado dos outros icones.

 Existe porque a faixa e passageira: quem clica em "Depois", ou so nao viu o
 aviso passar, ficava sem nenhum sinal de que a atualizacao esta esperando. O
 icone e o lembrete permanente, e o clique faz exatamente o que o botao
 "Atualizar agora" faz.
*/
.headerIcon.update {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2323a55a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5v11'/%3E%3Cpath d='M6.8 9.6 12 14.8l5.2-5.2'/%3E%3Cpath d='M5 19.5h14'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;

    opacity: 0;
    transition: opacity 0.25s ease, filter 0.15s ease;
}

.headerIcon.update.visivel {
    opacity: 1;
    animation: app-update-descer 2.4s ease-in-out infinite;
}

.headerIcon.update:hover {
    filter: brightness(1.25);
}

/* balanco curto para baixo: chama atencao sem virar piscar de alerta */
@keyframes app-update-descer {
    0%, 70%, 100% { transform: translateY(0); }
    82% { transform: translateY(2.5px); }
}

@media (prefers-reduced-motion: reduce) {
    .headerIcon.update.visivel {
        animation: none;
    }
}
