/* pwa.css — Botão "Instalar", tela de reconexão e sheet de instalação do app (PWA).
   Independente do Tailwind: funciona em qualquer página que inclua pwa_head.php. */

/* ---------- Botão "Instalar": só aparece no navegador, nunca dentro do app instalado ---------- */
.nx-install-btn {
    display: flex !important;
}

html.nx-standalone .nx-install-btn,
.nx-install-btn.nx-hidden {
    display: none !important;
}

/* Barra inferior do dashboard: 6 colunas quando o botão "Instalar" está visível */
html:not(.nx-standalone) .nx-nav-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

html.nx-standalone .nx-nav-grid,
html .nx-nav-grid.nx-nav-noinstall {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.nx-install-btn .nx-install-dot {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #a1a1aa;
    box-shadow: 0 0 0 0 rgba(161, 161, 170, 0.4);
    animation: nxPing 1.8s infinite;
}

@keyframes nxPing {
    0% {
        box-shadow: 0 0 0 0 rgba(161, 161, 170, 0.4);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(161, 161, 170, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(161, 161, 170, 0);
    }
}

/* ---------- Tela de "entrando..." enquanto o app reconecta pelo login salvo ---------- */
html.nx-restoring body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    background: #09090b url('/icons/icon-192.png') center 42% / 112px no-repeat;
}

html.nx-restoring body::after {
    content: 'Entrando na sua conta…';
    position: fixed;
    left: 0;
    right: 0;
    top: calc(42% + 84px);
    z-index: 2147483647;
    text-align: center;
    font: 600 13px/1.4 system-ui, -apple-system, sans-serif;
    color: #a1a1aa;
}

/* ---------- Sheet de instalação ---------- */
dialog.nx-sheet {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    width: 100vw;
    max-width: 100vw;
    max-height: 94vh;
    max-height: 94dvh;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 10060;
    color: #fafafa;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    overscroll-behavior: contain;
}

dialog.nx-sheet:not([open]) {
    display: none;
}

html.nx-install-open {
    overflow: hidden;
}

dialog.nx-sheet.nx-sheet-fallback[open] {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    background: rgba(0, 0, 0, 0.75);
}

dialog.nx-sheet-fallback .nx-sheet-panel {
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    dialog.nx-sheet {
        inset: 0;
        margin: auto;
        max-width: 440px;
        height: fit-content;
    }

    dialog.nx-sheet.nx-sheet-fallback[open] {
        align-items: center;
    }

    dialog.nx-sheet-fallback .nx-sheet-panel {
        max-width: 440px;
    }
}

dialog.nx-sheet::backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

dialog.nx-sheet[open] .nx-sheet-panel {
    animation: nxSlideUp 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nxSlideUp {
    from {
        transform: translateY(48px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nx-sheet-panel {
    background: #18181b;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    max-height: 94vh;
    max-height: 94dvh;
    overflow-y: auto;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 640px) {
    .nx-sheet-panel {
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 24px;
    }
}

.nx-sheet-grip {
    width: 40px;
    height: 5px;
    border-radius: 999px;
    background: #3f3f46;
    margin: -6px auto 14px;
}

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

.nx-sheet-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    flex: none;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.nx-sheet-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
    color: #fff;
}

.nx-sheet-sub {
    margin: 3px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: #a1a1aa;
}

.nx-sheet-close {
    margin-left: auto;
    align-self: flex-start;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 999px;
    border: 0;
    background: #27272a;
    color: #d4d4d8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.nx-perks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 4px;
}

.nx-perk {
    padding: 9px 6px;
    border-radius: 14px;
    background: rgba(39, 39, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #e4e4e7;
}

.nx-perk .nx-glyph {
    display: flex;
    margin: 0 auto 4px;
    background: transparent;
    color: #a1a1aa;
}

.nx-steps-label {
    margin: 16px 0 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a1a1aa;
}

.nx-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.nx-step {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(39, 39, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    line-height: 1.4;
    color: #e4e4e7;
}

.nx-step b {
    color: #fff;
}

.nx-step-num {
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 999px;
    background: #52525b;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nx-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -5px;
    width: 24px;
    height: 24px;
    margin: 0 2px;
    border-radius: 7px;
    background: #3f3f46;
    color: #d4d4d8;
}

.nx-glyph svg {
    width: 15px;
    height: 15px;
}

.nx-note {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(63, 63, 70, 0.35);
    border: 1px solid rgba(161, 161, 170, 0.2);
    color: #d4d4d8;
    font-size: 12px;
    line-height: 1.45;
}

.nx-actions {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.nx-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #27272a;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.nx-btn:active {
    transform: scale(0.98);
}

.nx-btn-primary {
    border-color: #71717a;
    background: #3f3f46;
    box-shadow: 0 10px 26px -10px rgba(0, 0, 0, 0.5);
}

/* ---------- Toast ---------- */
.nx-toast {
    position: fixed;
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    z-index: 10070;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    padding: 10px 16px;
    border-radius: 999px;
    background: #3f3f46;
    color: #fff;
    font: 700 13px/1.3 system-ui, -apple-system, sans-serif;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    transition: opacity 0.2s ease, transform 0.2s ease;
    width: max-content;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    text-align: center;
}

.nx-toast.nx-show {
    opacity: 1;
    transform: translate(-50%, 0);
}