/* public/css/pwa.css — botão de instalação e banner de dica iOS */

/* Assim como o banner iOS, estes botões só devem existir quando o JS tira o
   atributo [hidden] — nenhuma regra pode fixar `display` fora do :not([hidden]),
   senão o botão fica sempre visível mesmo quando a plataforma não suporta a ação. */
#pwa-install-btn[hidden],
#push-enable-btn[hidden] { display: none; }

#pwa-install-btn:not([hidden]),
#push-enable-btn:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    min-height: 40px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background-color: var(--primary-color, #ffc107);
    color: #212529;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

#pwa-install-btn:hover,
#push-enable-btn:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); transform: translateY(-1px); }
#pwa-install-btn:active,
#push-enable-btn:active { transform: translateY(0); }
#push-enable-btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }

/* O elemento fica no fluxo até o atributo [hidden] entrar em ação.
   Importante: nenhuma regra abaixo pode fixar `display` fora deste seletor,
   senão o atributo [hidden] deixa de funcionar (era o bug do X não fechar). */
#pwa-ios-hint[hidden] { display: none; }
#pwa-ios-hint:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 2000;
    background: #212529;
    color: #fff;
    padding: 14px 16px;
    border-radius: var(--radius-md, 14px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 480px;
    margin-inline: auto;
    animation: pwa-hint-in 0.3s ease;
}

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

#pwa-ios-hint img { width: 30px; height: 30px; flex-shrink: 0; }
#pwa-ios-hint .pwa-ios-hint-icon { font-style: normal; }
#pwa-ios-hint .pwa-ios-hint-close {
    flex-shrink: 0;
    margin-left: auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
#pwa-ios-hint .pwa-ios-hint-close:hover { background: rgba(255, 255, 255, 0.18); }

/* --- Toast genérico (atualização disponível, resultado de teste, etc.) --- */
#app-toast[hidden] { display: none; }
#app-toast:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 2100;
    background: #212529;
    color: #fff;
    padding: 12px 12px 12px 16px;
    border-radius: var(--radius-md, 14px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 480px;
    margin-inline: auto;
    animation: pwa-hint-in 0.3s ease;
}
.app-toast-message { flex: 1; }
.app-toast-action {
    flex-shrink: 0;
    background: var(--primary-color, #ffc107);
    color: #212529;
    border: none;
    border-radius: var(--radius-sm, 8px);
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.app-toast-action:hover { background-color: var(--primary-color-dark, #e0a800); }
.app-toast-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.app-toast-close:hover { background: rgba(255, 255, 255, 0.18); }

@media (prefers-reduced-motion: reduce) {
    #pwa-ios-hint:not([hidden]),
    #app-toast:not([hidden]) { animation: none; }
}
