/* ============================================================
   COMMERCEFLOW — MOBILE APP EXPERIENCE v1.0
   No celular o sistema vira um app: bottom navigation,
   safe-areas (notch), toques generosos e drawer lateral.
   ============================================================ */

/* ── BOTTOM NAVIGATION ──────────────────────────────────────── */
#cfBottomNav {
    display: none;
}

@media (max-width: 768px) {
    #cfBottomNav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        height: calc(var(--bottom-nav-height, 62px) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(18px) saturate(160%);
        -webkit-backdrop-filter: blur(18px) saturate(160%);
        border-top: 1px solid var(--gray-100);
        box-shadow: 0 -6px 24px rgba(40, 30, 5, 0.08);
    }

    .cf-bnav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border: none;
        background: transparent;
        color: var(--gray-500);
        font-family: inherit;
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        padding: 6px 2px;
        transition: color .2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .cf-bnav-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 28px;
        border-radius: 14px;
        font-size: 17px;
        transition: all .25s var(--ease-out-expo, ease);
    }

    .cf-bnav-label {
        max-width: 72px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cf-bnav-item.active {
        color: var(--primary-darker);
    }

    .cf-bnav-item.active .cf-bnav-icon {
        background: var(--primary-grad);
        color: var(--primary-contrast);
        box-shadow: 0 4px 12px rgba(var(--primary-rgb), .4);
        transform: translateY(-2px);
    }

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

    /* Badge de notificação na barra */
    .cf-bnav-badge {
        position: absolute;
        top: -4px;
        right: 2px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 8px;
        background: var(--danger);
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cf-bnav-badge[data-zero="true"] {
        display: none;
    }

    /* ── LAYOUT: espaço para a barra inferior ── */
    .content-area {
        padding-bottom: calc(var(--bottom-nav-height, 62px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
    }

    /* Barras flutuantes de módulos (ex: carrinho de vendas) sobem */
    .nv-mobile-bar {
        bottom: calc(var(--bottom-nav-height, 62px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
    }

    /* ── HEADER estilo app ── */
    .top-header {
        position: sticky;
        top: 0;
        z-index: 1100;
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(56px + env(safe-area-inset-top, 0px));
    }

    /* ── DRAWER (menu "Mais") ── */
    .sidebar {
        width: min(300px, 84vw);
        border-radius: 0 24px 24px 0;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
    }

    /* Overlay escuro atrás do drawer */
    .sidebar.active::after {
        content: '';
        position: fixed;
        top: 0;
        bottom: 0;
        left: min(300px, 84vw);
        right: 0;
        background: rgba(15, 10, 0, 0.45);
        z-index: -1;
        animation: drawerFade .25s ease;
    }

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

    /* ── TOQUES ── */
    .btn, button, .menu-item {
        min-height: 44px;
    }

    input, select, textarea {
        font-size: 16px !important; /* evita zoom automático do iOS */
    }

    /* ── LOGIN no mobile ── */
    .login-container {
        padding: 38px 26px 30px;
        border-radius: 22px;
    }

    .login-bg .orb-1 { width: 300px; height: 300px; }
    .login-bg .orb-2 { width: 260px; height: 260px; }
    .login-bg .orb-3 { width: 180px; height: 180px; }
}

/* Telas muito pequenas: esconde labels, só ícones */
@media (max-width: 340px) {
    .cf-bnav-label {
        display: none;
    }
}
