/* ============================================
   Nexxo Store — Mobile App Layout
   ============================================
   - Navegador mobile: tudo normal (só header)
   - App instalado (PWA standalone): bottom nav + sem header
   ============================================ */


/* =========================
   BOTTOM NAV — escondida por padrão
   Só aparece no modo standalone (app instalado)
========================= */

.app-bottom-nav{
    display: none !important;
}

/* Header próprio do app (standalone) */
.app-mobile-header{
    display: none;
}

/* Overlay antigo mantido oculto para compatibilidade */
.app-search-overlay{
    display: none;
}


/* =========================
   MELHORIAS GERAIS MOBILE (browser + standalone)
========================= */

@media(max-width: 900px){

    a, button{
        -webkit-tap-highlight-color: transparent;
    }

    html{
        overscroll-behavior-y: contain;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    .site-footer .footer-newsletter{
        padding: 24px 0;
    }

    .site-footer .footer-grid{
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    .site-footer .footer-about{
        text-align: center;
    }

    .site-footer .footer-social{
        justify-content: center;
    }

    .site-footer .footer-seals-inner{
        gap: 12px;
    }

    .seal-item{
        font-size: 10px;
    }

    .seal-item svg{
        width: 18px;
        height: 18px;
    }
}


/* =========================================================
   STANDALONE MODE — APP INSTALADO
   Só ativa quando o usuário adicionou à tela inicial
========================================================= */

@media(display-mode: standalone) and (max-width: 900px){

    /* ── ESCONDER O HEADER ────────── */
    .header{
        display: none !important;
    }

    /* ── Sem padding-top do header ── */
    body{
        padding-top: calc(64px + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* ── HEADER DO APP: BUSCA + CARRINHO ── */
    .app-mobile-header{
        display:flex;
        position:fixed;
        top:0;
        left:0;
        right:0;
        z-index:9997;
        height:calc(64px + env(safe-area-inset-top, 0px));
        padding:calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
        align-items:center;
        gap:10px;
        background:rgba(8,12,28,.97);
        border-bottom:1px solid rgba(0,217,255,.1);
        box-shadow:0 4px 18px rgba(0,0,0,.32);
        backdrop-filter:blur(20px);
        -webkit-backdrop-filter:blur(20px);
    }

    .app-header-search{
        flex:1;
        min-width:0;
        height:44px;
        display:flex;
        align-items:center;
        gap:9px;
        padding-left:13px;
        overflow:hidden;
        border:1px solid rgba(255,255,255,.09);
        border-radius:13px;
        background:rgba(255,255,255,.055);
        color:rgba(255,255,255,.5);
    }

    .app-header-search:focus-within{
        border-color:rgba(0,217,255,.45);
        background:rgba(0,217,255,.045);
    }

    .app-header-search input{
        flex:1;
        min-width:0;
        height:100%;
        border:0;
        outline:0;
        background:transparent;
        color:#fff;
        font:500 14px 'Inter',sans-serif;
    }

    .app-header-search input::placeholder{
        color:rgba(255,255,255,.34);
    }

    .app-header-search button{
        height:100%;
        padding:0 13px;
        border:0;
        background:rgba(0,217,255,.12);
        color:#00d9ff;
        font:700 11px 'Inter',sans-serif;
        cursor:pointer;
    }

    .app-header-cart{
        position:relative;
        width:44px;
        height:44px;
        flex:0 0 44px;
        display:flex;
        align-items:center;
        justify-content:center;
        border:1px solid rgba(255,255,255,.09);
        border-radius:13px;
        background:rgba(255,255,255,.055);
        color:#dce4f4;
    }

    .app-header-cart-badge{
        position:absolute;
        top:-4px;
        right:-4px;
        min-width:18px;
        height:18px;
        padding:0 5px;
        align-items:center;
        justify-content:center;
        border:2px solid #080c1c;
        border-radius:10px;
        background:#00d9ff;
        color:#02050d;
        font:800 9px 'Inter',sans-serif;
    }

    /* ── MOSTRAR A BOTTOM NAV ────────── */
    .app-bottom-nav{
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9997;

        height: 64px;

        background: rgba(8, 12, 28, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);

        border-top: 1px solid rgba(0, 217, 255, 0.08);

        box-shadow:
            0 -4px 24px rgba(0, 0, 0, 0.4),
            0 -1px 0 rgba(0, 217, 255, 0.06);

        align-items: center;
        justify-content: space-around;

        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0px);

        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .app-bottom-nav.bnav-hidden{
        transform: translateY(100%);
    }


    /* ── Itens da bottom nav ────────── */

    .bnav-item{
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;

        flex: 1;
        height: 100%;

        color: rgba(255, 255, 255, 0.4);
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        font-family: 'Inter', sans-serif;
        letter-spacing: 0.01em;

        border: none;
        background: none;
        cursor: pointer;

        position: relative;

        transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .bnav-item svg{
        width: 22px;
        height: 22px;
        transition: transform 0.2s;
    }

    .bnav-rank-wrap,
    .bnav-avatar-wrap{
        width:30px;
        height:30px;
        margin-top:-8px;
        border-radius:999px;
        display:flex;
        align-items:center;
        justify-content:center;
        background:rgba(10,16,32,.92);
        border:1px solid rgba(255,255,255,.12);
        box-shadow:0 3px 12px rgba(0,0,0,.28);
        overflow:hidden;
        transition:transform .2s, border-color .2s, box-shadow .2s;
    }

    .bnav-rank-wrap img{
        width:23px;
        height:23px;
        object-fit:contain;
        filter:drop-shadow(0 2px 4px rgba(0,0,0,.35));
    }

    .bnav-avatar-wrap img{
        width:100%;
        height:100%;
        object-fit:cover;
        border-radius:inherit;
    }

    .bnav-active .bnav-rank-wrap,
    .bnav-active .bnav-avatar-wrap{
        border-color:rgba(0,217,255,.62);
        box-shadow:0 4px 14px rgba(0,217,255,.18), 0 2px 10px rgba(0,0,0,.28);
        transform:translateY(-1px);
    }

    .bnav-item:active svg{
        transform: scale(0.88);
    }

    .bnav-item:active .bnav-rank-wrap,
    .bnav-item:active .bnav-avatar-wrap{
        transform:scale(.94);
    }

    /* Ativo */
    .bnav-active{
        color: #00d9ff;
    }

    .bnav-active::before{
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 32px;
        height: 2px;
        background: #00d9ff;
        border-radius: 0 0 4px 4px;
        box-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
    }

    /* ── OVERLAY ANTIGO DE BUSCA ── */

    .app-search-overlay{
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10000;
        background: rgba(5, 8, 22, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: env(safe-area-inset-top, 12px) 16px 20px;
        animation: searchFadeIn 0.2s ease;
    }

    .app-search-overlay.active{
        display: block;
    }

    @keyframes searchFadeIn{
        from{ opacity: 0; }
        to{ opacity: 1; }
    }

    .app-search-top{
        display: flex;
        align-items: center;
        gap: 12px;
        padding-top: 12px;
    }

    .app-search-top form{
        flex: 1;
        display: flex;
        align-items: center;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(0, 217, 255, 0.15);
        border-radius: 14px;
        overflow: hidden;
        height: 46px;
    }

    .app-search-top form input{
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        padding: 0 16px;
        color: white;
        font-size: 15px;
        font-family: 'Inter', sans-serif;
        height: 100%;
    }

    .app-search-top form input::placeholder{
        color: rgba(255, 255, 255, 0.3);
    }

    .app-search-top form button[type="submit"]{
        width: 50px;
        height: 100%;
        border: none;
        background: #00d9ff;
        color: black;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .app-search-close{
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        font-size: 16px;
        font-weight: 600;
        font-family: 'Inter', sans-serif;
        cursor: pointer;
        padding: 8px;
        white-space: nowrap;
    }


    /* ── NAVBAR — esconder no standalone ── */
    .navbar{
        display: none !important;
    }

    /* ── FOOTER — enxuto no app ── */
    .footer-newsletter{
        display: none;
    }

    .site-footer .footer-col:not(.footer-about){
        display: none;
    }

    .site-footer .footer-main{
        padding: 20px 0;
    }

    .footer-bottom-inner{
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .footer-legal-links,
    .footer-cnpj{
        font-size: 10px;
    }

    /* ── COOKIE BANNER — acima da bottom nav ── */
    #cookieBanner{
        bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }
}


/* Standalone no desktop (raro mas possível) */
@media(display-mode: standalone) and (min-width: 901px){
    .app-bottom-nav{
        display: none !important;
    }
}


/* =========================
   INSTALL PROMPT BANNER
   Aparece no browser mobile (convida a instalar)
========================= */

.app-install-banner{
    display: none;
    position: fixed;
    bottom: 16px;
    left: 12px;
    right: 12px;
    z-index: 9996;

    background: linear-gradient(135deg, rgba(0, 217, 255, 0.12) 0%, rgba(120, 0, 255, 0.08) 100%);
    border: 1px solid rgba(0, 217, 255, 0.18);
    border-radius: 16px;
    padding: 14px 16px;

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

    animation: slideUpBanner 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.app-install-inner{
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-install-icon{
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-install-icon img{
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.app-install-text{
    flex: 1;
    min-width: 0;
}

.app-install-text strong{
    display: block;
    font-size: 13px;
    color: #fff;
    font-weight: 700;
    margin-bottom: 2px;
}

.app-install-text small{
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.3;
}

.app-install-btn{
    background: #00d9ff;
    color: #000;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: 0.2s;
}

.app-install-btn:active{
    transform: scale(0.95);
}

.app-install-close{
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
