/* Barra de instalação PWA — rodapé, 1 linha compacta e ultra discreta */
#pwa-install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    line-height: 1.2;
}

#pwa-install-prompt.show {
    animation: pegaBarSlideUp .3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.pwa-prompt-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

#pwa-install-prompt img {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: cover;
}

.pwa-prompt-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    color: #444;
}

.pwa-prompt-text strong {
    font-weight: 600;
    color: #111;
}

.pwa-prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#pwa-install-btn {
    padding: 5px 14px;
    margin: 0;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #0073aa;
    color: #fff;
    transition: background 0.2s;
    white-space: nowrap;
    line-height: 1.2;
}

#pwa-install-btn:hover {
    background: #005a87;
}

#pwa-dismiss-btn {
    background: transparent;
    border: none;
    color: #8e8e93;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    flex-shrink: 0;
    transition: color 0.2s;
}

#pwa-dismiss-btn:hover {
    color: #333;
}

/* Card Flutuante de Notificações Push — Parte Superior */
#pega-push-prompt {
    position: fixed;
    top: 20px;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 24px;
    bottom: auto;
    z-index: 9999998;
    max-width: 390px;
    width: calc(100% - 32px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14), 0 0 1px rgba(0, 0, 0, 0.2);
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    animation: pegaSlideDown .35s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

body.admin-bar #pega-push-prompt {
    top: calc(52px + env(safe-area-inset-top, 0px));
}
@media screen and (max-width: 782px) {
    body.admin-bar #pega-push-prompt {
        top: calc(66px + env(safe-area-inset-top, 0px));
    }
}

@keyframes pegaSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pega-push-prompt-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.pega-push-prompt-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: cover;
}

.pega-push-prompt-text {
    flex: 1;
    min-width: 0;
}

.pega-push-prompt-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.3;
}

.pega-push-prompt-text p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #555555;
}

.pega-push-prompt-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.pega-push-btn-allow {
    background: #0073aa;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.pega-push-btn-allow:hover, .pega-push-btn-allow:active {
    background: #005a87;
}

.pega-push-btn-dismiss {
    background: transparent;
    color: #666666;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.pega-push-btn-dismiss:hover {
    background: #f0f0f0;
    color: #333333;
}

@media (max-width: 600px) {
    #pega-push-prompt {
        top: 12px;
        top: calc(12px + env(safe-area-inset-top, 0px));
        left: 14px;
        right: 14px;
        bottom: auto;
        width: auto;
        max-width: none;
    }
}

.pwa-prompt-actions { flex-wrap: wrap; }

/* Modelo B — Pill flutuante + cartão de benefícios (canto inferior direito) */
#pwa-install-pill {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 9999997;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 9px 9px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #111;
    cursor: pointer;
    box-sizing: border-box;
    line-height: 1.2;
}

#pwa-install-pill.show {
    animation: pegaPillPop .3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pegaPillPop {
    from { transform: translateY(8px) scale(.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

#pwa-install-pill img {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
}

#pwa-install-pill:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

#pwa-install-sheet {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 9999997;
    max-width: 340px;
    width: calc(100% - 32px);
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#pwa-install-sheet.show {
    animation: pegaSheetUp .3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pegaSheetUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pwa-sheet-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14), 0 0 1px rgba(0, 0, 0, 0.2);
    padding: 16px;
}

.pwa-sheet-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.pwa-sheet-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex-shrink: 0;
    object-fit: cover;
}

.pwa-sheet-titles {
    flex: 1;
    min-width: 0;
}

.pwa-sheet-titles strong,
.pwa-sheet-titles #pwa-sheet-title {
    display: block;
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.pwa-sheet-titles span,
.pwa-sheet-titles .pwa-subtitle {
    display: block;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Texto só para leitor de tela (ex.: rótulo da lista de benefícios) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Escondido acessível tem precedência sobre display flex do show */
#pwa-install-prompt[hidden],
#pwa-install-pill[hidden],
#pwa-install-sheet[hidden] {
    display: none !important;
}

#pwa-sheet-close {
    background: transparent;
    border: none;
    color: #8e8e93;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    flex-shrink: 0;
}

#pwa-sheet-close:hover {
    color: #333;
}

.pwa-sheet-benefits {
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
}

.pwa-sheet-benefits li {
    position: relative;
    font-size: 13px;
    line-height: 1.45;
    color: #444;
    padding-left: 22px;
    margin-bottom: 7px;
}

.pwa-sheet-benefits li:last-child {
    margin-bottom: 0;
}

.pwa-sheet-benefits li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: #0073aa;
    font-weight: 700;
}

.pwa-sheet-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#pwa-sheet-install {
    flex: 1;
    padding: 9px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: #0073aa;
    color: #fff;
    transition: background 0.2s;
    line-height: 1.2;
}

#pwa-sheet-install:hover {
    background: #005a87;
}

#pwa-sheet-dismiss {
    background: transparent;
    color: #666666;
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

#pwa-sheet-dismiss:hover {
    background: #f0f0f0;
    color: #333333;
}

@media (max-width: 600px) {
    #pwa-install-sheet {
        right: 14px;
        left: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
    }
    #pwa-install-pill {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
}

@media print {
    #pwa-install-prompt, #pwa-install-pill, #pwa-install-sheet, #pega-push-prompt { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    #pwa-install-prompt, #pwa-install-pill, #pwa-install-sheet, #pega-push-prompt { animation: none; }
}
